Skip to main content
Glama
pietermyb

mcp-pdf-reader

list-pdf-metadata

Extract and display metadata from PDF files, including title, author, and creation date, to analyze document properties.

Instructions

List metadata of an open PDF

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pdf_idYesID of the PDF to get metadata for

Implementation Reference

  • The handler function for the 'list-pdf-metadata' tool. It retrieves the PDF reader for the given pdf_id, extracts the metadata, formats it as text, and returns it wrapped in TextContent.
    elif name == "list-pdf-metadata": pdf_id = arguments.get("pdf_id") if not pdf_id or pdf_id not in pdfs: raise ValueError("Invalid PDF ID") reader = pdfs[pdf_id] metadata = reader.metadata if metadata: metadata_text = "\n".join([f"{k}: {v}" for k, v in metadata.items()]) else: metadata_text = "No metadata available" return [ types.TextContent( type="text", text=f"Metadata for '{os.path.basename(pdf_paths[pdf_id])}':\n\n{metadata_text}", ) ]
  • Registration of the 'list-pdf-metadata' tool in the list_tools handler, including name, description, and input schema requiring 'pdf_id'.
    types.Tool( name="list-pdf-metadata", description="List metadata of an open PDF", inputSchema={ "type": "object", "properties": { "pdf_id": {"type": "string", "description": "ID of the PDF to get metadata for"}, }, "required": ["pdf_id"], }, ), types.Tool(
  • JSON schema for the input parameters of the 'list-pdf-metadata' tool, specifying 'pdf_id' as required.
    inputSchema={ "type": "object", "properties": { "pdf_id": {"type": "string", "description": "ID of the PDF to get metadata for"}, }, "required": ["pdf_id"], },

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/pietermyb/mcp-pdf-reader'

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