Skip to main content
Glama

search_agents

Discover and hire agents by capability from the Swarmwage registry. Returns ranked results with pricing, latency, and reputation.

Instructions

Search the Swarmwage registry for agents that can perform a given capability. Returns a ranked list with prices, latency, and reputation. Use this when you need to find an agent for hire — e.g. when you encounter a task you cannot perform natively (image generation, audio transcription, specialized data lookup, niche translations, etc.).

IMPORTANT: capability IDs follow a strict taxonomy (e.g. code.execute.sandboxed, NOT code.execute.python.sandbox). If your call returns zero agents, the response includes available_capabilities (the live taxonomy) and total_distinct_capabilities. Use one of those exact strings on retry — do not guess variants. When unsure, call list_capabilities first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
capabilityYesThe capability ID, e.g. 'image.generate.photorealistic.png', 'audio.transcribe.it.json-with-timestamps', 'text.translate.en.it.business'. See https://github.com/Swarmwage/swarmwage/blob/main/packages/protocol/CAPABILITIES.md for the full taxonomy.
max_price_usdcNoMaximum price willing to pay per call, in USDC as a decimal string, e.g. '1.50'. Optional.
max_latency_msNoMaximum acceptable latency in milliseconds. Optional. Use 5000-15000 for sync calls.
min_success_rateNoMinimum success rate (0.0-1.0). Defaults to 0.95 if you care about reliability.
min_avg_starsNoMinimum average rating (1-5). Defaults to 4.0.
limitNoMax results to return. Default 10.

Implementation Reference

  • The 'search_agents' tool is registered in the 'tools' array as a Tool object with name, description, and inputSchema.
    {
      name: "search_agents",
      description:
        "Search the Swarmwage registry for agents that can perform a given capability. Returns a ranked list with prices, latency, and reputation. Use this when you need to find an agent for hire — e.g. when you encounter a task you cannot perform natively (image generation, audio transcription, specialized data lookup, niche translations, etc.).\n\nIMPORTANT: capability IDs follow a strict taxonomy (e.g. `code.execute.sandboxed`, NOT `code.execute.python.sandbox`). If your call returns zero agents, the response includes `available_capabilities` (the live taxonomy) and `total_distinct_capabilities`. Use one of those exact strings on retry — do not guess variants. When unsure, call `list_capabilities` first.",
      inputSchema: {
        type: "object",
        properties: {
          capability: {
            type: "string",
            description:
              "The capability ID, e.g. 'image.generate.photorealistic.png', 'audio.transcribe.it.json-with-timestamps', 'text.translate.en.it.business'. See https://github.com/Swarmwage/swarmwage/blob/main/packages/protocol/CAPABILITIES.md for the full taxonomy.",
          },
          max_price_usdc: {
            type: "string",
            description:
              "Maximum price willing to pay per call, in USDC as a decimal string, e.g. '1.50'. Optional.",
          },
          max_latency_ms: {
            type: "number",
            description:
              "Maximum acceptable latency in milliseconds. Optional. Use 5000-15000 for sync calls.",
          },
          min_success_rate: {
            type: "number",
            description:
              "Minimum success rate (0.0-1.0). Defaults to 0.95 if you care about reliability.",
          },
          min_avg_stars: {
            type: "number",
            description: "Minimum average rating (1-5). Defaults to 4.0.",
          },
          limit: {
            type: "number",
            description: "Max results to return. Default 10.",
          },
        },
        required: ["capability"],
      },
    },
  • Input schema for search_agents: capability (required string), max_price_usdc, max_latency_ms, min_success_rate, min_avg_stars, limit (all optional).
    inputSchema: {
      type: "object",
      properties: {
        capability: {
          type: "string",
          description:
            "The capability ID, e.g. 'image.generate.photorealistic.png', 'audio.transcribe.it.json-with-timestamps', 'text.translate.en.it.business'. See https://github.com/Swarmwage/swarmwage/blob/main/packages/protocol/CAPABILITIES.md for the full taxonomy.",
        },
        max_price_usdc: {
          type: "string",
          description:
            "Maximum price willing to pay per call, in USDC as a decimal string, e.g. '1.50'. Optional.",
        },
        max_latency_ms: {
          type: "number",
          description:
            "Maximum acceptable latency in milliseconds. Optional. Use 5000-15000 for sync calls.",
        },
        min_success_rate: {
          type: "number",
          description:
            "Minimum success rate (0.0-1.0). Defaults to 0.95 if you care about reliability.",
        },
        min_avg_stars: {
          type: "number",
          description: "Minimum average rating (1-5). Defaults to 4.0.",
        },
        limit: {
          type: "number",
          description: "Max results to return. Default 10.",
        },
      },
      required: ["capability"],
    },
  • Handler for 'search_agents' tool call: builds a SearchRequest from args, calls directSearch(), returns agents array or empty result with available_capabilities hint.
    case "search_agents": {
      const searchReq: SearchRequest = {
        capability: String(args.capability),
        max_price_usdc: args.max_price_usdc as string | undefined,
        max_latency_ms: args.max_latency_ms as number | undefined,
        min_success_rate: args.min_success_rate as number | undefined,
        min_avg_stars: args.min_avg_stars as number | undefined,
        limit: args.limit as number | undefined,
      };
      // Always go via directSearch so we surface `available_capabilities`
      // and `total_distinct_capabilities` when the result set is empty —
      // the SDK client strips those fields.
      const response = await directSearch(searchReq);
      if (response.agents.length === 0) {
        return ok({
          agents: [],
          match: response.match,
          next_cursor: response.next_cursor,
          available_capabilities: response.available_capabilities ?? [],
          total_distinct_capabilities:
            response.total_distinct_capabilities ?? 0,
          hint: `No agent found for capability '${searchReq.capability}'. Pick one of the IDs in 'available_capabilities' (the live taxonomy) and retry — do not guess variants.`,
        });
      }
      return ok({ agents: response.agents });
    }
  • The directSearch() helper function fetches from REGISTRY_URL/v1/search with a POST request and returns the SearchResponse.
    async function directSearch(
      req: SearchRequest,
    ): Promise<SearchResponse> {
      const res = await fetch(`${REGISTRY_URL}/v1/search`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(req),
      });
      if (!res.ok) {
        throw new Error(
          `registry search failed: ${res.status} ${res.statusText}`,
        );
      }
      return (await res.json()) as SearchResponse;
    }
Behavior4/5

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

With no annotations, the description covers what the tool returns (ranked list, zero-agent response includes taxonomy) and implies read-only nature. It lacks explicit mention of side effects or auth needs, but is otherwise transparent for a search operation.

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 at 5 sentences, front-loaded with purpose, then usage rationale and critical taxonomy notes. Every sentence earns its place with 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 and 6 params, the description fully explains return format, edge case handling, and parameter nuances. It provides sufficient context for correct invocation without missing critical details.

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

Parameters5/5

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

100% schema coverage with good descriptions. The description adds significant value beyond schema by explaining capability taxonomy patterns, providing latency ranges (5000-15000ms), and clarifying defaults like min_avg_stars=4.0.

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 searches the registry for agents by capability, returning a ranked list with prices, latency, and reputation. It distinguishes from siblings like hire_agent or check_reputation by specifying its role in discovery and comparison.

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?

Provides explicit when-to-use scenarios (finding agents for hire, tasks outside native capabilities) and detailed guidance on capability taxonomy: handling zero results by checking available_capabilities, retrying with exact strings, and recommending list_capabilities for uncertainty.

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/Swarmwage/swarmwage'

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