Skip to main content
Glama

agent

Search, browse, and extract web data using natural language prompts. Specify data needs in plain English to gather structured information from multiple sources.

Instructions

Autonomous data gathering agent. Describe what you need in natural language and the agent will search, browse, and extract data. Costs variable credits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesNatural language description of data to gather
schemaNoJSON schema for structured output
max_creditsNoMax credits to spend (default: 10)
max_sourcesNoMax sources to consult (default: 5)

Implementation Reference

  • Handler function for 'agent' tool - constructs request body from input parameters (prompt, schema, max_credits, max_sources) and calls apiPost('/agent', body) to make the API request, then returns formatted JSON result
    async ({ prompt, schema, max_credits, max_sources }) => {
      const body: Record<string, unknown> = { prompt, max_credits, max_sources };
      if (schema) body.schema = schema;
      return jsonResult(await apiPost("/agent", body));
    }
  • Input schema definition for 'agent' tool using Zod - defines prompt (required string), schema (optional record), max_credits (optional number, default 10), max_sources (optional number, default 5)
    {
      prompt: z.string().describe("Natural language description of data to gather"),
      schema: z.record(z.unknown()).optional().describe("JSON schema for structured output"),
      max_credits: z.number().optional().default(10).describe("Max credits to spend (default: 10)"),
      max_sources: z.number().optional().default(5).describe("Max sources to consult (default: 5)"),
    },
  • src/index.ts:206-220 (registration)
    Tool registration for 'agent' - registers the tool with name, description, input schema, and handler function using server.tool()
    server.tool(
      "agent",
      "Autonomous data gathering agent. Describe what you need in natural language and the agent will search, browse, and extract data. Costs variable credits.",
      {
        prompt: z.string().describe("Natural language description of data to gather"),
        schema: z.record(z.unknown()).optional().describe("JSON schema for structured output"),
        max_credits: z.number().optional().default(10).describe("Max credits to spend (default: 10)"),
        max_sources: z.number().optional().default(5).describe("Max sources to consult (default: 5)"),
      },
      async ({ prompt, schema, max_credits, max_sources }) => {
        const body: Record<string, unknown> = { prompt, max_credits, max_sources };
        if (schema) body.schema = schema;
        return jsonResult(await apiPost("/agent", body));
      }
    );
  • apiPost helper function - makes HTTP POST requests to the SearchClaw API with timeout handling, error handling, and JSON response parsing
    async function apiPost(path: string, body: Record<string, unknown>) {
      const controller = new AbortController();
      const timeout = setTimeout(() => controller.abort(), 30000);
      try {
        const response = await fetch(`${API_BASE}${path}`, {
          method: "POST",
          headers: { ...headers, "Content-Type": "application/json" },
          body: JSON.stringify(body),
          signal: controller.signal,
        });
        if (!response.ok) {
          const text = await response.text();
          throw new Error(`SearchClaw API error ${response.status}: ${text}`);
        }
        return response.json();
      } finally {
        clearTimeout(timeout);
      }
    }
  • jsonResult helper function - formats API response data into MCP tool result format with text content type
    function jsonResult(data: unknown) {
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: autonomous operation, natural language interface, multi-method approach (search, browse, extract), and variable cost structure. However, it doesn't mention rate limits, authentication needs, error conditions, or what happens when credit limits are reached.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences that efficiently convey the core functionality and cost consideration. It's front-loaded with the main purpose. Every sentence earns its place, though it could potentially benefit from slightly more structure for complex tool behavior.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (autonomous agent with 4 parameters, no output schema, and no annotations), the description provides a reasonable overview but leaves gaps. It explains what the tool does but doesn't detail return values, error handling, or how it differs from the many sibling tools. For a sophisticated autonomous agent, more behavioral context would be helpful.

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 the schema already documents all parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema. The baseline of 3 is appropriate when the schema does the heavy lifting for parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as an 'autonomous data gathering agent' that will 'search, browse, and extract data' based on natural language input. It specifies the verb (gather data) and resource (data), but doesn't explicitly differentiate from siblings like 'search', 'browse', or 'extract' which suggests this may be a more comprehensive wrapper tool.

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

Usage Guidelines3/5

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

The description implies usage context by stating 'Describe what you need in natural language' and mentions cost considerations ('Costs variable credits'), but doesn't provide explicit guidance on when to use this versus the many sibling tools like 'search', 'browse', or 'extract'. No alternatives or exclusions are mentioned.

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/CSteenkamp/searchclaw-mcp'

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