get_document
Retrieve document status and metadata after upload. Use to poll until status is READY before proceeding with verification or chat.
Instructions
Get a document's status and metadata. Use this to poll after upload — call start_verification or chat_with_document only when status is READY. Status values: PROCESSING (embeddings running), READY (queryable), FAILED.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documentId | Yes | Document ID returned by upload_document. |
Implementation Reference
- src/tools/get_document.ts:8-14 (handler)The get_document tool definition with the handler that calls GET /v1/documents/:documentId
export const getDocument = defineTool({ name: "get_document", description: "Get a document's status and metadata. Use this to poll after upload — call start_verification or chat_with_document only when status is READY. Status values: PROCESSING (embeddings running), READY (queryable), FAILED.", inputSchema: Input, handler: async ({ documentId }, { client }) => client.get(`/v1/documents/${encodeURIComponent(documentId)}`), }); - src/tools/get_document.ts:4-6 (schema)Zod schema for the input: requires a documentId string
const Input = z.object({ documentId: z.string().describe("Document ID returned by upload_document."), }); - src/tools/index.ts:11-20 (registration)The getDocument tool is exported as part of the tools array in index.ts
export const tools: ToolDef[] = [ uploadDocument, getDocument, listDocuments, listTemplates, startVerification, getVerification, chatWithDocument, getUsage, ]; - src/tools/types.ts:17-24 (helper)The defineTool helper used to create the get_document tool definition
export function defineTool<Input extends z.ZodTypeAny>(t: { name: string; description: string; inputSchema: Input; handler: (input: z.infer<Input>, ctx: ToolContext) => Promise<unknown>; }): ToolDef { return t as unknown as ToolDef; }