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
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes |
Implementation Reference
- src/server/main.py:64-83 (handler)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()