Skip to main content
Glama
pietermyb

mcp-pdf-reader

close-pdf

Use this tool to securely close an open PDF file by specifying its unique ID, ensuring proper resource management and system efficiency.

Instructions

Close an open PDF file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pdf_idYesID of the PDF to close

Implementation Reference

  • The handler function in handle_call_tool that executes the close-pdf tool: validates pdf_id, removes the PDF from global pdfs and pdf_paths dictionaries, notifies resource change, and returns confirmation message.
    elif name == "close-pdf": pdf_id = arguments.get("pdf_id") if not pdf_id or pdf_id not in pdfs: raise ValueError("Invalid PDF ID") path = pdf_paths[pdf_id] # Remove from storage del pdfs[pdf_id] del pdf_paths[pdf_id] # Notify clients that resources have changed await server.request_context.session.send_resource_list_changed() return [ types.TextContent( type="text", text=f"Closed PDF '{os.path.basename(path)}'", ) ]
  • The registration of the close-pdf tool in the list_tools handler, including name, description, and input schema requiring pdf_id.
    types.Tool( name="close-pdf", description="Close an open PDF file", inputSchema={ "type": "object", "properties": { "pdf_id": {"type": "string", "description": "ID of the PDF to close"}, }, "required": ["pdf_id"], }, ),
  • The JSON schema for close-pdf tool input, defining a required pdf_id string.
    inputSchema={ "type": "object", "properties": { "pdf_id": {"type": "string", "description": "ID of the PDF to close"}, }, "required": ["pdf_id"], },

Other Tools

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

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