Skip to main content
Glama
DumplingAI

Dumpling AI MCP Server

Official
by DumplingAI

doc-to-text

Convert documents from various formats to plain text for content processing and knowledge management. Extract text from URLs or base64 files with page range selection.

Instructions

Convert various document formats to plain text.

Input Schema

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

Implementation Reference

  • The handler function for the 'doc-to-text' tool. It proxies the request to the external Dumpling AI API at /api/v1/doc-to-text, authenticates with DUMPLING_API_KEY, and returns the API response as text content.
    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 input schema for the 'doc-to-text' tool, defining parameters: inputMethod (url or base64), file (URL or base64 content), and optional pages.
    { 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')"), },
  • src/index.ts:521-545 (registration)
    Registration of the 'doc-to-text' MCP tool using McpServer.tool(), specifying name, description, input schema, and handler function.
    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) }] }; } );

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