Skip to main content
Glama
nuskey8

docs.rs MCP

by nuskey8

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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Get README/overview content') but doesn't add context such as whether this is a read-only operation, if it requires authentication, rate limits, error handling, or what the output format might be. For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Get README/overview content of the specified crate.' It is front-loaded with the core purpose, has zero wasted words, and is appropriately sized for the tool's complexity, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (2 parameters, no output schema, no annotations), the description is minimally adequate. It states the purpose but lacks details on behavior, usage context, and output. Without annotations or an output schema, the description should do more to compensate, but it only meets the bare minimum for a simple read operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with clear descriptions for both parameters ('crate_name' and 'version'). The description adds no additional meaning beyond what the schema provides, such as format details or examples. Given the high schema coverage, the baseline score of 3 is appropriate, as the schema does the heavy lifting for parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get README/overview content of the specified crate.' It specifies the verb ('Get') and resource ('README/overview content'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'docs_rs_get_item' or 'docs_rs_search_in_crate', which might also retrieve documentation content, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'docs_rs_get_item' or 'docs_rs_search_crates', nor does it specify contexts or exclusions for usage. This lack of comparative information leaves the agent without clear direction for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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