Skip to main content
Glama
CoinStatsHQ

CoinStats MCP Server

Official

get-ticker-exchanges

Retrieve a list of cryptocurrency exchanges supported by the CoinStats API for accessing market data and portfolio tracking.

Instructions

Get a list of supported exchanges.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Generic handler function for all API-based tools, including get-ticker-exchanges. Determines if local or API call, then invokes universalApiHandler with the tool's endpoint '/tickers/exchanges', GET method, and basePath from constants.
    server.tool(config.name, config.description, config.parameters, async (params: Record<string, any>) => {
        // Handle local operations
        if (config.isLocal) {
            // Handle specific local tools
            if (config.name === 'save-share-token') {
                await saveToCache('shareToken', params.shareToken);
                return {
                    content: [
                        {
                            type: 'text',
                            text: 'Share token saved successfully',
                        },
                    ],
                };
            }
    
            if (config.name === 'get-share-token') {
                const shareToken = await getFromCache('shareToken');
    
                return {
                    content: [
                        {
                            type: 'text',
                            text: shareToken ? shareToken : 'No share token found in cache',
                            isError: !shareToken,
                        },
                    ],
                };
            }
            // Future local tools can be added here
    
            // Default response for unhandled local tools
            return {
                content: [
                    {
                        type: 'text',
                        text: 'Operation completed',
                    },
                ],
            };
        }
    
        // Handle API operations
        const basePath = config.basePath || COINSTATS_API_BASE;
        const method = config.method || 'GET';
    
        // Methods that typically have a request body
        const bodyMethods = ['POST', 'PUT', 'PATCH', 'DELETE'];
    
        // For GET/DELETE requests, all params go in the URL
        // For POST/PUT/PATCH, send params as the body
        if (bodyMethods.includes(method.toUpperCase())) {
            return universalApiHandler(basePath, config.endpoint, method, {}, params);
        } else {
            return universalApiHandler(basePath, config.endpoint, method, params);
        }
  • Schema definition for the get-ticker-exchanges tool, including name, description, endpoint, method, and empty parameters schema.
    {
        name: 'get-ticker-exchanges',
        description: 'Get a list of supported exchanges.',
        endpoint: '/tickers/exchanges',
        method: 'GET',
        parameters: {},
    },
  • src/index.ts:18-18 (registration)
    Registers all tools, including get-ticker-exchanges, by calling registerTools with the MCP server instance and allToolConfigs.
    registerTools(server, allToolConfigs);
  • Registers each tool configuration with the MCP server by calling server.tool for every config in allToolConfigs.
    export function registerTools(server: McpServer, toolConfigs: ToolConfig<any>[]) {
        toolConfigs.forEach((config) => {
            server.tool(config.name, config.description, config.parameters, async (params: Record<string, any>) => {
                // Handle local operations
                if (config.isLocal) {
                    // Handle specific local tools
                    if (config.name === 'save-share-token') {
                        await saveToCache('shareToken', params.shareToken);
                        return {
                            content: [
                                {
                                    type: 'text',
                                    text: 'Share token saved successfully',
                                },
                            ],
                        };
                    }
    
                    if (config.name === 'get-share-token') {
                        const shareToken = await getFromCache('shareToken');
    
                        return {
                            content: [
                                {
                                    type: 'text',
                                    text: shareToken ? shareToken : 'No share token found in cache',
                                    isError: !shareToken,
                                },
                            ],
                        };
                    }
                    // Future local tools can be added here
    
                    // Default response for unhandled local tools
                    return {
                        content: [
                            {
                                type: 'text',
                                text: 'Operation completed',
                            },
                        ],
                    };
                }
    
                // Handle API operations
                const basePath = config.basePath || COINSTATS_API_BASE;
                const method = config.method || 'GET';
    
                // Methods that typically have a request body
                const bodyMethods = ['POST', 'PUT', 'PATCH', 'DELETE'];
    
                // For GET/DELETE requests, all params go in the URL
                // For POST/PUT/PATCH, send params as the body
                if (bodyMethods.includes(method.toUpperCase())) {
                    return universalApiHandler(basePath, config.endpoint, method, {}, params);
                } else {
                    return universalApiHandler(basePath, config.endpoint, method, params);
                }
            });
        });
    }
  • Helper function that performs the actual HTTP API call to CoinStats using the specified endpoint (for this tool: '/tickers/exchanges'), handles path/query params, API key auth, and returns JSON response as MCP text content.
    export async function universalApiHandler<T>(
        basePath: string,
        endpoint: string,
        method: string = 'GET',
        params: Record<string, any> = {},
        body?: any
    ): Promise<{
        content: Array<{ type: 'text'; text: string; isError?: boolean }>;
    }> {
        try {
            // Handle path parameters - replace {paramName} in endpoint with actual values
            let processedEndpoint = endpoint;
            let processedParams = { ...params };
    
            // Find all path parameters in the endpoint (e.g., {coinId}, {id}, {type})
            const pathParamMatches = endpoint.match(/\{([^}]+)\}/g);
    
            if (pathParamMatches) {
                for (const match of pathParamMatches) {
                    const paramName = match.slice(1, -1); // Remove { and }
    
                    if (processedParams[paramName] !== undefined) {
                        // Replace the placeholder with the actual value
                        processedEndpoint = processedEndpoint.replace(match, processedParams[paramName]);
                        // Remove the parameter from query params since it's now part of the path
                        delete processedParams[paramName];
                    } else {
                        throw new Error(`Required path parameter '${paramName}' is missing`);
                    }
                }
            }
    
            // MCP clients might not support '~' in parameter names, so we replace '-' with '~' specifically for the /coins endpoint before making the request.
            if (endpoint === '/coins') {
                processedParams = Object.entries(processedParams).reduce((acc, [key, value]) => {
                    acc[key.replace(/-/g, '~')] = value;
                    return acc;
                }, {} as Record<string, any>);
            }
    
            const url = `${basePath}${processedEndpoint}`;
            const data = await makeRequestCsApi<T>(url, method, processedParams, body);
    
            if (!data) {
                return {
                    content: [{ type: 'text', text: 'Something went wrong', isError: true }],
                };
            }
    
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify(data),
                    },
                ],
            };
        } catch (error) {
            return {
                content: [{ type: 'text', text: `Error: ${error}`, isError: true }],
            };
        }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action. It doesn't mention whether this is a read-only operation, if it requires authentication, rate limits, or what the return format might be (e.g., list structure, pagination). This is inadequate for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It's front-loaded with the core purpose, making it highly efficient and easy to parse for an AI agent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is insufficiently complete. It doesn't explain what 'supported exchanges' means (e.g., by region or asset type), the return format, or any behavioral traits like error handling. For a tool in a financial/data context with many siblings, more detail is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so there's no need for parameter details in the description. The description appropriately doesn't mention parameters, earning a baseline score of 4 for not adding unnecessary information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'list of supported exchanges', making the purpose immediately understandable. However, it doesn't differentiate from the sibling tool 'get-exchanges', which appears to serve a similar function, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get-exchanges' or other data retrieval tools in the sibling list. It lacks context about prerequisites, timing, or specific use cases, leaving the agent to infer usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/CoinStatsHQ/coinstats-mcp'

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