get_pdf_metadata
Retrieve PDF metadata such as 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-84 (handler)The handler function for the 'get_pdf_metadata' tool, registered via @mcp.tool() decorator. It loads the PDF document using PDFParser.loader.load() and extracts basic metadata (page_count, title, author) as a string.@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()