Skip to main content
Glama

check_package_version

Retrieve the latest version of a package from npm or PyPI by specifying the package name and optional registry.

Instructions

Check the latest version of a package on npm or PyPI.

Args: package_name: The package name — e.g. "react", "express", "flask", "requests" registry: "npm" or "pypi" (defaults to "npm")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
package_nameYes
registryNonpm

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler for the 'check_package_version' tool. It is decorated with @mcp.tool() and delegates to _query_fact(registry, package_name, 'latest_version').
    @mcp.tool()
    async def check_package_version(package_name: str, registry: str = "npm") -> str:
        """Check the latest version of a package on npm or PyPI.
    
        Args:
            package_name: The package name — e.g. "react", "express", "flask", "requests"
            registry: "npm" or "pypi" (defaults to "npm")
        """
        return await _query_fact(registry, package_name, "latest_version")
  • The tool is registered via the @mcp.tool() decorator on the check_package_version function.
    @mcp.tool()
    async def check_package_version(package_name: str, registry: str = "npm") -> str:
  • The _query_fact helper function that check_package_version delegates to. It makes an HTTP request to the Grounded API and formats the result.
    async def _query_fact(source: str, entity: str, field: str) -> str:
        """Query the Grounded API and return a formatted result."""
        headers = {}
        if API_KEY:
            headers["X-API-Key"] = API_KEY
        async with httpx.AsyncClient() as client:
            resp = await client.get(
                f"{API_BASE}/v1/fact",
                params={"source": source, "entity": entity, "field": field},
                headers=headers,
                timeout=10.0,
            )
    
        if resp.status_code == 200:
            data = resp.json()
            return (
                f"Value: {data['value']}\n"
                f"Source: {data['source_url']}\n"
                f"Fetched at: {data['fetched_at']}\n"
                f"Hash: {data['raw_response_hash']}\n"
                f"Tier: {data['tier']} (TTL: {data['ttl_seconds']}s)"
            )
        elif resp.status_code == 404:
            detail = resp.json().get("detail", "Not found")
            return f"Not found: {detail}"
        else:
            return f"Error: HTTP {resp.status_code}"
Behavior2/5

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

No annotations are provided, so the description must carry the full burden. It only states the action without disclosing behavior like data source, rate limits, or error handling. This leaves transparency gaps.

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 extremely concise: a single sentence followed by a brief docstring. It front-loads the primary action and avoids any redundancy.

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 simplicity, the description covers the core inputs. However, it does not mention output format or potential errors, though an output schema exists. It is adequate but not thorough.

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

Parameters4/5

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

With 0% schema description coverage, the description compensates by providing examples for package_name and enumerating registry values ('npm' or 'pypi'). This adds meaningful context beyond the schema.

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

Purpose5/5

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

The description clearly states it checks the latest version of a package on npm or PyPI, specifying the verb 'check' and the resource 'latest version of a package'. It distinguishes from siblings like check_downloads (download counts) and check_service_status (service health).

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

Usage Guidelines4/5

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

The description implies usage context (checking package versions on npm/PyPI) but does not explicitly state when not to use or provide alternatives. The sibling tools are distinct, so no confusion arises.

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/nghizas/grounded-mcp'

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