Skip to main content
Glama

search-channels

Search for social platform channels using platform-specific queries. Input platform name, search term, and optional parameters like limit, cursor, and channel inclusion for targeted results.

Instructions

Search for channels on a social platform

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoCursor for pagination
includeChannelsNoWhether to include channel information in results
limitNoMaximum number of results to return
platformYesThe platform to search on (e.g., 'farcaster')
queryYesThe search query

Implementation Reference

  • Registration of the 'search-channels' MCP tool, including description, input schema, and inline handler function that delegates to platform provider's searchChannels method and formats results.
    server.tool( "search-channels", "Search for channels on a social platform", { platform: z.string().describe("The platform to search on (e.g., 'farcaster')"), query: z.string().describe("The search query"), limit: z.number().optional().describe("Maximum number of results to return"), cursor: z.string().optional().describe("Cursor for pagination"), includeChannels: z.boolean().optional().describe("Whether to include channel information in results") }, async ({ platform, query, limit, cursor, includeChannels }) => { try { const provider = providerRegistry.getProviderForPlatform(platform); if (!provider) { throw new Error(`Provider for platform '${platform}' not found`); } // Check if the provider supports channel search if (!provider.searchChannels) { throw new Error(`Channel search is not supported for platform '${platform}'`); } const results = await provider.searchChannels(query, { limit, cursor, includeChannels }); // Format the results const formattedResults = results.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'); let response = `Found ${results.channels.length} channels:\n\n${formattedResults}`; if (results.nextCursor) { response += `\n\nUse the cursor "${results.nextCursor}" to fetch more results.`; } return { content: [{ type: "text", text: response }], isError: false }; } catch (error) { console.error(`Error in search-channels tool:`, error); return { content: [{ type: "text", text: `Error searching channels on ${platform} for '${query}': ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
  • The execution handler for the 'search-channels' tool. Retrieves the platform provider, validates support for channel search, invokes provider.searchChannels, formats channel details (name, desc, followers, created, URL), handles pagination cursor, and returns formatted text response or error.
    async ({ platform, query, limit, cursor, includeChannels }) => { try { const provider = providerRegistry.getProviderForPlatform(platform); if (!provider) { throw new Error(`Provider for platform '${platform}' not found`); } // Check if the provider supports channel search if (!provider.searchChannels) { throw new Error(`Channel search is not supported for platform '${platform}'`); } const results = await provider.searchChannels(query, { limit, cursor, includeChannels }); // Format the results const formattedResults = results.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'); let response = `Found ${results.channels.length} channels:\n\n${formattedResults}`; if (results.nextCursor) { response += `\n\nUse the cursor "${results.nextCursor}" to fetch more results.`; } return { content: [{ type: "text", text: response }], isError: false }; } catch (error) { console.error(`Error in search-channels tool:`, error); return { content: [{ type: "text", text: `Error searching channels on ${platform} for '${query}': ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
  • Zod input schema for 'search-channels' tool defining parameters: platform (string), query (string), optional limit (number), cursor (string), includeChannels (boolean).
    { platform: z.string().describe("The platform to search on (e.g., 'farcaster')"), query: z.string().describe("The search query"), limit: z.number().optional().describe("Maximum number of results to return"), cursor: z.string().optional().describe("Cursor for pagination"), includeChannels: z.boolean().optional().describe("Whether to include channel information in results") },
  • Top-level registration call to registerContentTools which includes the 'search-channels' tool among others.
    registerContentResources(server, providerRegistry); registerContentTools(server, providerRegistry); registerContentPrompts(server);

Other Tools

Related 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/Beyond-Network-AI/beyond-mcp-server'

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