research-token
Analyze token details by specifying name, ticker, and source to gather insights from platforms like IQ Wiki or CoinMarketCap.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Source to research (e.g., 'IQ Wiki', 'CoinMarketCap') | |
| tokenName | Yes | Name of the token | |
| tokenTicker | Yes | Ticker symbol of the token |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"source": {
"description": "Source to research (e.g., 'IQ Wiki', 'CoinMarketCap')",
"type": "string"
},
"tokenName": {
"description": "Name of the token",
"type": "string"
},
"tokenTicker": {
"description": "Ticker symbol of the token",
"type": "string"
}
},
"required": [
"tokenName",
"tokenTicker",
"source"
],
"type": "object"
}
Implementation Reference
- src/tools/researchTools.ts:652-762 (handler)The handler function for the 'research-token' tool. It performs a web search for the token using the provided source, stores top results, fetches and stores content from the top result as a resource, and returns a summary.async ({ tokenName, tokenTicker, source, }: { tokenName: string; tokenTicker: string; source: string; }) => { storage.addLogEntry( `Researching source: ${source} for ${tokenName} (${tokenTicker})` ); try { const query = `${tokenName} ${tokenTicker} ${source}`; const results = await performSearch(query, "web"); if (!results.results || results.results.length === 0) { storage.addLogEntry(`No results found for ${source}`); return { content: [ { type: "text", text: `No results found for ${source}`, }, ], }; } const topResults = results.results.slice(0, 3); storage.addToSection("searchResults", { [source]: topResults }); if (topResults[0] && topResults[0].url) { try { const url = topResults[0].url; storage.addLogEntry(`Fetching content from ${url}`); const content = await fetchContent(url, "markdown"); const resourceId = `${source.toLowerCase()}_${tokenName.toLowerCase()}_${new Date().getTime()}`; storage.addToSection("resources", { [resourceId]: { url, format: "markdown", content, title: topResults[0].title, source, fetchedAt: new Date().toISOString(), }, }); return { content: [ { type: "text", text: `Researched ${source} for ${tokenName} (${tokenTicker}).\n\nTop result: ${ topResults[0].title }\n\nContent saved as resource: research://resource/${resourceId}\n\nAll search results:\n${JSON.stringify( topResults, null, 2 )}`, }, ], }; } catch (error) { storage.addLogEntry( `Error fetching content from ${topResults[0].url}: ${error}` ); return { content: [ { type: "text", text: `Found search results for ${source}, but couldn't fetch content: ${error}\n\nSearch results:\n${JSON.stringify( topResults, null, 2 )}`, }, ], }; } } return { content: [ { type: "text", text: `Search results for ${source}:\n\n${JSON.stringify( topResults, null, 2 )}`, }, ], }; } catch (error) { storage.addLogEntry(`Error researching ${source}: ${error}`); return { isError: true, content: [ { type: "text", text: `Error researching ${source}: ${error}`, }, ], }; } } );
- src/tools/researchTools.ts:645-651 (schema)Input schema for the 'research-token' tool using Zod, 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 research (e.g., 'IQ Wiki', 'CoinMarketCap')"), },
- src/tools/researchTools.ts:643-762 (registration)Registration of the 'research-token' tool within the registerResearchTools function using McpServer.tool().server.tool( "research-token", { tokenName: z.string().describe("Name of the token"), tokenTicker: z.string().describe("Ticker symbol of the token"), source: z .string() .describe("Source to research (e.g., 'IQ Wiki', 'CoinMarketCap')"), }, async ({ tokenName, tokenTicker, source, }: { tokenName: string; tokenTicker: string; source: string; }) => { storage.addLogEntry( `Researching source: ${source} for ${tokenName} (${tokenTicker})` ); try { const query = `${tokenName} ${tokenTicker} ${source}`; const results = await performSearch(query, "web"); if (!results.results || results.results.length === 0) { storage.addLogEntry(`No results found for ${source}`); return { content: [ { type: "text", text: `No results found for ${source}`, }, ], }; } const topResults = results.results.slice(0, 3); storage.addToSection("searchResults", { [source]: topResults }); if (topResults[0] && topResults[0].url) { try { const url = topResults[0].url; storage.addLogEntry(`Fetching content from ${url}`); const content = await fetchContent(url, "markdown"); const resourceId = `${source.toLowerCase()}_${tokenName.toLowerCase()}_${new Date().getTime()}`; storage.addToSection("resources", { [resourceId]: { url, format: "markdown", content, title: topResults[0].title, source, fetchedAt: new Date().toISOString(), }, }); return { content: [ { type: "text", text: `Researched ${source} for ${tokenName} (${tokenTicker}).\n\nTop result: ${ topResults[0].title }\n\nContent saved as resource: research://resource/${resourceId}\n\nAll search results:\n${JSON.stringify( topResults, null, 2 )}`, }, ], }; } catch (error) { storage.addLogEntry( `Error fetching content from ${topResults[0].url}: ${error}` ); return { content: [ { type: "text", text: `Found search results for ${source}, but couldn't fetch content: ${error}\n\nSearch results:\n${JSON.stringify( topResults, null, 2 )}`, }, ], }; } } return { content: [ { type: "text", text: `Search results for ${source}:\n\n${JSON.stringify( topResults, null, 2 )}`, }, ], }; } catch (error) { storage.addLogEntry(`Error researching ${source}: ${error}`); return { isError: true, content: [ { type: "text", text: `Error researching ${source}: ${error}`, }, ], }; } } );