Skip to main content
Glama

lookup_fact

Look up package versions, download counts, license info, or service status from npm, PyPI, or statuspage by specifying source, entity, and field.

Instructions

Look up any fact tracked by Grounded.

Args: source: The fact source — "npm", "pypi", or "statuspage" entity: The entity name — e.g. "react", "flask", "github" field: The fact field — e.g. "latest_version", "license", "deprecated", "dep_count", "required_runtime", "weekly_downloads", or "status"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYes
entityYes
fieldYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The lookup_fact async function is the tool handler. It delegates to _query_fact to call the Grounded API with source, entity, and field parameters.
    async def lookup_fact(source: str, entity: str, field: str) -> str:
        """Look up any fact tracked by Grounded.
    
        Args:
            source: The fact source — "npm", "pypi", or "statuspage"
            entity: The entity name — e.g. "react", "flask", "github"
            field: The fact field — e.g. "latest_version", "license", "deprecated", "dep_count", "required_runtime", "weekly_downloads", or "status"
        """
        return await _query_fact(source, entity, field)
  • The @mcp.tool() decorator registers lookup_fact as a tool with the FastMCP server instance (named 'Grounded').
    @mcp.tool()
  • The _query_fact async helper function performs the actual HTTP GET request to the Grounded API and formats the response (value, source_url, fetched_at, hash, tier, TTL).
    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 provided, so description carries full burden. It only says 'look up', implying a read operation, but does not disclose behavioral traits like idempotency, rate limits, or authentication requirements. Lacks transparency for a tool with no annotations.

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?

Very concise, with a clear main sentence followed by structured argument list. No unnecessary words. Information is front-loaded.

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

Completeness4/5

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

For a simple lookup with 3 parameters and an output schema (though not detailed), the description is mostly complete. It covers the inputs well, but lacks any example output or confirmation of the return format. Given no annotations, it could be slightly more detailed.

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?

Schema coverage is 0%, but the description provides examples and enumerates possible values for each parameter (e.g., source: 'npm', 'pypi', 'statuspage'; field: 'latest_version', 'license', etc.), adding significant meaning beyond the bare schema titles. However, it does not cover all parameters exhaustively.

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 states it looks up facts tracked by Grounded, which is a specific verb-resource combination. However, it does not differentiate from siblings like check_downloads or check_package_version, which are more specialized. The purpose is clear but could be more explicit about scope.

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?

No guidance on when to use this tool versus alternatives. There is no mention of when-not to use it or any context for selection among siblings. The description only explains parameters.

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