Skip to main content
Glama
retrieve-doc.ts1.3 kB
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { extractRvtDocsText } from "../lib/extractDocs.ts"; import { toolDescriptions, toolNames, toolTitles, toolValidators, } from "../lib/toolsCommon.ts"; /** * Creates the extract documentation tool for the MCP server * @param server - The MCP server instance */ export function createRetrieveDoc(server: McpServer) { server.registerTool( toolNames.retrieveDoc, { title: toolTitles.retrieveDoc, description: toolDescriptions.retrieveDoc, inputSchema: { urlSlug: toolValidators.urlSlug, }, }, async ({ urlSlug }) => { const fullUrl = urlSlug.startsWith("/") ? `https://rvtdocs.com${urlSlug}` : `https://rvtdocs.com/${urlSlug}`; try { return { content: [{ type: "text", text: await extractRvtDocsText(fullUrl), }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [{ type: "text", text: `Error extracting documentation from ${fullUrl}: ${errorMessage}`, }], }; } }, ); }

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/kaitpw/Rvt_Docs_MCP'

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