search-bulk-channels
Search for multiple channels simultaneously on social platforms like Farcaster, with options for query limits and pagination, enabling efficient data retrieval.
Instructions
Search for multiple channels on a social platform in parallel
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Cursor for pagination | |
| limit | No | Maximum number of results to return per query | |
| platform | Yes | The platform to search on (e.g., 'farcaster') | |
| queries | Yes | Array of search queries |
Implementation Reference
- src/mcp/tools/contentTools.ts:134-188 (handler)The handler function that implements the core logic of the 'search-bulk-channels' tool. It fetches the appropriate provider, validates support for bulk search, executes the search, formats the results from multiple queries, and returns structured content or handles errors.try { const provider = providerRegistry.getProviderForPlatform(platform); if (!provider) { throw new Error(`Provider for platform '${platform}' not found`); } // Check if the provider supports bulk channel search if (!provider.searchBulkChannels) { throw new Error(`Bulk channel search is not supported for platform '${platform}'`); } const results = await provider.searchBulkChannels(queries, { limit, cursor }); // Format the results let response = `Search Results for ${queries.length} queries:\n\n`; for (const [query, result] of Object.entries(results)) { response += `Results for "${query}":\n`; if (result.channels.length === 0) { response += 'No channels found.\n'; } else { const formattedChannels = result.channels.map(channel => `Channel: ${channel.name}\n` + `Description: ${channel.description || 'No description'}\n` + `Followers: ${channel.followerCount}\n` + `Created: ${channel.createdAt}\n` + `URL: ${channel.parentUrl || 'N/A'}\n` ).join('\n'); response += formattedChannels + '\n'; } if (result.nextCursor) { response += `Use the cursor "${result.nextCursor}" to fetch more results for this query.\n`; } response += '\n'; } return { content: [{ type: "text", text: response }], isError: false }; } catch (error) { console.error(`Error in search-bulk-channels tool:`, error); return { content: [{ type: "text", text: `Error performing bulk channel search on ${platform}: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
- Zod input schema defining the parameters for the 'search-bulk-channels' tool: platform (string), queries (array of strings), optional limit (number), and optional cursor (string).platform: z.string().describe("The platform to search on (e.g., 'farcaster')"), queries: z.array(z.string()).describe("Array of search queries"), limit: z.number().optional().describe("Maximum number of results to return per query"), cursor: z.string().optional().describe("Cursor for pagination") }, async ({ platform, queries, limit, cursor }) => {
- src/mcp/tools/contentTools.ts:124-189 (registration)The server.tool call that registers the 'search-bulk-channels' tool on the MCP server, including its name, description, input schema, and handler function.server.tool( "search-bulk-channels", "Search for multiple channels on a social platform in parallel", { platform: z.string().describe("The platform to search on (e.g., 'farcaster')"), queries: z.array(z.string()).describe("Array of search queries"), limit: z.number().optional().describe("Maximum number of results to return per query"), cursor: z.string().optional().describe("Cursor for pagination") }, async ({ platform, queries, limit, cursor }) => { try { const provider = providerRegistry.getProviderForPlatform(platform); if (!provider) { throw new Error(`Provider for platform '${platform}' not found`); } // Check if the provider supports bulk channel search if (!provider.searchBulkChannels) { throw new Error(`Bulk channel search is not supported for platform '${platform}'`); } const results = await provider.searchBulkChannels(queries, { limit, cursor }); // Format the results let response = `Search Results for ${queries.length} queries:\n\n`; for (const [query, result] of Object.entries(results)) { response += `Results for "${query}":\n`; if (result.channels.length === 0) { response += 'No channels found.\n'; } else { const formattedChannels = result.channels.map(channel => `Channel: ${channel.name}\n` + `Description: ${channel.description || 'No description'}\n` + `Followers: ${channel.followerCount}\n` + `Created: ${channel.createdAt}\n` + `URL: ${channel.parentUrl || 'N/A'}\n` ).join('\n'); response += formattedChannels + '\n'; } if (result.nextCursor) { response += `Use the cursor "${result.nextCursor}" to fetch more results for this query.\n`; } response += '\n'; } return { content: [{ type: "text", text: response }], isError: false }; } catch (error) { console.error(`Error in search-bulk-channels tool:`, error); return { content: [{ type: "text", text: `Error performing bulk channel search on ${platform}: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
- src/mcp/server.ts:25-27 (registration)Top-level registration in the main MCP server setup where registerContentTools is called, which in turn registers the 'search-bulk-channels' tool among others.registerContentResources(server, providerRegistry); registerContentTools(server, providerRegistry); registerContentPrompts(server);