Skip to main content
Glama

get_pdf_metadata

Extract PDF metadata like title, author, and creation date without processing the entire document content.

Instructions

Quickly retrieve metadata from a PDF without reading the full content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'get_pdf_metadata' tool, registered via @mcp.tool(). It loads the PDF using PDFParser.loader, extracts metadata (page_count, title, author), converts to string, and returns it.
    @mcp.tool()
    async def get_pdf_metadata(source: str) -> str:
        """
        Quickly retrieve metadata from a PDF without reading the full content.
        """
        # We can reuse parser but limit the logical scope.
        # Actually parser loads the doc anyway.
        # For optimization, we might make a separate method in parser, but for now reuse.
    
        # We load it but generate result without full extraction
        doc = await parser.loader.load(source)
        try:
            meta = {
                "page_count": len(doc),
                "title": doc.metadata.get("title", ""),
                "author": doc.metadata.get("author", ""),
            }
            return str(meta)
        finally:
            doc.close()

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

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/rexfelix/readPDF_mcp_server'

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