start_verification
Run compliance verification on a document by providing a documentId and either a templateId or custom criteria. Returns a jobId to poll for completion.
Instructions
Run compliance verification on a document against a template (or ad-hoc criteria). Returns a jobId; the job runs async — poll get_verification until status is 'completed'. Requires the API key to have the 'verify' scope.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documentId | Yes | Document to verify. Must be READY (see get_document). | |
| templateId | No | Template ID from list_templates. Either templateId or criteria is required. | |
| criteria | No | Ad-hoc criteria list, used when no template fits. Either templateId or criteria is required. |
Implementation Reference
- src/tools/start_verification.ts:21-26 (handler)The handler function that executes the start_verification tool logic — sends a POST to /v1/reports with the input payload via the API client.
export const startVerification = defineTool({ name: "start_verification", description: "Run compliance verification on a document against a template (or ad-hoc criteria). Returns a jobId; the job runs async — poll get_verification until status is 'completed'. Requires the API key to have the 'verify' scope.", inputSchema: Input, handler: async (input, { client }) => client.post("/v1/reports", input), - src/tools/start_verification.ts:4-19 (schema)Input schema defining documentId (string, required), templateId (number, optional), and criteria (array of {id, text}, optional) with a refinement requiring either templateId or a non-empty criteria array.
const Input = z .object({ documentId: z.string().describe("Document to verify. Must be READY (see get_document)."), templateId: z .number() .int() .optional() .describe("Template ID from list_templates. Either templateId or criteria is required."), criteria: z .array(z.object({ id: z.string(), text: z.string() })) .optional() .describe("Ad-hoc criteria list, used when no template fits. Either templateId or criteria is required."), }) .refine((v) => v.templateId !== undefined || (v.criteria && v.criteria.length > 0), { message: "Provide either templateId or a non-empty criteria array.", }); - src/tools/index.ts:6-20 (registration)Registration: startVerification is imported from './start_verification.js' and included in the tools array that exports all ToolDefs.
import { startVerification } from "./start_verification.js"; import { getVerification } from "./get_verification.js"; import { chatWithDocument } from "./chat_with_document.js"; import { getUsage } from "./get_usage.js"; export const tools: ToolDef[] = [ uploadDocument, getDocument, listDocuments, listTemplates, startVerification, getVerification, chatWithDocument, getUsage, ]; - src/tools/index.ts:16-20 (registration)startVerification is included in the exported tools array (position 5 out of 8 tools).
startVerification, getVerification, chatWithDocument, getUsage, ]; - src/tools/types.ts:17-24 (helper)The defineTool helper function used to create the tool definition with type-safe input schema and handler.
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; }