Skip to main content
Glama
rplryan

x402-discovery-mcp

x402_browse

Read-onlyIdempotent

Browse registered x402 services by category and return the full catalog with quality signals. Free to use, no payment required.

Instructions

Browse all registered x402 services, optionally filtered by category. Free, no payment required. Returns full catalog with quality signals.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:158-169 (registration)
    The @mcp.tool decorator that registers x402_browse as an MCP tool with FastMCP, including its description and annotations.
    @mcp.tool(
        description=(
            "Browse all registered x402 services, optionally filtered by category. "
            "Free, no payment required. Returns full catalog with quality signals."
        ),
        annotations=ToolAnnotations(
            readOnlyHint=True,
            destructiveHint=False,
            idempotentHint=True,
            openWorldHint=True,
        ),
    )
  • The main handler function for x402_browse. Takes an optional category parameter, fetches the catalog from the discovery API, sorts by quality tier, and returns a formatted string of up to 20 services.
    def x402_browse(category: Optional[str] = None) -> str:
        """Browse the complete catalog of registered x402 services.
    
        Args:
            category: Optional category filter: research, data, compute, monitoring,
                      verification, routing, storage, translation, classification,
                      generation, extraction, summarization, enrichment, validation, other.
    
        Returns:
            Full service catalog with quality tiers, pricing, and health status.
        """
        params: dict = {}
        if category:
            params["category"] = category
    
        try:
            with httpx.Client(timeout=15.0) as client:
                resp = client.get(f"{DISCOVERY_API}/catalog", params=params)
                resp.raise_for_status()
                data = resp.json()
        except Exception as e:
            return f"Error fetching catalog: {e}"
    
        services = data.get("services", [])
        total = data.get("total", len(services))
    
        if not services:
            return f"No services found" + (f" in category '{category}'" if category else "") + "."
    
        quality_order = {"gold": 0, "silver": 1, "bronze": 2, "unverified": 3}
        services.sort(key=lambda s: quality_order.get(s.get("quality_tier", "unverified"), 3))
    
        lines = [
            f"x402 Service Catalog — {total} services registered",
            f"Source: {DISCOVERY_API}/catalog\n",
        ]
        for s in services[:20]:
            endpoint = s.get('endpoint_url', s.get('url', '?'))
            if endpoint.startswith('http://'):
                endpoint = endpoint.replace('http://', 'https://', 1)
            lines.append(
                f"• {s.get('name', '?')} [{s.get('quality_tier', 'unverified').upper()}] "
                f"${s.get('price_per_call', '?')}/call\n"
                f"  {s.get('description', '')}\n"
                f"  {endpoint}"
            )
    
        if total > 20:
            lines.append(f"\n... and {total - 20} more. Full catalog: {DISCOVERY_API}/catalog")
    
        lines.append(f"\ndiscovery_powered_by: x402-discovery-layer")
        return "\n".join(lines)
  • Reference to x402_browse in the server instructions/help text describing it as a free catalog browse by category.
    "• x402_browse   — free catalog browse by category\n"
  • Usage hint in x402_attest tool description referencing x402_browse to find valid service IDs.
    Use x402_browse to find valid service IDs.
  • Error message in x402_attest that directs users to use x402_browse to find valid service IDs.
    f"Browse services with x402_browse to find valid service IDs."
Behavior5/5

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

Adds 'Free, no payment required' and 'Returns full catalog with quality signals' beyond annotations (readOnly, destructive, idempotent, openWorld). Provides cost model and output characteristics.

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?

Three sentences: action, cost, output. Efficient and front-loaded with essential information. No wasted words.

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

Completeness5/5

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

With one optional parameter and an existing output schema, the description fully covers purpose, cost, and output nature, leaving no significant gaps.

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?

Single parameter 'category' has no schema description (0% coverage). Description clarifies it as optional filter, adding meaning beyond schema's minimal title.

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?

Description clearly states verb 'browse', resource 'registered x402 services', and optional filter by category. Distinguishes from sibling tools like x402_attest, x402_discover, etc.

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?

States 'Free, no payment required' as a usage condition. Implicitly context for browsing vs. other operations, but no explicit when-not or alternatives beyond tool names.

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/rplryan/x402-discovery-mcp'

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