Skip to main content
Glama
DumplingAI

Dumpling AI MCP Server

Official
by DumplingAI

extract-image

Extract structured data from images using a prompt to convert visual information into organized text or JSON format.

Instructions

Extract structured data from images based on a prompt.

Input Schema

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

Implementation Reference

  • The handler function that implements the tool logic by proxying requests to the external Dumpling AI API endpoint for extracting structured data from images.
    async ({ inputMethod, images, 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-image`, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: `Bearer ${apiKey}`,
        },
        body: JSON.stringify({
          inputMethod,
          image: images[0],
          prompt,
          jsonMode,
          requestSource: "mcp",
        }), // Assuming single image for simplicity
      });
      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 input schema defining parameters for the extract-image tool: inputMethod, images array, prompt, and optional jsonMode.
    {
      inputMethod: z.enum(["url", "base64"]).describe("Input method"),
      images: z
        .array(z.string())
        .describe("Array of URLs or base64-encoded images"),
      prompt: z.string().describe("Extraction prompt"),
      jsonMode: z.boolean().optional().describe("Return in JSON format"),
    },
  • src/index.ts:690-723 (registration)
    Registration of the 'extract-image' MCP tool using server.tool, including name, description, input schema, and handler.
    server.tool(
      "extract-image",
      "Extract structured data from images based on a prompt.",
      {
        inputMethod: z.enum(["url", "base64"]).describe("Input method"),
        images: z
          .array(z.string())
          .describe("Array of URLs or base64-encoded images"),
        prompt: z.string().describe("Extraction prompt"),
        jsonMode: z.boolean().optional().describe("Return in JSON format"),
      },
      async ({ inputMethod, images, 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-image`, {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
            Authorization: `Bearer ${apiKey}`,
          },
          body: JSON.stringify({
            inputMethod,
            image: images[0],
            prompt,
            jsonMode,
            requestSource: "mcp",
          }), // Assuming single image for simplicity
        });
        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. It states the action 'extract structured data' but doesn't disclose behavioral traits like rate limits, authentication needs, error handling, or what 'structured data' entails (e.g., format, size limits). This is a significant gap for a tool with no annotation coverage.

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. It's front-loaded with the core purpose and appropriately sized for the tool's complexity, earning its place without unnecessary elaboration.

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 no annotations and no output schema, the description is incomplete. It doesn't explain the return values (what 'structured data' means), error cases, or operational constraints. For a tool with 4 parameters and no structured behavioral hints, more context is needed to be fully helpful.

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 documents all parameters. The description adds no meaning beyond the schema—it doesn't explain how 'prompt' guides extraction or what 'structured data' looks like. Baseline 3 is appropriate as the schema handles parameter documentation adequately.

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 images', with the qualifier 'based on a prompt' adding specificity. It distinguishes from siblings like 'extract-audio' or 'extract-document' by focusing on images, though it doesn't explicitly contrast with 'extract' (which might handle other data types).

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 alternatives. It doesn't mention prerequisites, limitations, or compare it to other extraction tools (e.g., 'extract-document' for text from documents). The description implies usage for image-based extraction but lacks explicit context or exclusions.

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