Skip to main content
Glama
aserper

RTFD (Read The F*****g Docs)

by aserper

crates_metadata

Retrieve comprehensive metadata for Rust crates from crates.io, including version details, documentation links, repository URLs, and license information to support development decisions.

Instructions

        Get detailed metadata for a specific Rust crate from crates.io.

        USE THIS WHEN: You need comprehensive information about a specific Rust crate.

        RETURNS: Detailed crate metadata including version, URLs, downloads, and license.
        Does NOT include full documentation content.

        The response includes:
        - Crate name, version, description
        - Documentation URL (docs.rs) - can be passed to WebFetch for full API docs
        - Repository URL (usually GitHub) - can be used with GitHub provider
        - Homepage, license, categories, keywords
        - Download statistics, creation/update dates
        - Minimum Rust version required

        Args:
            crate: Crate name (e.g., "serde", "tokio", "actix-web")

        Returns:
            JSON with comprehensive crate metadata

        Example: crates_metadata("serde") → Returns metadata with docs.rs link and GitHub repo
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
crateYes

Implementation Reference

  • The main handler function for the 'crates_metadata' tool. It calls the helper to fetch metadata for the given crate and serializes the response.
    async def crates_metadata(crate: str) -> CallToolResult:
        """
        Get detailed metadata for a specific Rust crate from crates.io.
    
        USE THIS WHEN: You need comprehensive information about a specific Rust crate.
    
        RETURNS: Detailed crate metadata including version, URLs, downloads, and license.
        Does NOT include full documentation content.
    
        The response includes:
        - Crate name, version, description
        - Documentation URL (docs.rs) - can be passed to WebFetch for full API docs
        - Repository URL (usually GitHub) - can be used with GitHub provider
        - Homepage, license, categories, keywords
        - Download statistics, creation/update dates
        - Minimum Rust version required
    
        Args:
            crate: Crate name (e.g., "serde", "tokio", "actix-web")
    
        Returns:
            JSON with comprehensive crate metadata
    
        Example: crates_metadata("serde") → Returns metadata with docs.rs link and GitHub repo
        """
        result = await self._get_crate_metadata(crate)
        return serialize_response_with_meta(result)
  • Provider metadata where 'crates_metadata' is listed in tool_names, exposing it as a tool.
    def get_metadata(self) -> ProviderMetadata:
        return ProviderMetadata(
            name="crates",
            description="Rust crates.io package registry metadata",
            expose_as_tool=True,
            tool_names=["crates_metadata", "search_crates"],
            supports_library_search=True,
            required_env_vars=[],
            optional_env_vars=[],
        )
  • The get_tools method defines and registers the 'crates_metadata' function (along with search_crates) for MCP tool usage.
    def get_tools(self) -> dict[str, Callable]:
        """Return MCP tool functions."""
    
        async def search_crates(query: str, limit: int = 5) -> CallToolResult:
            """
            Search for Rust crates on crates.io by name or keywords.
    
            USE THIS WHEN: You need to find Rust packages/crates for a specific purpose or library.
    
            BEST FOR: Discovering which Rust crates exist for a topic or functionality.
            Returns multiple matching crates with names, versions, descriptions, download counts, and URLs.
    
            After finding a crate, use:
            - crates_metadata() to get detailed information about a specific crate
            - The documentation URL to read full docs (use WebFetch)
    
            Args:
                query: Search keywords (e.g., "http client", "web framework", "serde")
                limit: Maximum number of results (default 5, max 100)
    
            Returns:
                JSON with list of matching crates, total results, and metadata
    
            Example: search_crates("web framework") → Finds actix-web, rocket, axum, etc.
            """
            result = await self._search_crates(query, per_page=limit)
            return serialize_response_with_meta(result)
    
        async def crates_metadata(crate: str) -> CallToolResult:
            """
            Get detailed metadata for a specific Rust crate from crates.io.
    
            USE THIS WHEN: You need comprehensive information about a specific Rust crate.
    
            RETURNS: Detailed crate metadata including version, URLs, downloads, and license.
            Does NOT include full documentation content.
    
            The response includes:
            - Crate name, version, description
            - Documentation URL (docs.rs) - can be passed to WebFetch for full API docs
            - Repository URL (usually GitHub) - can be used with GitHub provider
            - Homepage, license, categories, keywords
            - Download statistics, creation/update dates
            - Minimum Rust version required
    
            Args:
                crate: Crate name (e.g., "serde", "tokio", "actix-web")
    
            Returns:
                JSON with comprehensive crate metadata
    
            Example: crates_metadata("serde") → Returns metadata with docs.rs link and GitHub repo
            """
            result = await self._get_crate_metadata(crate)
            return serialize_response_with_meta(result)
    
        return {"search_crates": search_crates, "crates_metadata": crates_metadata}
  • Helper function that performs the HTTP request to crates.io API to fetch detailed crate metadata, handles errors, and formats the response.
    async def _get_crate_metadata(self, crate_name: str) -> dict[str, Any]:
        """Get detailed metadata for a specific crate."""
        await self._rate_limit()
    
        try:
            async with await self._http_client() as client:
                response = await client.get(f"{self.BASE_URL}/crates/{crate_name}")
                response.raise_for_status()
                data = response.json()
    
            crate = data.get("crate", {})
            version = data.get("versions", [{}])[0] if data.get("versions") else {}
    
            return {
                "name": crate.get("name"),
                "version": crate.get("max_version"),
                "description": crate.get("description"),
                "repository": crate.get("repository"),
                "documentation": crate.get("documentation"),
                "homepage": crate.get("homepage"),
                "license": version.get("license"),
                "downloads": crate.get("downloads"),
                "recent_downloads": crate.get("recent_downloads"),
                "categories": crate.get("categories", []),
                "keywords": crate.get("keywords", []),
                "num_versions": crate.get("num_versions"),
                "created_at": crate.get("created_at"),
                "updated_at": crate.get("updated_at"),
                "rust_version": version.get("rust_version"),
                "url": f"https://crates.io/crates/{crate_name}",
            }
    
        except Exception as e:
            return {
                "name": crate_name,
                "error": str(e),
                "url": f"https://crates.io/crates/{crate_name}",
            }

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/aserper/RTFD'

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