Skip to main content
Glama
Cognitive-Stack

Orion Vision MCP Server

extract-form-data

Extract structured data from forms such as receipts, invoices, and ID documents using Azure Form Recognizer in Orion Vision MCP Server. Input a document URL and specify the form type for accurate analysis.

Instructions

Extracts structured data from forms using Azure Form Recognizer

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formTypeYesType of form to analyze
urlYesURL of the form document to analyze

Implementation Reference

  • The core handler function that downloads the form from URL, maps formType to Azure model ID, analyzes it using Form Recognizer client, and returns JSON result.
    export const extractFormData = async (url: string, formType: 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);
    
        // Map form type to model ID
        const modelId = {
          receipt: "prebuilt-receipt",
          invoice: "prebuilt-invoice",
          idDocument: "prebuilt-idDocument",
          businessCard: "prebuilt-businessCard",
          custom: "prebuilt-document"
        }[formType];
    
        if (!modelId) {
          throw new Error(`Invalid form type: ${formType}`);
        }
    
        // Analyze the form
        const poller = await client.beginAnalyzeDocument(
          modelId,
          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(`Form data extraction failed: ${errorMessage}`);
      }
    }; 
  • Zod schema defining the input parameters: url (string URL) and formType (enum of supported form types).
    export const FormDataSchema = z.object({
      url: z.string().url().describe("URL of the form document to analyze"),
      formType: z.enum(["receipt", "invoice", "idDocument", "businessCard", "custom"]).describe("Type of form to analyze"),
    }); 
  • Tool configuration object in the tools array, specifying name, description, input schema, and execute function that delegates to the handler.
    {
      name: "extract-form-data",
      description: "Extracts structured data from forms using Azure Form Recognizer",
      parameters: FormDataSchema,
      execute: async (args) => {
        return await extractFormData(args.url, args.formType);
      },
    },
  • src/index.ts:17-20 (registration)
    Loop that registers all tools from the config array into the FastMCP server using addTool method.
    // Register all tools
    tools.forEach((tool) => {
      (server.addTool as Tool)(tool);
    });
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions the technology (Azure Form Recognizer), it doesn't describe what happens during extraction - whether it's a read-only operation, if it modifies data, authentication requirements, rate limits, or error handling. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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 extremely concise - a single sentence that directly states the tool's purpose without any unnecessary words. It's front-loaded with the core functionality and doesn't waste space on redundant information. Every word earns its place in this minimal description.

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 that there's no output schema and no annotations, the description should provide more context about what the tool returns and how it behaves. For a data extraction tool with 2 required parameters, the description is too minimal - it doesn't explain the extraction results format, error conditions, or practical usage examples. The completeness is inadequate for the tool's complexity.

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 thoroughly. The description doesn't add any meaningful parameter semantics beyond what's in the schema - it doesn't explain how 'formType' affects extraction results or provide examples of valid URLs. With complete schema coverage, the baseline score of 3 is appropriate.

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 tool's purpose: 'Extracts structured data from forms using Azure Form Recognizer'. It specifies the action (extracts), resource (structured data from forms), and technology (Azure Form Recognizer). However, it doesn't explicitly differentiate from its sibling 'analyze-document', which might have overlapping functionality.

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?

The description provides no guidance on when to use this tool versus its sibling 'analyze-document' or other alternatives. It doesn't mention prerequisites, limitations, or specific scenarios where this tool is preferred. The only implied context is that it works with forms, but no explicit usage instructions are given.

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