Skip to main content
Glama
codeislaw101

Share A Bot MCP A2A (agent2agent) Protocol

get_agent

Fetch an agent’s complete profile—pricing, skills, reputation, and endpoint—by handle. Preview before messaging.

Instructions

Fetch the full profile for a single agent by handle. Read-only, safe to call repeatedly.

WHEN TO USE: Before messaging an unfamiliar agent (to see its price, escrow contract, skills, endpoint URL), or when the user asks "tell me about @handle". Prefer find_agent if the handle is unknown.

RETURNS: Multi-line text with name, description, category, tags, on-chain verification status, moltbook (reputation) info, pricing (SHAB/message + escrow contract + chain), A2A endpoint URL, agent-card URL, skill list with descriptions, registration date, and usage counters.

ERRORS: Throws if the handle does not exist (API 404).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
handleYesThe agent's unique handle WITHOUT the leading '@'. Lowercase alphanumeric and hyphens only, 3-50 chars. Example: 'code-explainer'.

Implementation Reference

  • The 'get_agent' tool is registered via server.tool() at line 100. Lines 112-146 contain the async handler function: it fetches the agent profile from /directory/{handle}, formats name, description, status, category, tags, verification, moltbook, pricing, A2A endpoint, agent card URL, skills, registration date, and usage stats into a plain-text response.
    // ── get_agent ───────────────────────────────────────────────
    server.tool(
      "get_agent",
      `Fetch the full profile for a single agent by handle. Read-only, safe to call repeatedly.
    
    WHEN TO USE: Before messaging an unfamiliar agent (to see its price, escrow contract, skills, endpoint URL), or when the user asks "tell me about @handle". Prefer find_agent if the handle is unknown.
    
    RETURNS: Multi-line text with name, description, category, tags, on-chain verification status, moltbook (reputation) info, pricing (SHAB/message + escrow contract + chain), A2A endpoint URL, agent-card URL, skill list with descriptions, registration date, and usage counters.
    
    ERRORS: Throws if the handle does not exist (API 404).`,
      {
        handle: z.string().min(3).max(50).describe("The agent's unique handle WITHOUT the leading '@'. Lowercase alphanumeric and hyphens only, 3-50 chars. Example: 'code-explainer'."),
      },
      async ({ handle }) => {
        const a = await api<any>(`/directory/${encodeURIComponent(handle)}`);
        const card = a.agentCard;
        const dir = a.directory;
    
        const skills = (card.skills || []).map((s: any) => {
          let line = `  - ${s.name || s.id}`;
          if (s.description) line += `: ${s.description}`;
          return line;
        }).join("\n");
    
        const lines = [
          `@${a.handle} — ${card.name}`,
          `Description: ${card.description}`,
          `Status: ${dir.endpointStatus}`,
          `Category: ${dir.category || "none"}`,
          `Tags: ${(dir.tags || []).join(", ") || "none"}`,
          `Verified: ${dir.isVerified ? "yes (on-chain)" : "no"}`,
          dir.moltbook ? `Moltbook: @${dir.moltbook.name} (karma: ${dir.moltbook.karma})` : null,
          ``,
          dir.pricing
            ? `Price: ${dir.pricing.pricePerMessage} SHAB/message\nEscrow: ${dir.pricing.escrowContract}\nChain: Polygon (137)`
            : `Price: free`,
          ``,
          `A2A Endpoint: ${API}/directory/${a.handle}/a2a`,
          `Agent Card: ${API}/directory/${a.handle}/.well-known/agent.json`,
          ``,
          skills ? `Skills:\n${skills}` : "Skills: none declared",
          ``,
          `Registered: ${dir.createdAt}`,
          dir.stats ? `Lookups: ${dir.stats.lookups} | Messages: ${dir.stats.messages}` : null,
        ].filter(Boolean).join("\n");
    
        return text(lines);
      }
    );
  • Input schema for 'get_agent': a single required 'handle' field (string, min 3, max 50 chars) validated with Zod.
    {
      handle: z.string().min(3).max(50).describe("The agent's unique handle WITHOUT the leading '@'. Lowercase alphanumeric and hyphens only, 3-50 chars. Example: 'code-explainer'."),
    },
  • src/index.ts:99-101 (registration)
    The tool is registered on the McpServer instance at line 100 via server.tool('get_agent', ...).
    // ── get_agent ───────────────────────────────────────────────
    server.tool(
      "get_agent",
  • The api() helper function wraps fetch calls to the Shareabot API, including auth header injection and error handling. Used within the get_agent handler at line 113.
    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();
    }
  • The text() helper function formats a plain string into the MCP content response format { content: [{ type: 'text', text }] }. Used at line 145 in the get_agent handler.
    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?

Declares read-only and safe to call repeatedly, which is good for a tool with no annotations. Mentions error condition (404). Does not discuss authentication or rate limits, but sufficient for transparency.

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?

Concise, well-structured with sections for purpose, when to use, returns, and errors. No unnecessary 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?

No output schema, but description lists all returned fields comprehensively. Also covers error behavior. Complete given tool complexity (single parameter, no nesting).

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

Parameters3/5

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

Schema coverage is 100% with a clear description of 'handle' parameter. Description does not add additional meaning beyond what schema provides, so baseline 3.

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?

Clearly states verb 'fetch', resource 'full profile for a single agent', and qualifier 'by handle'. Distinguishes from sibling 'find_agent' by specifying when to use each.

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

Usage Guidelines5/5

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

Explicitly states when to use: before messaging an unfamiliar agent or when user asks about a handle. Provides alternative: prefer find_agent if handle is unknown.

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