Skip to main content
Glama

Get Talonic Document

talonic_get_document

Fetch complete metadata for a specific document in the Talonic workspace using its document ID.

Instructions

Fetch full metadata for a single document already in the user's Talonic workspace. Returns id, filename, page count, detected document type, language, processing log, and link URLs (self, extractions, dashboard).

USE WHEN:

  • You need details about a specific document the user already extracted or uploaded.

  • You have a document_id from a previous extract or search call and want more context.

  • The user asks 'tell me about document X' or similar.

DO NOT USE WHEN:

  • The user wants the document's full text content (use talonic_to_markdown for OCR markdown).

  • The user wants extracted structured data (use talonic_extract with a schema, or fetch the extraction by id).

  • The user has a file but no document_id yet (call talonic_extract first to ingest the document).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idYesThe Talonic document ID. Get this from a previous talonic_extract or talonic_search response.

Implementation Reference

  • The main handler function `handleGetDocument` that calls `talonic.documents.get(args.document_id)` to fetch document metadata from the Talonic API and returns the result as JSON.
    export async function handleGetDocument(
      talonic: Talonic,
      args: { document_id: string },
    ): Promise<ToolResult> {
      try {
        const result = await talonic.documents.get(args.document_id)
        return jsonOk(result)
      } catch (err) {
        return toolError(err)
      }
    }
  • The input schema defining the `document_id` parameter — a required string (min length 1) described as the Talonic document ID from a previous extract or search.
    const inputSchema = {
      document_id: z
        .string()
        .min(1)
        .describe(
          "The Talonic document ID. Get this from a previous talonic_extract or talonic_search response.",
        ),
    }
  • The `registerGetDocument` function that registers the tool named `talonic_get_document` on the MCP server with its title, description, input schema, and handler callback.
    export function registerGetDocument(server: McpServer, talonic: Talonic): void {
      server.registerTool(
        "talonic_get_document",
        {
          title: "Get Talonic Document",
          description: DESCRIPTION,
          inputSchema,
        },
        async (args) => handleGetDocument(talonic, args),
      )
    }
  • The call site in `createServer` where `registerGetDocument` is invoked to register the tool on the MCP server.
      registerGetDocument(server, talonic)
      registerSearch(server, talonic)
      registerFilter(server, talonic)
      registerToMarkdown(server, talonic)
      registerExtract(server, talonic)
    
      // Resource registrations.
      registerSchemasResource(server, talonic)
    
      return server
    }
  • Helper functions `jsonOk` and `toolError` used by the handler to format successful and error responses for the MCP protocol.
    export function jsonOk(value: unknown): ToolSuccessResult {
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(value, null, 2),
          },
        ],
      }
    }
    
    /**
     * Convert any thrown error into a tool error result with stable
     * formatting. Talonic API errors include `code`, `status`, and
     * `request_id` so the user (or another tool call) can act on them.
     *
     * @internal
     */
    export function toolError(err: unknown): ToolErrorResult {
      if (err instanceof TalonicError) {
        const lines = [
          `Talonic API error: ${err.message}`,
          `code: ${err.code}`,
          `status: ${err.status}`,
        ]
        if (err.requestId) lines.push(`request_id: ${err.requestId}`)
        return {
          isError: true,
          content: [{ type: "text", text: lines.join("\n") }],
        }
      }
      return {
        isError: true,
        content: [
          {
            type: "text",
            text: `Unexpected error: ${err instanceof Error ? err.message : String(err)}`,
          },
        ],
      }
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears full responsibility. It discloses that the tool returns metadata (read operation) and implies no destructive effects. It could mention whether authentication is required or if there are any constraints, but for a simple fetch, this is mostly sufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded with the purpose, followed by a bulleted list for usage guidelines. Every sentence adds value, and there is no unnecessary verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has only one required parameter, no output schema, and no annotations, the description provides comprehensive context: what it does, what it returns, when to use it, and when not to. It is fully sufficient for an AI agent to invoke correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and the schema already describes document_id as coming from previous calls. The tool description adds context by repeating that information and explicitly telling the user where to obtain the ID, which adds value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool fetches full metadata for a single document and lists exactly what is returned (id, filename, page count, etc.). It distinguishes itself from siblings like talonic_to_markdown and talonic_extract by specifying what this tool does versus those.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes explicit 'USE WHEN' and 'DO NOT USE WHEN' sections, providing clear guidance on when to use this tool, when not to, and which alternatives to choose instead. This is excellent for helping an agent decide.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/talonicdev/talonic-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server