list_documents
Lists documents in your organization to retrieve existing document IDs by name, avoiding duplicate uploads.
Instructions
List documents in the organization. Use this to find an existing document ID by name instead of re-uploading.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max documents to return (default 25). | |
| offset | No |
Implementation Reference
- src/tools/list_documents.ts:9-15 (handler)The tool definition and handler for list_documents. The handler makes a GET request to /v1/documents with the input parameters.
export const listDocuments = defineTool({ name: "list_documents", description: "List documents in the organization. Use this to find an existing document ID by name instead of re-uploading.", inputSchema: Input, handler: async (input, { client }) => client.get("/v1/documents", input), }); - src/tools/list_documents.ts:4-7 (schema)Zod schema for input validation: optional limit (1-100, default 25) and optional offset.
const Input = z.object({ limit: z.number().int().min(1).max(100).optional().describe("Max documents to return (default 25)."), offset: z.number().int().min(0).optional(), }); - src/tools/index.ts:11-20 (registration)Registration of listDocuments in the tools array alongside all other tools.
export const tools: ToolDef[] = [ uploadDocument, getDocument, listDocuments, listTemplates, startVerification, getVerification, chatWithDocument, getUsage, ]; - src/tools/types.ts:17-24 (helper)The defineTool helper function used to create typed tool definitions, and the ToolDef interface that defines the structure.
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; }