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
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pdf_id": "<pdf_id>"
},
"name": "list-pdf-metadata"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pdf_id | Yes | ID of the PDF to get metadata for |
Implementation Reference
- src/pdf_reader_mcp/server.py:487-505 (handler)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}", ) ] - src/pdf_reader_mcp/server.py:373-384 (registration)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( - src/pdf_reader_mcp/server.py:376-382 (schema)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"], },