Skip to main content
Glama

PDF Reader MCP Server

by pablontiv
extract-metadata.ts1.14 kB
import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { ExtractMetadataParamsSchema } from '../types/mcp-types.js'; import { PDFMetadata } from '../types/pdf-types.js'; import { MetadataParser } from '../services/metadata-parser.js'; import { handleError } from '../utils/error-handling.js'; export const extractMetadataTool: Tool = { name: 'extract_pdf_metadata', description: 'Extract metadata and document information from PDF files', inputSchema: { type: 'object', properties: { file_path: { type: 'string', description: 'Path to the PDF file to extract metadata from' } }, required: ['file_path'] } }; export async function handleExtractMetadata(args: unknown): Promise<PDFMetadata> { try { const params = ExtractMetadataParamsSchema.parse(args); const parser = new MetadataParser(); return await parser.parseMetadata(params.file_path); } catch (error) { const mcpError = handleError(error, typeof args === 'object' && args !== null && 'file_path' in args ? String(args.file_path) : undefined); throw new Error(JSON.stringify(mcpError)); } }

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/pablontiv/pdf-reader-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server