Skip to main content
Glama

list_registry_stats

Get an overview of available subgraph data including total count, domains, networks, and protocol types to understand what's accessible before searching.

Instructions

Get an overview of the subgraph registry: total count, available domains, networks, and protocol types with counts. Use this to understand what data is available before searching.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • JavaScript handler function that queries the SQLite database to get registry statistics: total subgraph count, domains with counts, networks with counts, and protocol types with counts. Returns a structured object with this aggregated data.
    function listRegistryStats() {
      const d = getDb();
      const domains = d
        .prepare("SELECT domain, COUNT(*) as count FROM subgraphs GROUP BY domain ORDER BY count DESC")
        .all();
      const networks = d
        .prepare("SELECT network, COUNT(*) as count FROM subgraphs WHERE network IS NOT NULL GROUP BY network ORDER BY count DESC")
        .all();
      const ptypes = d
        .prepare("SELECT protocol_type, COUNT(*) as count FROM subgraphs GROUP BY protocol_type ORDER BY count DESC")
        .all();
      const total = d.prepare("SELECT COUNT(*) as c FROM subgraphs").get().c;
    
      return {
        total_subgraphs: total,
        domains: Object.fromEntries(domains.map((r) => [r.domain, r.count])),
        networks: Object.fromEntries(networks.map((r) => [r.network, r.count])),
        protocol_types: Object.fromEntries(ptypes.map((r) => [r.protocol_type, r.count])),
      };
    }
  • Python handler function that queries the SQLite database for registry statistics. Returns JSON containing total_subgraphs count, domains dict, networks dict, and protocol_types dict with counts.
    def list_registry_stats() -> str:
        """Get registry overview: available domains, networks, protocol types, and counts."""
        conn = get_db()
    
        domains = conn.execute(
            "SELECT domain, COUNT(*) as count FROM subgraphs GROUP BY domain ORDER BY count DESC"
        ).fetchall()
        networks = conn.execute(
            "SELECT network, COUNT(*) as count FROM subgraphs WHERE network IS NOT NULL GROUP BY network ORDER BY count DESC"
        ).fetchall()
        ptypes = conn.execute(
            "SELECT protocol_type, COUNT(*) as count FROM subgraphs GROUP BY protocol_type ORDER BY count DESC"
        ).fetchall()
        total = conn.execute("SELECT COUNT(*) FROM subgraphs").fetchone()[0]
    
        conn.close()
    
        return json.dumps({
            "total_subgraphs": total,
            "domains": {r["domain"]: r["count"] for r in domains},
            "networks": {r["network"]: r["count"] for r in networks},
            "protocol_types": {r["protocol_type"]: r["count"] for r in ptypes},
        }, indent=2)
  • Tool schema definition in the TOOLS array. Defines list_registry_stats as a tool with empty input schema (no parameters required), with description explaining it returns available domains, networks, and protocol types.
      name: "list_registry_stats",
      description:
        "Get an overview of the subgraph registry: total count, available domains, networks, and protocol types with counts. Use this to understand what data is available before searching.",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • src/index.js:374-374 (registration)
    Registration of list_registry_stats in the HANDLERS object, mapping the tool name to the listRegistryStats handler function.
    list_registry_stats: listRegistryStats,
  • Registration of list_registry_stats in the TOOL_HANDLERS dictionary, using a lambda to call list_registry_stats() with no arguments.
    "list_registry_stats": lambda args: list_registry_stats(),

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/PaulieB14/subgraph-registry'

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