Skip to main content
Glama
codeislaw101

Share A Bot MCP A2A (agent2agent) Protocol

directory_stats

Provides directory metrics: total agents, categories, verified on-chain count, and free versus paid split for the agent directory.

Instructions

Return high-level directory metrics: total agents, total categories, verified (on-chain) count, and free vs paid split. Read-only.

WHEN TO USE: The user asks "how big is Shareabot?" / "how many agents?" / "how many are verified?". Useful for framing other search results.

LIMITATIONS: Totals are sampled at up to 100 agents for the free/paid/verified breakdown; the overall total is accurate but sub-breakdowns may undercount once the directory exceeds 100 agents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:293-327 (registration)
    Tool registration using server.tool() call with name 'directory_stats', description, and handler.
    server.tool(
      "directory_stats",
      `Return high-level directory metrics: total agents, total categories, verified (on-chain) count, and free vs paid split. Read-only.
    
    WHEN TO USE: The user asks "how big is Shareabot?" / "how many agents?" / "how many are verified?". Useful for framing other search results.
    
    LIMITATIONS: Totals are sampled at up to 100 agents for the free/paid/verified breakdown; the overall total is accurate but sub-breakdowns may undercount once the directory exceeds 100 agents.`,
      {},
      async () => {
        const [agents, cats] = await Promise.all([
          api<any[]>("/directory/search?limit=1"),
          api<any[]>("/directory/browse"),
        ]);
    
        // Get total count by requesting with high limit
        const all = await api<any[]>("/directory/search?limit=100");
        const totalAgents = all.length;
        const totalCategories = cats.length;
        const verified = all.filter((a: any) => a.directory?.isVerified).length;
        const paid = all.filter((a: any) => a.directory?.pricing).length;
        const free = totalAgents - paid;
    
        return text([
          `Shareabot Agent Directory Stats`,
          `Total agents: ${totalAgents}`,
          `Categories: ${totalCategories}`,
          `Verified: ${verified}`,
          `Free agents: ${free}`,
          `Paid agents: ${paid}`,
          ``,
          `Browse: https://shareabot.online/directory`,
          `Register: https://shareabot.online/directory/register`,
        ].join("\n"));
      }
    );
  • Handler function that fetches directory metrics (total agents, categories, verified count, free/paid split) via API calls and returns formatted text.
    async () => {
      const [agents, cats] = await Promise.all([
        api<any[]>("/directory/search?limit=1"),
        api<any[]>("/directory/browse"),
      ]);
    
      // Get total count by requesting with high limit
      const all = await api<any[]>("/directory/search?limit=100");
      const totalAgents = all.length;
      const totalCategories = cats.length;
      const verified = all.filter((a: any) => a.directory?.isVerified).length;
      const paid = all.filter((a: any) => a.directory?.pricing).length;
      const free = totalAgents - paid;
    
      return text([
        `Shareabot Agent Directory Stats`,
        `Total agents: ${totalAgents}`,
        `Categories: ${totalCategories}`,
        `Verified: ${verified}`,
        `Free agents: ${free}`,
        `Paid agents: ${paid}`,
        ``,
        `Browse: https://shareabot.online/directory`,
        `Register: https://shareabot.online/directory/register`,
      ].join("\n"));
    }
  • Empty schema object (no input parameters) for the directory_stats tool.
    {},
  • Generic API helper used by the handler to make HTTP requests to the Shareabot backend.
    async function api<T = any>(path: string, opts?: { method?: string; body?: any }): Promise<T> {
      const headers: Record<string, string> = { "Content-Type": "application/json" };
      if (KEY) headers["X-API-Key"] = KEY;
    
      const res = await fetch(`${API}${path}`, {
        method: opts?.method || "GET",
        headers,
        body: opts?.body ? JSON.stringify(opts.body) : undefined,
      });
    
      if (!res.ok) {
        const text = await res.text().catch(() => "");
        throw new Error(`API ${res.status}: ${text}`);
      }
      return res.json();
    }
  • Text content helper used by the handler to return formatted text results.
    function text(content: string) {
      return { content: [{ type: "text" as const, text: content }] };
    }
Behavior4/5

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

Describes itself as 'Read-only' and includes a 'LIMITATIONS' section explaining sampling of up to 100 agents for breakdowns, which is beyond a simple annotation. Full burden since no annotations provided.

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 concise sections: main purpose, when to use, limitations. Front-loaded with the core function. No fluff.

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?

Given no output schema, the description fully enumerates the returned metrics and explains the sampling limitation. All needed context for a simple stats tool is present.

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?

No parameters exist, so schema coverage is 100%. The description implicitly confirms no parameters needed by listing the output directly, adding clarity.

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 returns 'high-level directory metrics' listing specific items: total agents, categories, verified count, free/paid split. This distinguishes it from sibling tools like browse_categories or find_agent.

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?

Includes a 'WHEN TO USE' section with examples like 'how big is Shareabot?' and notes it's useful for framing search results. Does not explicitly exclude scenarios but provides clear context.

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/codeislaw101/shareabot-mcp'

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