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()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'quickly retrieve' which hints at performance, but doesn't cover critical aspects like error handling, permissions, rate limits, or what specific metadata is returned. This leaves significant gaps for a tool with an output schema but no annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that efficiently conveys the core purpose and key differentiator. It's front-loaded with the main action and avoids any unnecessary words, making it highly concise and effective.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which handles return values), no annotations, and low complexity, the description is minimally complete. It covers the basic purpose and hints at usage, but lacks details on behavior and parameters. This makes it adequate for a simple tool but with clear gaps in guidance and transparency.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, so the description must compensate. It doesn't add any details about the 'source' parameter beyond what the schema provides (e.g., format, examples, constraints). Since there's only one parameter and the description doesn't enhance its meaning, the baseline is 3, as it's adequate but doesn't add value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('retrieve') and resource ('metadata from a PDF'), and distinguishes it from the sibling tool 'read_pdf' by specifying 'without reading the full content'. However, it doesn't explicitly name the sibling tool for comparison, keeping it at a 4 rather than a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use this tool by contrasting it with reading full content, suggesting it's for quick metadata extraction. However, it doesn't provide explicit guidance on when to choose this over 'read_pdf' or any alternatives, nor does it mention prerequisites or exclusions, so it's only implied usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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