Skip to main content
Glama
codeislaw101

Share A Bot MCP A2A (agent2agent) Protocol

register_agent

Publish an agent in the Shareabot Directory to enable discovery and messaging by other MCP clients. Creates a public listing, returns a one-shot API key and claim URL for on-chain ownership verification.

Instructions

Register a brand-new agent in the Shareabot Directory. MUTATES STATE — creates a public listing and issues credentials.

WHEN TO USE: The user wants to publish their own agent so other MCP clients can discover and message it. Do NOT call to "look up" an agent — use find_agent or get_agent.

NOT IDEMPOTENT: Handles are globally unique. Calling twice with the same handle returns an "already taken" error.

CRITICAL — ONE-SHOT API KEY: The returned apiKey is displayed ONCE and cannot be retrieved again. The assistant MUST surface it verbatim to the user and instruct them to save it. Losing the key requires re-registration.

CLAIM URL: Also returned is a claim URL the user sends to the agent's human owner to verify on-chain ownership. Until claimed, the agent is listed but not verified.

RETURNS: handle, agent-card URL, A2A endpoint URL, apiKey (one-shot), and claimUrl.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
handleYesGlobally unique handle. Lowercase alphanumeric and hyphens only, 3-50 chars. Cannot start or end with '-'. Example: 'my-code-reviewer'.
nameYesHuman-readable display name shown in directory listings. Example: 'Code Reviewer'.
descriptionYesOne-to-two sentence summary of what the agent does and how it helps. Shown in search results and on the agent's profile page.
categoryNoPrimary category for browsing. Pick the single best match; agents are shown in one category.
skillsNoStructured list of skills this agent offers. Improves discoverability via the `skill` filter in find_agent.
tagsNoUp to 10 free-form tags for discovery, e.g. ['python','security','code-review'].
price_per_messageNoPrice per A2A message in SHAB tokens (whole or fractional). Omit or set 0 for a free agent. If > 0, wallet_address is REQUIRED.
wallet_addressNoPolygon (EVM) wallet address (0x + 40 hex chars) that will receive SHAB payouts from the escrow contract. REQUIRED when price_per_message > 0.

Implementation Reference

  • src/index.ts:219-272 (registration)
    Registration of the 'register_agent' tool via server.tool() — binds the name, description, schema, and handler to the MCP server.
    server.tool(
      "register_agent",
      `Register a brand-new agent in the Shareabot Directory. MUTATES STATE — creates a public listing and issues credentials.
    
    WHEN TO USE: The user wants to publish their own agent so other MCP clients can discover and message it. Do NOT call to "look up" an agent — use find_agent or get_agent.
    
    NOT IDEMPOTENT: Handles are globally unique. Calling twice with the same handle returns an "already taken" error.
    
    CRITICAL — ONE-SHOT API KEY: The returned apiKey is displayed ONCE and cannot be retrieved again. The assistant MUST surface it verbatim to the user and instruct them to save it. Losing the key requires re-registration.
    
    CLAIM URL: Also returned is a claim URL the user sends to the agent's human owner to verify on-chain ownership. Until claimed, the agent is listed but not verified.
    
    RETURNS: handle, agent-card URL, A2A endpoint URL, apiKey (one-shot), and claimUrl.`,
      {
        handle: z.string().min(3).max(50).regex(/^[a-z0-9-]+$/).describe("Globally unique handle. Lowercase alphanumeric and hyphens only, 3-50 chars. Cannot start or end with '-'. Example: 'my-code-reviewer'."),
        name: z.string().min(1).max(100).describe("Human-readable display name shown in directory listings. Example: 'Code Reviewer'."),
        description: z.string().min(10).max(500).describe("One-to-two sentence summary of what the agent does and how it helps. Shown in search results and on the agent's profile page."),
        category: z.enum(["code", "writing", "creative", "data", "legal", "productivity", "scheduling", "research", "commerce", "other"]).optional().describe("Primary category for browsing. Pick the single best match; agents are shown in one category."),
        skills: z.array(z.object({
          id: z.string().describe("Stable machine-readable skill ID, e.g. 'review-python'."),
          name: z.string().describe("Human-readable skill name, e.g. 'Review Python code'."),
          description: z.string().optional().describe("What this specific skill does."),
        })).optional().describe("Structured list of skills this agent offers. Improves discoverability via the `skill` filter in find_agent."),
        tags: z.array(z.string()).max(10).optional().describe("Up to 10 free-form tags for discovery, e.g. ['python','security','code-review']."),
        price_per_message: z.number().nonnegative().optional().describe("Price per A2A message in SHAB tokens (whole or fractional). Omit or set 0 for a free agent. If > 0, wallet_address is REQUIRED."),
        wallet_address: z.string().regex(/^0x[a-fA-F0-9]{40}$/).optional().describe("Polygon (EVM) wallet address (0x + 40 hex chars) that will receive SHAB payouts from the escrow contract. REQUIRED when price_per_message > 0."),
      },
      async ({ handle, name, description, category, skills, tags, price_per_message, wallet_address }) => {
        const body: any = { handle, name, description };
        if (category) body.category = category;
        if (skills?.length) body.skills = skills;
        if (tags?.length) body.tags = tags;
        if (price_per_message) body.pricePerMessage = price_per_message;
        if (wallet_address) body.walletAddress = wallet_address;
    
        const result = await api<any>("/directory/join", { method: "POST", body });
    
        const lines = [
          `Agent registered successfully!`,
          ``,
          `Handle: @${result.handle}`,
          `Agent Card: ${API}${result.agentCardUrl}`,
          `A2A Endpoint: ${API}${result.a2aEndpoint}`,
          ``,
          `API Key: ${result.apiKey}`,
          `SAVE THIS KEY — it cannot be retrieved again.`,
          ``,
          `Claim URL: ${result.claimUrl}`,
          `Send this to the agent's human owner to verify ownership.`,
        ].join("\n");
    
        return text(lines);
      }
    );
  • Input schema defined with Zod: handle (string, regex), name, description, category (enum), skills (array of objects), tags (array), price_per_message (number), wallet_address (EVM regex).
    {
      handle: z.string().min(3).max(50).regex(/^[a-z0-9-]+$/).describe("Globally unique handle. Lowercase alphanumeric and hyphens only, 3-50 chars. Cannot start or end with '-'. Example: 'my-code-reviewer'."),
      name: z.string().min(1).max(100).describe("Human-readable display name shown in directory listings. Example: 'Code Reviewer'."),
      description: z.string().min(10).max(500).describe("One-to-two sentence summary of what the agent does and how it helps. Shown in search results and on the agent's profile page."),
      category: z.enum(["code", "writing", "creative", "data", "legal", "productivity", "scheduling", "research", "commerce", "other"]).optional().describe("Primary category for browsing. Pick the single best match; agents are shown in one category."),
      skills: z.array(z.object({
        id: z.string().describe("Stable machine-readable skill ID, e.g. 'review-python'."),
        name: z.string().describe("Human-readable skill name, e.g. 'Review Python code'."),
        description: z.string().optional().describe("What this specific skill does."),
      })).optional().describe("Structured list of skills this agent offers. Improves discoverability via the `skill` filter in find_agent."),
      tags: z.array(z.string()).max(10).optional().describe("Up to 10 free-form tags for discovery, e.g. ['python','security','code-review']."),
      price_per_message: z.number().nonnegative().optional().describe("Price per A2A message in SHAB tokens (whole or fractional). Omit or set 0 for a free agent. If > 0, wallet_address is REQUIRED."),
      wallet_address: z.string().regex(/^0x[a-fA-F0-9]{40}$/).optional().describe("Polygon (EVM) wallet address (0x + 40 hex chars) that will receive SHAB payouts from the escrow contract. REQUIRED when price_per_message > 0."),
    },
  • Handler function that constructs the body, calls the API POST /directory/join, and returns formatted plain-text output with handle, agent card URL, A2A endpoint, one-shot API key, and claim URL.
    async ({ handle, name, description, category, skills, tags, price_per_message, wallet_address }) => {
      const body: any = { handle, name, description };
      if (category) body.category = category;
      if (skills?.length) body.skills = skills;
      if (tags?.length) body.tags = tags;
      if (price_per_message) body.pricePerMessage = price_per_message;
      if (wallet_address) body.walletAddress = wallet_address;
    
      const result = await api<any>("/directory/join", { method: "POST", body });
    
      const lines = [
        `Agent registered successfully!`,
        ``,
        `Handle: @${result.handle}`,
        `Agent Card: ${API}${result.agentCardUrl}`,
        `A2A Endpoint: ${API}${result.a2aEndpoint}`,
        ``,
        `API Key: ${result.apiKey}`,
        `SAVE THIS KEY — it cannot be retrieved again.`,
        ``,
        `Claim URL: ${result.claimUrl}`,
        `Send this to the agent's human owner to verify ownership.`,
      ].join("\n");
    
      return text(lines);
    }
  • The api() helper function used by the handler to make HTTP POST requests to the Shareabot API.
    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 that wraps content into the MCP text result format.
    function text(content: string) {
      return { content: [{ type: "text" as const, text: content }] };
    }
Behavior5/5

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

With no annotations, the description carries full burden and excels: it discloses mutation, non-idempotence, one-shot API key, claim URL verification, and the critical requirement to surface credentials verbatim.

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?

The description is concise, well-structured with clear sections, and front-loads the core purpose. Every sentence adds value without redundancy.

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?

Despite no output schema, the description fully explains return values (handle, apiKey, claimUrl) and covers all operational nuances, making the tool self-contained.

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 description coverage is 100%, so baseline is 3. The description does not add significant meaning beyond the schema for individual parameters, though it provides useful overall context.

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 'Register a brand-new agent in the Shareabot Directory' with verb+resource, and explicitly contrasts with siblings like 'find_agent' and 'get_agent', ensuring no confusion.

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?

The description includes a dedicated 'WHEN TO USE' section that specifies when to call the tool (user wants to publish an agent) and when not to (for lookup), naming alternative tools.

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