Skip to main content
Glama
Cognitive-Stack

Orion Vision MCP Server

analyze-document

Extract structured data from documents using Azure Form Recognizer. Ideal for processing receipts, invoices, and IDs by analyzing the document URL with optional custom models.

Instructions

Analyzes a document using Azure Form Recognizer and returns structured data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelIdNoOptional model ID for custom models
urlYesURL of the document to analyze

Implementation Reference

  • The core handler function that downloads the document from the URL, analyzes it using Azure Form Recognizer client, and returns the JSON string result.
    export const analyzeDocument = async (url: string, modelId?: string): Promise<string> => {
      const config = getConfig();
      const client = new DocumentAnalysisClient(
        config.formRecognizerEndpoint,
        new AzureKeyCredential(config.formRecognizerKey)
      );
    
      try {
        // Download the document from URL
        const response = await axios.get(url, { responseType: "arraybuffer" });
        const buffer = Buffer.from(response.data);
    
        // Analyze the document
        const poller = await client.beginAnalyzeDocument(
          modelId || "prebuilt-document",
          buffer as FormRecognizerRequestBody
        );
    
        const result = await poller.pollUntilDone();
        return JSON.stringify(result, null, 2);
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        throw new Error(`Document analysis failed: ${errorMessage}`);
      }
    };
  • Zod schema defining the input parameters for the analyze-document tool: url (required string URL) and optional modelId.
    export const DocumentSchema = z.object({
      url: z.string().url().describe("URL of the document to analyze"),
      modelId: z.string().optional().describe("Optional model ID for custom models"),
    });
  • Registration of the 'analyze-document' tool in the tools array, specifying name, description, schema, and execute wrapper that calls the handler.
    {
      name: "analyze-document",
      description: "Analyzes a document using Azure Form Recognizer and returns structured data",
      parameters: DocumentSchema,
      execute: async (args) => {
        return await analyzeDocument(args.url, args.modelId);
      },
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the analysis method and output type but omits critical details like authentication needs, rate limits, processing time, error handling, or what 'structured data' entails, leaving significant gaps for a tool performing external API calls.

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 a single, efficient sentence with zero waste, clearly front-loading the core functionality. Every word contributes to understanding the tool's purpose without redundancy.

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

Completeness2/5

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

Given the complexity of document analysis with an external service, no annotations, and no output schema, the description is incomplete. It lacks details on behavioral traits, output format, error cases, and usage context, which are essential for effective tool invocation.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents both parameters (modelId and url). The description adds no additional parameter semantics beyond what the schema provides, such as examples or constraints, meeting the baseline for high coverage.

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

Purpose4/5

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

The description clearly states the action ('analyzes') and resource ('a document') using Azure Form Recognizer, with the outcome of returning structured data. It distinguishes from the sibling 'extract-form-data' by specifying the analysis method, though not explicitly contrasting their use cases.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus the sibling 'extract-form-data' or other alternatives. The description implies usage for document analysis but lacks context on prerequisites, constraints, or comparative scenarios.

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

Related 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/Cognitive-Stack/orion-vision-mcp'

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