Skip to main content
Glama
by wlmwwx

parallel_search_web

Conduct multiple web searches simultaneously to gather diverse perspectives and comprehensive topic insights. Ideal for exploring various search angles efficiently with structured query configurations.

Instructions

Run multiple web searches in parallel for comprehensive topic coverage and diverse perspectives. For best results, provide multiple search queries that explore different aspects of your topic. You can use expand_query to help generate diverse queries, or create them yourself. 💡 Use this when you need to gather information from multiple search angles at once for efficiency.

Input Schema

NameRequiredDescriptionDefault
searchesYesArray of search configurations to execute in parallel (maximum 5 searches for optimal performance)
timeoutNoTimeout in milliseconds for all searches

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "searches": { "description": "Array of search configurations to execute in parallel (maximum 5 searches for optimal performance)", "items": { "additionalProperties": false, "properties": { "gl": { "description": "Country code, e.g., 'dz' for Algeria", "type": "string" }, "hl": { "description": "Language code, e.g., 'zh-cn' for Simplified Chinese", "type": "string" }, "location": { "description": "Location for search results, e.g., 'London', 'New York', 'Tokyo'", "type": "string" }, "num": { "default": 30, "description": "Maximum number of search results to return, between 1-100", "type": "number" }, "query": { "description": "Search terms or keywords to find relevant web content", "type": "string" }, "tbs": { "description": "Time-based search parameter, e.g., 'qdr:h' for past hour", "type": "string" } }, "required": [ "query" ], "type": "object" }, "maxItems": 5, "type": "array" }, "timeout": { "default": 30000, "description": "Timeout in milliseconds for all searches", "type": "number" } }, "required": [ "searches" ], "type": "object" }

Implementation Reference

  • The core handler function for the parallel_search_web tool. It validates the bearer token, deduplicates search queries, creates a web search wrapper function, executes parallel searches using the shared utility, formats the results, and handles errors.
    async ({ searches, timeout }: { searches: SearchWebArgs[]; timeout: number }) => { try { const props = getProps(); const tokenError = checkBearerToken(props.bearerToken); if (tokenError) { return tokenError; } const uniqueSearches = searches.filter((search, index, self) => index === self.findIndex(s => s.query === search.query) ); // Use the common web search function const webSearchFunction = async (searchArgs: SearchWebArgs) => { return executeWebSearch(searchArgs, props.bearerToken); }; // Execute parallel searches using utility const results = await executeParallelSearches(uniqueSearches, webSearchFunction, { timeout }); return { content: formatParallelSearchResultsToContentItems(results), }; } catch (error) { return createErrorResponse(`Error: ${error instanceof Error ? error.message : String(error)}`); } },
  • Zod schema defining the input parameters for the parallel_search_web tool: an array of up to 5 search configurations (each with query, num, tbs, location, gl, hl) and an optional timeout.
    { searches: z.array(z.object({ query: z.string().describe("Search terms or keywords to find relevant web content"), num: z.number().default(30).describe("Maximum number of search results to return, between 1-100"), tbs: z.string().optional().describe("Time-based search parameter, e.g., 'qdr:h' for past hour"), location: z.string().optional().describe("Location for search results, e.g., 'London', 'New York', 'Tokyo'"), gl: z.string().optional().describe("Country code, e.g., 'dz' for Algeria"), hl: z.string().optional().describe("Language code, e.g., 'zh-cn' for Simplified Chinese") })).max(5).describe("Array of search configurations to execute in parallel (maximum 5 searches for optimal performance)"), timeout: z.number().default(30000).describe("Timeout in milliseconds for all searches") },
  • Registration of the parallel_search_web tool on the MCP server using server.tool(), including name, description, schema, and handler function.
    server.tool( "parallel_search_web", "Run multiple web searches in parallel for comprehensive topic coverage and diverse perspectives. For best results, provide multiple search queries that explore different aspects of your topic. You can use expand_query to help generate diverse queries, or create them yourself. 💡 Use this when you need to gather information from multiple search angles at once for efficiency.", { searches: z.array(z.object({ query: z.string().describe("Search terms or keywords to find relevant web content"), num: z.number().default(30).describe("Maximum number of search results to return, between 1-100"), tbs: z.string().optional().describe("Time-based search parameter, e.g., 'qdr:h' for past hour"), location: z.string().optional().describe("Location for search results, e.g., 'London', 'New York', 'Tokyo'"), gl: z.string().optional().describe("Country code, e.g., 'dz' for Algeria"), hl: z.string().optional().describe("Language code, e.g., 'zh-cn' for Simplified Chinese") })).max(5).describe("Array of search configurations to execute in parallel (maximum 5 searches for optimal performance)"), timeout: z.number().default(30000).describe("Timeout in milliseconds for all searches") }, async ({ searches, timeout }: { searches: SearchWebArgs[]; timeout: number }) => { try { const props = getProps(); const tokenError = checkBearerToken(props.bearerToken); if (tokenError) { return tokenError; } const uniqueSearches = searches.filter((search, index, self) => index === self.findIndex(s => s.query === search.query) ); // Use the common web search function const webSearchFunction = async (searchArgs: SearchWebArgs) => { return executeWebSearch(searchArgs, props.bearerToken); }; // Execute parallel searches using utility const results = await executeParallelSearches(uniqueSearches, webSearchFunction, { timeout }); return { content: formatParallelSearchResultsToContentItems(results), }; } catch (error) { return createErrorResponse(`Error: ${error instanceof Error ? error.message : String(error)}`); } }, );

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/wlmwwx/jina-mcp'

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