Skip to main content
The SuperDoc SDK ships tool definitions that give LLMs structured access to document operations. They cover reading, searching, editing, formatting, lists, comments, tracked changes, and batched mutations. Pick a provider format, pass the tools to your model, dispatch the calls, and the SDK handles schema formatting, argument validation, and execution.

Quick start

Install the SDK, create a client, open a document, and wire up an agentic loop.

Tool selection

chooseTools() returns provider-formatted tool definitions ready to pass to your LLM.
The current SDK returns the full grouped intent tool set for the selected provider. Group filtering and meta-discovery are not part of the shipped public API here.

Tool catalog

The generated catalog currently contains 9 grouped intent tools. Most tools use an action argument to select the underlying operation. Single-action tools like superdoc_search do not require action.
Built-in tools cover the core operations. For tables, images, hyperlinks, and anything else, create custom tools that call any doc.* operation today.

Dispatching tool calls

dispatchSuperDocTool() resolves a tool name to the correct SDK method, validates arguments, and executes the call against a bound document handle.
The dispatcher validates required parameters, checks that arguments are compatible, and throws descriptive errors the LLM can act on.

System prompt

getSystemPrompt() returns a default prompt that teaches the model the tool workflow: targeting, search-before-edit, and common patterns. It’s optional. You can use it as-is, extend it with your own instructions, or write a completely custom prompt.

Provider formats

Each provider gets tool definitions in its native format.

Creating custom tools

The built-in tools cover core editing operations. For advanced features like tables, images, hyperlinks, footnotes, and citations, create custom tools that call doc.* methods directly.

Step 1: Pick your operations

Every doc.* namespace maps to a group of Document API operations:

Step 2: Define the tool schema

Group related operations under a single tool using an action enum. This matches the pattern the built-in tools use.
  • Keep descriptions short. The model reads every tool definition on each turn.
  • Use additionalProperties: false to prevent hallucinated parameters.
  • Reference superdoc_search in descriptions so the model knows how to get targets.

Step 3: Write a dispatcher

Map each action to the corresponding doc.* call:

Step 4: Merge and use

Combine your custom tool with the SDK tools and use your dispatcher in the agentic loop:

Extending the system prompt

For custom tools, append usage instructions to the SDK system prompt so the model knows how to use them:

SDK functions

  • How to use: step-by-step integration guide with copy-pasteable code
  • Best practices: prompting, workflow tips, and tested prompt examples
  • Debugging: troubleshoot tool call failures
  • SDKs: typed Node.js and Python wrappers
  • Document API: the operation set behind the tools