Skip to main content
Glama
DumplingAI

Dumpling AI MCP Server

Official
by DumplingAI

convert-to-pdf

Transform various file formats into PDFs using URL or base64 input methods. Simplify document handling and ensure compatibility with Dumpling AI MCP Server tools.

Instructions

Convert various file formats to PDF.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesURL or base64-encoded file content
inputMethodYesInput method

Implementation Reference

  • The handler function for the 'convert-to-pdf' tool. It proxies the request to an external API endpoint, passing inputMethod and file, authenticates with DUMPLING_API_KEY, and returns the JSON response as text content.
    async ({ inputMethod, file }) => { 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/convert-to-pdf`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ inputMethod, file }), }); 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) }] }; }
  • Input schema using Zod for validating inputMethod (url or base64) and file (string: URL or base64 content).
    inputMethod: z.enum(["url", "base64"]).describe("Input method"), file: z.string().describe("URL or base64-encoded file content"), },
  • src/index.ts:548-571 (registration)
    The complete registration of the 'convert-to-pdf' tool on the MCP server, including name, description, input schema, and inline handler function.
    server.tool( "convert-to-pdf", "Convert various file formats to PDF.", { inputMethod: z.enum(["url", "base64"]).describe("Input method"), file: z.string().describe("URL or base64-encoded file content"), }, async ({ inputMethod, file }) => { 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/convert-to-pdf`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ inputMethod, file }), }); 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