Skip to main content
Glama
nuskey8

docs.rs MCP

by nuskey8

docs_rs_search_crates

Search for Rust crates on crates.io using keywords to find relevant packages for your project needs.

Instructions

Search for Rust crates by keywords on crates.io.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch keywords for finding relevant crates. Keywords should be in English.
per_pageNoNumber of results per page (default: 10, max: 100)
sortNoSort order: 'relevance', 'downloads', 'recent-downloads', 'recent-updates', 'new' (default: relevance)

Implementation Reference

  • The primary handler function that executes the tool logic: searches crates.io API with the given query, processes results into a formatted markdown response.
    private async searchCrates(args: any) {
        const { query, per_page = 10, sort = "relevance" } = args;
    
        try {
            const response = await axios.get<{ crates: any[] }>("https://crates.io/api/v1/crates", {
                params: {
                    q: query,
                    per_page: Math.min(per_page, 100),
                    sort,
                },
            });
    
            const crates = response.data.crates.map((crate: any) => ({
                name: crate.name,
                description: crate.description || "No description available",
                downloads: crate.downloads,
                version: crate.newest_version,
                documentation: crate.documentation,
            }));
    
            return {
                content: [
                    {
                        type: "text",
                        text: `# Crate Search Results for "${query}"\n\n${crates
                            .map(
                                (crate: CrateSearchResult) =>
                                    `## ${crate.name} (${crate.version})\n\n` +
                                    `**Description:** ${crate.description}\n\n` +
                                    `**Downloads:** ${crate.downloads.toLocaleString()}\n\n` +
                                    `**Documentation:** ${crate.documentation || "N/A"}\n\n---\n`
                            )
                            .join("\n")}`,
                    },
                ],
            };
        } catch (error) {
            throw new Error(`Failed to search crates: ${error}`);
        }
    }
  • Defines the input schema for the tool, specifying parameters like query, per_page, and sort.
        type: "object",
        properties: {
            query: {
                type: "string",
                description: "Search keywords for finding relevant crates. Keywords should be in English.",
            },
            per_page: {
                type: "number",
                description: "Number of results per page (default: 10, max: 100)",
            },
            sort: {
                type: "string",
                description: "Sort order: 'relevance', 'downloads', 'recent-downloads', 'recent-updates', 'new' (default: relevance)",
            },
        },
        required: ["query"],
    },
  • src/index.ts:50-71 (registration)
    Tool registration in the ListTools response, including name, description, and schema.
    {
        name: "docs_rs_search_crates",
        description: "Search for Rust crates by keywords on crates.io.",
        inputSchema: {
            type: "object",
            properties: {
                query: {
                    type: "string",
                    description: "Search keywords for finding relevant crates. Keywords should be in English.",
                },
                per_page: {
                    type: "number",
                    description: "Number of results per page (default: 10, max: 100)",
                },
                sort: {
                    type: "string",
                    description: "Sort order: 'relevance', 'downloads', 'recent-downloads', 'recent-updates', 'new' (default: relevance)",
                },
            },
            required: ["query"],
        },
    },
  • src/index.ts:149-150 (registration)
    Dispatches the tool call to the searchCrates handler in the CallToolRequestSchema switch.
    case "docs_rs_search_crates":
        return await this.searchCrates(request.params.arguments);
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool searches for crates but doesn't disclose behavioral traits such as rate limits, authentication needs, error handling, or what the response format looks like (e.g., pagination, result structure). This is a significant gap for a search tool with no annotation coverage.

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 with zero waste, clearly front-loading the purpose. It's appropriately sized for a straightforward search tool, making every word count.

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 moderate complexity (search with three parameters) and no output schema, the description is minimally adequate but incomplete. It covers the basic purpose but lacks details on behavior, output, or integration with siblings, leaving gaps that could hinder effective agent use.

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?

Schema description coverage is 100%, so the schema already documents all parameters (query, per_page, sort) with details like defaults and constraints. The description adds no additional meaning beyond what's in the schema, such as examples or usage tips, meeting the baseline for high schema coverage.

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 action ('Search for Rust crates') and the resource ('on crates.io'), with a specific verb+resource combination. It distinguishes from sibling tools like 'docs_rs_search_in_crate' by specifying the scope is crates rather than within a crate, but could be more explicit about this differentiation.

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

Usage Guidelines3/5

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

The description implies usage for finding crates by keywords, but lacks explicit guidance on when to use this tool versus alternatives like 'docs_rs_get_item' or 'docs_rs_search_in_crate'. No exclusions or prerequisites are mentioned, leaving usage context somewhat vague.

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