Skip to main content
Glama
DumplingAI

Dumpling AI MCP Server

Official
by DumplingAI

extract-document

Extract structured data from documents using a prompt. Specify input method, files, and extraction criteria to process URLs or base64-encoded documents.

Instructions

Extract structured data from documents based on a prompt.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputMethodYesInput method
filesYesArray of URLs or base64-encoded documents
promptYesExtraction prompt
jsonModeNoReturn in JSON format

Implementation Reference

  • The handler function for the 'extract-document' tool. It proxies the request to the external Dumpling AI API endpoint /api/v1/extract-document, handles authentication with API key, and returns the response as MCP content.
        const apiKey = process.env.DUMPLING_API_KEY;
        if (!apiKey) throw new Error("DUMPLING_API_KEY not set");
        const response = await fetch(`${NWS_API_BASE}/api/v1/extract-document`, {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
            Authorization: `Bearer ${apiKey}`,
          },
          body: JSON.stringify({
            inputMethod,
            files,
            prompt,
            jsonMode,
            requestSource: "mcp",
          }),
        });
        if (!response.ok)
          throw new Error(`Failed: ${response.status} ${await response.text()}`);
        const data = await response.json();
        return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Zod schema defining the input parameters for the 'extract-document' tool: inputMethod (url or base64), files (array of strings), prompt (string), jsonMode (optional boolean).
      inputMethod: z.enum(["url", "base64"]).describe("Input method"),
      files: z
        .array(z.string())
        .describe("Array of URLs or base64-encoded documents"),
      prompt: z.string().describe("Extraction prompt"),
      jsonMode: z.boolean().optional().describe("Return in JSON format"),
    },
    async ({ inputMethod, files, prompt, jsonMode }) => {
  • src/index.ts:655-688 (registration)
    Registration of the 'extract-document' tool using McpServer.tool(), including name, description, input schema, and handler function.
      "extract-document",
      "Extract structured data from documents based on a prompt.",
      {
        inputMethod: z.enum(["url", "base64"]).describe("Input method"),
        files: z
          .array(z.string())
          .describe("Array of URLs or base64-encoded documents"),
        prompt: z.string().describe("Extraction prompt"),
        jsonMode: z.boolean().optional().describe("Return in JSON format"),
      },
      async ({ inputMethod, files, prompt, jsonMode }) => {
        const apiKey = process.env.DUMPLING_API_KEY;
        if (!apiKey) throw new Error("DUMPLING_API_KEY not set");
        const response = await fetch(`${NWS_API_BASE}/api/v1/extract-document`, {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
            Authorization: `Bearer ${apiKey}`,
          },
          body: JSON.stringify({
            inputMethod,
            files,
            prompt,
            jsonMode,
            requestSource: "mcp",
          }),
        });
        if (!response.ok)
          throw new Error(`Failed: ${response.status} ${await response.text()}`);
        const data = await response.json();
        return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
      }
    );
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. It mentions extraction based on a prompt, which implies AI/LLM processing, but doesn't disclose key traits: whether this is a read-only operation, potential costs or rate limits, error handling, or what happens with invalid inputs. For a tool with no annotations and complex behavior (AI-driven extraction), this is a significant gap in transparency.

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 that directly states the tool's function without unnecessary words. It's front-loaded with the core action ('extract structured data') and context ('from documents based on a prompt'), making it easy to parse. Every part of the sentence contributes essential information, with zero waste.

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 (AI-driven extraction from documents), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like permissions, rate limits, or error cases, and doesn't hint at the return format (though jsonMode parameter suggests JSON output). For a tool with 4 parameters and no structured safety hints, more context is needed to guide effective use.

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 all parameters (inputMethod, files, prompt, jsonMode) with basic descriptions. The description adds minimal value beyond the schema by implying that 'prompt' guides the extraction, but it doesn't explain parameter interactions (e.g., how inputMethod affects files format) or provide examples. Baseline 3 is appropriate as the schema does most of the work.

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 verb 'extract' and the resource 'structured data from documents', specifying the action and target. However, it doesn't differentiate from sibling tools like 'extract', 'extract-audio', 'extract-image', or 'extract-video', which all perform extraction but on different content types. The description is specific about what gets extracted (structured data) but doesn't clarify the distinction from other extraction tools.

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 alternatives. It doesn't mention when this extraction method is appropriate compared to other extraction tools (e.g., 'extract-audio' for audio, 'extract-image' for images) or general tools like 'extract'. There's no context about prerequisites, such as document formats supported, or exclusions, leaving the agent to guess based on tool names alone.

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

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/DumplingAI/mcp-server-dumplingai'

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