Skip to main content
Glama

search_with_bing

Search the web using Bing to find information, answer questions, or gather data through the Hyperbrowser platform.

Instructions

Search the web using Bing. This tool allows you to search the web using bing.com

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe search query to submit to Bing
sessionOptionsNoOptions for the browser session. Avoid setting these if not mentioned explicitly
numResultsNoNumber of search results to return

Implementation Reference

  • The handler function `bingSearchTool` that implements the core logic for searching Bing by scraping the search results page and extracting structured data.
    export async function bingSearchTool(
      params: BingSearchToolParamSchemaType,
      extra: RequestHandlerExtra<ServerRequest, ServerNotification>
    ): Promise<CallToolResult> {
      const { query, numResults, sessionOptions } = params;
    
      let apiKey: string | undefined = undefined;
      if (extra.authInfo && extra.authInfo.extra?.isSSE) {
        apiKey = extra.authInfo.token;
      }
    
      try {
        const client = await getClient({ hbApiKey: apiKey });
    
        const encodedUrl = encodeURI(`https://www.bing.com/search?q=${query}`);
    
        const result = await client.extract.startAndWait({
          urls: [encodedUrl],
          sessionOptions: { ...sessionOptions, adblock: true, useProxy: false },
          prompt: `Extract the top ${numResults} search results from this page.`,
          schema: searchResultsSchema,
        });
    
        if (result.error) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: result.error,
              },
            ],
          };
        }
    
        const response: CallToolResult = {
          content: [
            {
              type: "text",
              text: JSON.stringify(result.data, null, 2),
            },
          ],
          isError: false,
        };
    
        return response;
      } catch (error) {
        return {
          content: [{ type: "text", text: `${error}` }],
          isError: true,
        };
      }
    }
  • Input parameter schema definition for the Bing search tool using Zod, including query, numResults, and sessionOptions.
    // Scrape Webpage
    
    export const bingSearchToolParamSchemaRaw = {
      query: z.string().describe("The search query to submit to Bing"),
      sessionOptions: sessionOptionsSchema,
      numResults: z
        .number()
        .int()
        .positive()
        .min(1)
        .max(50)
        .default(10)
        .describe("Number of search results to return"),
    };
    
    export const bingSearchToolParamSchema = z.object(bingSearchToolParamSchemaRaw);
    
    export type BingSearchToolParamSchemaType = z.infer<
      typeof bingSearchToolParamSchema
    >;
  • Registration of the 'search_with_bing' tool on the MCP server using server.tool with name, description, schema, and handler.
    server.tool(
      bingSearchToolName,
      bingSearchToolDescription,
      bingSearchToolParamSchemaRaw,
      bingSearchTool
    );
  • Internal schema used for extracting structured search results from the Bing page.
    const searchResultSchema = z.object({
      title: z.string().describe("The title of the search result"),
      url: z.string().describe("The URL of the search result"),
      snippet: z.string().describe("The snippet of the search result"),
    });
    
    const searchResultsSchema = z.object({
      allSearchResults: z.array(searchResultSchema),
    });
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions nothing about rate limits, authentication requirements, what format results are returned in, whether this performs live web searches or uses cached data, or any other behavioral characteristics. The description is minimal and adds almost no behavioral context beyond the obvious 'searches the web'.

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 extremely concise at just two sentences. However, the second sentence is redundant, merely restating the first with slightly different wording. While front-loaded with the core purpose, it could be more efficient by eliminating the repetition.

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

Completeness2/5

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

For a web search tool with no annotations and no output schema, the description is inadequate. It doesn't explain what format results are returned in, whether there are rate limits, authentication requirements, or how this differs from sibling scraping/crawling tools. The minimal description leaves significant gaps for the agent to navigate.

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 adds no parameter information beyond what's in the schema - it doesn't explain the relationship between parameters, provide usage examples, or clarify when to use advanced session options. With complete schema coverage, the baseline is 3.

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

Purpose3/5

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

The description states the tool 'Search[es] the web using Bing' which is a clear verb+resource combination. However, it doesn't distinguish this from sibling tools like 'scrape_webpage' or 'crawl_webpages' - it's unclear when to use this versus those alternatives. The second sentence is redundant, merely restating the first.

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 like 'scrape_webpage', 'crawl_webpages', or the various agent tools. The description doesn't mention any prerequisites, context requirements, or typical use cases. The agent must infer usage from the tool name alone.

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/hyperbrowserai/mcp'

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