Skip to main content
Glama

docs_rs_readme

Retrieve README content for Rust crates from docs.rs to understand crate functionality and usage documentation.

Instructions

Get README/overview content of the specified crate

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
crate_nameYesName of the crate to get README for
versionNoSpecific version (optional, defaults to latest)

Implementation Reference

  • The main handler function for the 'docs_rs_readme' tool. It fetches the documentation page from docs.rs for the specified crate (and optional version), extracts the main content using Cheerio, converts it to Markdown using Turndown, and returns it formatted as tool content.
    private async getReadMe(args: any) { const { crate_name, version = "latest" } = args; try { const url = `https://docs.rs/${crate_name}/${version}/${crate_name}/index.html`; const response = await axios.get<string>(url); const $ = cheerio.load(response.data); const mainContent = $(".rustdoc .docblock").first(); if (mainContent.length === 0) { const alternativeContent = $(".rustdoc-main .item-decl").first(); if (alternativeContent.length === 0) { return { content: [ { type: "text", text: `# ${crate_name} Documentation\n\nNo documentation content found at ${url}`, }, ], }; } } const htmlContent = mainContent.html() || ""; const markdownContent = turndownService.turndown(htmlContent); return { content: [ { type: "text", text: `# ${crate_name} Documentation\n\n${markdownContent}`, }, ], }; } catch (error) { throw new Error(`Failed to get README for ${crate_name}: ${error}`); } }
  • Input schema definition for the 'docs_rs_readme' tool, specifying required 'crate_name' and optional 'version' parameters.
    inputSchema: { type: "object", properties: { crate_name: { type: "string", description: "Name of the crate to get README for", }, version: { type: "string", description: "Specific version (optional, defaults to latest)", }, }, required: ["crate_name"], },
  • src/index.ts:72-89 (registration)
    Tool registration in the ListTools response, including name, description, and input schema.
    { name: "docs_rs_readme", description: "Get README/overview content of the specified crate", inputSchema: { type: "object", properties: { crate_name: { type: "string", description: "Name of the crate to get README for", }, version: { type: "string", description: "Specific version (optional, defaults to latest)", }, }, required: ["crate_name"], }, },
  • src/index.ts:151-152 (registration)
    Handler dispatch/registration in the CallTool switch statement, mapping the tool name to the getReadMe method.
    case "docs_rs_readme": return await this.getReadMe(request.params.arguments);

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/nuskey8/docs-rs-mcp'

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