get-market-analysis
Analyze cryptocurrency markets by retrieving detailed insights on top exchanges and volume distribution using a specific symbol. Ideal for informed trading decisions and market research.
Instructions
Get detailed market analysis including top exchanges and volume distribution
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Cryptocurrency symbol (e.g., BTC, ETH) |
Implementation Reference
- src/tools/market.ts:9-40 (handler)Main handler function that executes the get-market-analysis tool: validates input with Zod schema, fetches cryptocurrency asset data and market data using Coincap API services, handles errors for missing data, and formats the market analysis response.export async function handleGetMarketAnalysis(args: unknown) { const { symbol } = GetMarketAnalysisSchema.parse(args); const upperSymbol = symbol.toUpperCase(); const assetsData = await getAssets(); if (!assetsData) { return { content: [{ type: "text", text: "Failed to retrieve cryptocurrency data" }], }; } const asset = assetsData.data.find( (a: { symbol: string; }) => a.symbol.toUpperCase() === upperSymbol ); if (!asset) { return { content: [{ type: "text", text: `Could not find cryptocurrency with symbol ${upperSymbol}` }], }; } const marketsData = await getMarkets(asset.id); if (!marketsData) { return { content: [{ type: "text", text: "Failed to retrieve market data" }], }; } return { content: [{ type: "text", text: formatMarketAnalysis(asset, marketsData.data) }], }; }
- src/index.ts:45-58 (schema)Input schema definition for the get-market-analysis tool, registered in the ListTools response.{ name: "get-market-analysis", description: "Get detailed market analysis including top exchanges and volume distribution", inputSchema: { type: "object", properties: { symbol: { type: "string", description: "Cryptocurrency symbol (e.g., BTC, ETH)", }, }, required: ["symbol"], }, },
- src/index.ts:95-96 (registration)Switch case registration that dispatches calls to the get-market-analysis handler function.case "get-market-analysis": return await handleGetMarketAnalysis(args);
- src/tools/market.ts:5-7 (schema)Zod validation schema used internally by the handler for input parsing.export const GetMarketAnalysisSchema = z.object({ symbol: z.string().min(1), });