Skip to main content
Glama
pablontiv
by pablontiv

validate_pdf

Check PDF file integrity and readability to ensure documents are not corrupted and can be properly processed.

Instructions

Validate PDF file integrity and readability

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the PDF file to validate

Implementation Reference

  • The primary handler function that implements the core logic of the 'validate_pdf' tool. It parses input arguments using Zod schema and calls PDFProcessor to perform the PDF validation.
    export async function handleValidatePDF(args: unknown): Promise<ValidationResult> { try { const params = ValidatePDFParamsSchema.parse(args); const processor = new PDFProcessor(); return await processor.validatePDF(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)); } }
  • The Tool object definition registering the 'validate_pdf' tool with MCP, including name, description, and inline input schema.
    export const validatePDFTool: Tool = { name: 'validate_pdf', description: 'Validate PDF file integrity and readability', inputSchema: { type: 'object', properties: { file_path: { type: 'string', description: 'Path to the PDF file to validate' } }, required: ['file_path'] } };
  • Zod schema for validating the input parameters of the 'validate_pdf' tool, used in the handler for runtime parsing.
    export const ValidatePDFParamsSchema = z.object({ file_path: filePathValidation });
  • src/index.ts:39-46 (registration)
    Registration of the 'validate_pdf' tool (via validatePDFTool) in the MCP server's listTools handler, making it discoverable.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ extractTextTool, extractMetadataTool, extractPagesTool, validatePDFTool, ], }));
  • src/index.ts:83-91 (registration)
    Wiring of the 'validate_pdf' tool handler (handleValidatePDF) in the MCP server's callTool request handler for execution.
    case 'validate_pdf': return { content: [ { type: 'text', text: JSON.stringify(await handleValidatePDF(args), 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/pablontiv/pdf-reader-mcp'

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