read-pdf-metadata
Extract metadata from PDF files using URLs or base64-encoded content to analyze document properties and structure for content processing workflows.
Instructions
Extract metadata from PDF files.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inputMethod | Yes | Input method | |
| files | Yes | Array of URLs or base64-encoded PDFs | |
| requestSource | No | Request source |
Implementation Reference
- src/index.ts:802-816 (handler)Handler function that proxies the request to an external NWS API endpoint to read PDF metadata, using the provided API key and input parameters.async ({ inputMethod, files, 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/read-pdf-metadata`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ inputMethod, files, 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) }] };
- src/index.ts:797-801 (schema)Zod schema for input validation: inputMethod as 'url' or 'base64', array of files (URLs or base64), optional requestSource.{ inputMethod: z.enum(["url", "base64"]).describe("Input method"), files: z.array(z.string()).describe("Array of URLs or base64-encoded PDFs"), requestSource: z.string().optional().describe("Request source"), },
- src/index.ts:794-818 (registration)Registration of the 'read-pdf-metadata' tool on the MCP server, specifying name, description, input schema, and handler function.server.tool( "read-pdf-metadata", "Extract metadata from PDF files.", { inputMethod: z.enum(["url", "base64"]).describe("Input method"), files: z.array(z.string()).describe("Array of URLs or base64-encoded PDFs"), requestSource: z.string().optional().describe("Request source"), }, async ({ inputMethod, files, 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/read-pdf-metadata`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ inputMethod, files, 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) }] }; } );