Skip to main content
Glama

search-source

Search specific sources for Web3 token information by providing token name, ticker, and source type to find relevant data and insights.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenNameYesName of the token
tokenTickerYesTicker symbol of the token
sourceYesSource to search (e.g., 'Dune', 'IQ Wiki', 'News')

Implementation Reference

  • The main handler function for the 'search-source' tool. It takes tokenName, tokenTicker, and source as input, calls the searchSource helper, stores results, fetches content from the top result, saves it as a resource, and returns a formatted text response.
    async ({ tokenName, tokenTicker, source, }: { tokenName: string; tokenTicker: string; source: string; }) => { storage.addLogEntry( `Searching ${source} for ${tokenName} (${tokenTicker})` ); try { const results = await searchSource(tokenName, tokenTicker, source); storage.addToSection("searchResults", { [source]: results, }); let responseText = `Search results for ${source} about ${tokenName} (${tokenTicker}):\n\n`; if (results.results && results.results.length > 0) { const topResults = results.results.slice(0, 5); responseText += JSON.stringify(topResults, null, 2); if (topResults[0] && topResults[0].url) { const url = topResults[0].url; responseText += `\n\nFetching content from top result: ${url}`; try { await sleep(3000); const content = await fetchContent(url, "text"); const resourceId = `${source.toLowerCase()}_${tokenName.toLowerCase()}_${new Date().getTime()}`; storage.addToSection("resources", { [resourceId]: { url, format: "text", content, source, fetchedAt: new Date().toISOString(), }, }); responseText += `\n\nContent has been saved as a resource. Use 'research://resource/${resourceId}' to access it.`; } catch (fetchError) { responseText += `\n\nCould not fetch content from URL: ${fetchError}`; } } } else { responseText += `No results found.`; } return { content: [ { type: "text", text: responseText, }, ], }; } catch (error) { storage.addLogEntry(`Error searching ${source}: ${error}`); return { isError: true, content: [ { type: "text", text: `Error searching ${source}: ${error}`, }, ], }; } } );
  • Zod input schema for the 'search-source' tool defining parameters tokenName, tokenTicker, and source.
    { tokenName: z.string().describe("Name of the token"), tokenTicker: z.string().describe("Ticker symbol of the token"), source: z .string() .describe("Source to search (e.g., 'Dune', 'IQ Wiki', 'News')"), },
  • Registration of the 'search-source' tool in registerResearchTools function using McpServer.tool().
    server.tool( "search-source", { tokenName: z.string().describe("Name of the token"), tokenTicker: z.string().describe("Ticker symbol of the token"), source: z .string() .describe("Source to search (e.g., 'Dune', 'IQ Wiki', 'News')"), }, async ({ tokenName, tokenTicker, source, }: { tokenName: string; tokenTicker: string; source: string; }) => { storage.addLogEntry( `Searching ${source} for ${tokenName} (${tokenTicker})` ); try { const results = await searchSource(tokenName, tokenTicker, source); storage.addToSection("searchResults", { [source]: results, }); let responseText = `Search results for ${source} about ${tokenName} (${tokenTicker}):\n\n`; if (results.results && results.results.length > 0) { const topResults = results.results.slice(0, 5); responseText += JSON.stringify(topResults, null, 2); if (topResults[0] && topResults[0].url) { const url = topResults[0].url; responseText += `\n\nFetching content from top result: ${url}`; try { await sleep(3000); const content = await fetchContent(url, "text"); const resourceId = `${source.toLowerCase()}_${tokenName.toLowerCase()}_${new Date().getTime()}`; storage.addToSection("resources", { [resourceId]: { url, format: "text", content, source, fetchedAt: new Date().toISOString(), }, }); responseText += `\n\nContent has been saved as a resource. Use 'research://resource/${resourceId}' to access it.`; } catch (fetchError) { responseText += `\n\nCould not fetch content from URL: ${fetchError}`; } } } else { responseText += `No results found.`; } return { content: [ { type: "text", text: responseText, }, ], }; } catch (error) { storage.addLogEntry(`Error searching ${source}: ${error}`); return { isError: true, content: [ { type: "text", text: `Error searching ${source}: ${error}`, }, ], }; } } );
  • Helper function implementing the core search logic for specific sources by adding relevant extra search terms and delegating to performSearch (which uses DuckDuckGo scraper). This is the exact implementation of the search functionality called by the tool handler.
    export async function searchSource( tokenName: string, tokenTicker: string, source: string ): Promise<any> { const extraTerms = ["crypto", "token"]; switch (source.toLowerCase()) { case "coinmarketcap": extraTerms.push("price", "market", "chart"); break; case "docs": extraTerms.push("documentation", "whitepaper", "github"); break; case "vesting": extraTerms.push("tokenomics", "schedule", "unlock"); break; case "raise": extraTerms.push("funding", "investment", "ico", "seed"); break; case "news": extraTerms.push("latest", "announcement", "update"); break; case "crypto token": case "dashboard": case "iq wiki": case "dune": extraTerms.push("dashboard", "crypto", "stats"); break; case "airdrop": break; default: } const query = `${tokenName} ${tokenTicker} ${source} ${extraTerms.join(" ")}`; if (source.toLowerCase() === "news") { return performSearch(query, "news"); } return performSearch(query, "web"); }
  • Top-level tool registration entrypoint that invokes registerResearchTools, which registers 'search-source' among other tools.
    export function registerAllTools( server: McpServer, storage: ResearchStorage ): void { registerResearchTools(server, storage); }

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/aaronjmars/web3-research-mcp'

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