Skip to main content
Glama
DumplingAI

Dumpling AI MCP Server

Official
by DumplingAI

merge-pdfs

Combine multiple PDF files into one document using URLs or base64 data. Add metadata, ensure PDF/A or PDF/UA compliance, and streamline document management.

Instructions

Combine multiple PDF files into a single document.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesYesArray of URLs or base64-encoded PDFs
inputMethodYesInput method
metadataNoMetadata for merged PDF
pdfaNoPDF/A compliance
pdfuaNoPDF/UA compliance
requestSourceNoRequest source

Implementation Reference

  • src/index.ts:574-619 (registration)
    Registration of the 'merge-pdfs' tool using server.tool, including inline schema definition and handler function that proxies requests to an external API.
    server.tool( "merge-pdfs", "Combine multiple PDF files into a single document.", { inputMethod: z.enum(["url", "base64"]).describe("Input method"), files: z.array(z.string()).describe("Array of URLs or base64-encoded PDFs"), metadata: z .object({ Title: z.string().optional(), Author: z.string().optional(), Subject: z.string().optional(), Keywords: z.string().optional(), }) .optional() .describe("Metadata for merged PDF"), pdfa: z .enum(["PDF/A-1b", "PDF/A-2b", "PDF/A-3b"]) .optional() .describe("PDF/A compliance"), pdfua: z.boolean().optional().describe("PDF/UA compliance"), requestSource: z.string().optional().describe("Request source"), }, async ({ inputMethod, files, metadata, pdfa, pdfua, requestSource }) => { 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/merge-pdfs`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ inputMethod, files, metadata, pdfa, pdfua, requestSource, }), }); 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) }] }; } );
  • Handler function for 'merge-pdfs' tool: checks API key, sends POST request to external merge-pdfs endpoint with input parameters, handles errors, and returns JSON response as text content.
    async ({ inputMethod, files, metadata, pdfa, pdfua, requestSource }) => { 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/merge-pdfs`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ inputMethod, files, metadata, pdfa, pdfua, requestSource, }), }); 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 for input validation of the 'merge-pdfs' tool, defining parameters like inputMethod, files array, optional metadata object, PDF/A and PDF/UA options, and requestSource.
    { inputMethod: z.enum(["url", "base64"]).describe("Input method"), files: z.array(z.string()).describe("Array of URLs or base64-encoded PDFs"), metadata: z .object({ Title: z.string().optional(), Author: z.string().optional(), Subject: z.string().optional(), Keywords: z.string().optional(), }) .optional() .describe("Metadata for merged PDF"), pdfa: z .enum(["PDF/A-1b", "PDF/A-2b", "PDF/A-3b"]) .optional() .describe("PDF/A compliance"), pdfua: z.boolean().optional().describe("PDF/UA compliance"), requestSource: z.string().optional().describe("Request source"), },

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