Skip to main content
Glama

web_search

Search the web for information using customizable parameters like language, site restrictions, and search engines to retrieve relevant results for queries.

Instructions

Alias of web.search

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYes
maxNo
langNo
siteNo
enginesNo
kNo
limitNo

Implementation Reference

  • Core handler function for web search using multiple engines (DuckDuckGo HTML scraping and SearXNG JSON API), with deduplication and ranking.
    export async function webSearch(args: { q: string, max?: number, lang?: string, site?: string, engines?: string[] }): Promise<SearchResult[]> {
      const { q, max = 10, lang = CONFIG.langDefault, site, engines } = args;
      const order = (engines && engines.length ? engines : CONFIG.engineOrder).filter(Boolean);
      const tasks: Promise<SearchResult[]>[] = [];
      for (const eng of order) {
        if (eng === 'searxng') tasks.push(searchSearxng(q, lang, site, max));
        if (eng === 'duckduckgo') tasks.push(searchDuckDuckGo(q, lang, site, max));
      }
      const settled = await Promise.allSettled(tasks);
      const all: SearchResult[] = [];
      for (const s of settled) if (s.status === 'fulfilled') all.push(...s.value);
      if (!all.length) return [];
      return dedupeAndRank(all, max);
    }
  • Zod schema defining input parameters for the web_search tool, including aliases like k and limit for max.
    const webSearchShape = {
      q: z.string(),
      max: z.number().int().optional(),
      lang: z.string().optional(),
      site: z.string().optional(),
      engines: z.array(z.string()).optional(),
      // extra names model may invent
      k: z.number().int().optional(),
      limit: z.number().int().optional()
    };
  • src/server.ts:56-62 (registration)
    MCP server registration for the 'web_search' tool, which wraps the webSearch handler.
    server.tool('web_search', 'Alias of web.search',
      webSearchShape, OPEN,
      async ({ q, max, lang, site, engines, k, limit }) => {
        const res = await webSearch({ q, max: max ?? k ?? limit, lang, site, engines });
        return { content: [{ type: 'text', text: JSON.stringify(res) }] };
      }
    );
  • src/server.ts:49-55 (registration)
    Primary MCP server registration for the related 'web.search' tool (web_search is an alias).
    server.tool('web.search', 'Multi-engine web search (SearXNG + DuckDuckGo HTML).',
      webSearchShape, OPEN,
      async ({ q, max, lang, site, engines, k, limit }) => {
        const res = await webSearch({ q, max: max ?? k ?? limit, lang, site, engines });
        return { content: [{ type: 'text', text: JSON.stringify(res) }] };
      }
    );
  • Helper function to deduplicate search results by URL domain and assign ranks.
    function dedupeAndRank(all: SearchResult[], max: number): SearchResult[] {
      const seen = new Set<string>(); const out: SearchResult[] = [];
      for (const item of all) {
        const key = item.url.replace(/^https?:\/\//,'').replace(/^www\./,'').replace(/\/$/,'').toLowerCase();
        if (seen.has(key)) continue; seen.add(key); out.push(item);
        if (out.length >= max) break;
      }
      return out.map((it, i) => ({ ...it, rank: i+1 }));
    }
Behavior3/5

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

The annotation 'openWorldHint: true' indicates this tool can access external resources, but the description adds no behavioral context beyond this. It doesn't mention rate limits, authentication needs, result formats, or other operational characteristics. With the annotation providing basic safety information, the description adds minimal value but doesn't contradict the annotation.

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 extremely concise - a single three-word phrase. While this represents under-specification rather than ideal conciseness, it contains zero wasted words and is front-loaded with the only information provided. Every word technically earns its place, though more content would be beneficial.

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

Completeness1/5

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

For a tool with 7 parameters, 0% schema description coverage, no output schema, and only minimal annotations, the description is completely inadequate. It provides no information about what the tool does, how to use it, what parameters mean, or what results to expect. This leaves the agent with insufficient information to use the tool effectively.

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

Parameters1/5

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

With 7 parameters and 0% schema description coverage, the description provides absolutely no information about parameter meanings or usage. It doesn't explain what 'q', 'max', 'lang', 'site', 'engines', 'k', or 'limit' represent, leaving all parameters completely undocumented. This fails to compensate for the schema's lack of descriptions.

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

Purpose2/5

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

The description 'Alias of web.search' is tautological - it restates the tool name rather than explaining what it does. While it hints at a relationship with 'web.search', it doesn't specify the actual function (e.g., performing web searches). The purpose remains vague without stating the verb+resource combination.

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

Usage Guidelines2/5

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

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention sibling tools like 'web.fetch', 'web.read', or 'wiki.search' that might serve similar purposes. There's no context about appropriate use cases or distinctions from related 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/khanhs-234/tool4lm'

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