get_document_links
Converts PDF or Tweede Kamer webpage URLs into clickable links, enabling easy access to documents. Integrate this step after retrieving document details for streamlined navigation.
Instructions
Converts document URLs into clickable links. This tool takes either a direct PDF link or a Tweede Kamer webpage link and returns them as properly formatted clickable links. Use this after get_document_details to make the URLs clickable.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pdfUrl | No | Direct link to the PDF document | |
| tkUrl | No | Link to the document page on Tweede Kamer website |
Implementation Reference
- src/index.ts:397-434 (handler)The complete inline implementation of the get_document_links MCP tool. This includes the tool registration via mcp.tool(), the input schema using Zod (optional pdfUrl and tkUrl parameters), and the handler function that generates markdown-formatted clickable links for PDF downloads and Tweede Kamer website views. No external dependencies or helper functions are used; the logic is self-contained./** Generate clickable document links */ mcp.tool( "get_document_links", "Converts document URLs into clickable markdown-formatted links. This tool takes either a direct PDF link or a Tweede Kamer webpage link and returns them as properly formatted clickable links.", { pdfUrl: z.string().optional().describe("Direct link to the PDF document"), tkUrl: z.string().optional().describe("Link to the document page on Tweede Kamer website") }, async ({ pdfUrl, tkUrl }) => { const links: string[] = []; if (pdfUrl) { links.push(`[Download PDF](${pdfUrl})`); } if (tkUrl) { // Remove any HTML entities from the URL const cleanTkUrl = tkUrl.replace(/&/g, '&'); links.push(`[View on Tweede Kamer website](${cleanTkUrl})`); } if (links.length === 0) { return { content: [{ type: "text", text: "No valid links provided" }] }; } return { content: [{ type: "text", text: links.join("\n") }] }; } );