Skip to main content
Glama
DumplingAI

Dumpling AI MCP Server

Official
by DumplingAI

doc-to-text

Convert documents in various formats to plain text for easy text extraction and processing. Supports URLs or base64 file input and customizable page selection.

Instructions

Convert various document formats to plain text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesURL or base64-encoded file content
inputMethodYesInput method
pagesNoPages to process (e.g., '1, 2-5')

Implementation Reference

  • src/index.ts:521-545 (registration)
    Registration of the 'doc-to-text' MCP tool, including description, input schema, and handler function that proxies requests to an external API.
    server.tool( "doc-to-text", "Convert various document formats to plain text.", { inputMethod: z.enum(["url", "base64"]).describe("Input method"), file: z.string().describe("URL or base64-encoded file content"), pages: z.string().optional().describe("Pages to process (e.g., '1, 2-5')"), }, async ({ inputMethod, file, pages }) => { 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/doc-to-text`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ inputMethod, file, pages }), }); 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) }] }; } );
  • The handler function for 'doc-to-text' tool: checks for API key, sends POST request to external doc-to-text endpoint with parameters, handles errors, and returns JSON-stringified response wrapped in MCP content format.
    async ({ inputMethod, file, pages }) => { 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/doc-to-text`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ inputMethod, file, pages }), }); 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 inputs for the 'doc-to-text' tool: inputMethod (url or base64), required file (URL or base64), optional pages specifier.
    { inputMethod: z.enum(["url", "base64"]).describe("Input method"), file: z.string().describe("URL or base64-encoded file content"), pages: z.string().optional().describe("Pages to process (e.g., '1, 2-5')"), },

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