Skip to main content
Glama

CoinStats MCP Server

Official

save-share-token

Store portfolio share tokens locally to maintain access across sessions for consistent cryptocurrency portfolio tracking and management.

Instructions

Saves the provided portfolio share token to a local cache for future use across sessions.

Input Schema

NameRequiredDescriptionDefault
shareTokenYesThe portfolio share token to save locally.

Input Schema (JSON Schema)

{ "properties": { "shareToken": { "description": "The portfolio share token to save locally.", "type": "string" } }, "required": [ "shareToken" ], "type": "object" }

Implementation Reference

  • The handler function that executes the 'save-share-token' tool: saves the provided shareToken to local cache using saveToCache and returns a success message.
    if (config.name === 'save-share-token') { await saveToCache('shareToken', params.shareToken); return { content: [ { type: 'text', text: 'Share token saved successfully', }, ], }; }
  • The tool configuration object defining the schema (parameters), description, and flags like isLocal for the 'save-share-token' tool.
    name: 'save-share-token', description: 'Saves the provided portfolio share token to a local cache for future use across sessions.', // This tool operates locally and does not call an external API endpoint. // The logic to call saveToCache('shareToken', shareToken) will be handled // by the tool execution mechanism based on this tool's name. endpoint: '', // Empty string since this is a local operation method: 'POST', // Using POST since we're saving data parameters: { shareToken: z.string().describe('The portfolio share token to save locally.'), }, isLocal: true, // Flag indicating this is a local operation that doesn't use an API },
  • The registration loop where server.tool is called for each config, including 'save-share-token', registering the tool with MCP server.
    toolConfigs.forEach((config) => { server.tool(config.name, config.description, config.parameters, async (params: Record<string, any>) => {
  • The saveToCache helper function used by the handler to persist the share token to a local JSON cache file.
    export async function saveToCache(key: string, value: any): Promise<void> { try { const cacheData = await readCache(); cacheData[key] = value; await fs.writeFile(cacheFilePath, JSON.stringify(cacheData, null, 2), 'utf-8'); } catch (error) { console.error(`Error saving '${key}' to cache:`, error); return undefined; // Return undefined on error instead of throwing } }
  • src/index.ts:18-18 (registration)
    The call to registerTools with allToolConfigs (imported from toolConfigs.ts), which includes the 'save-share-token' config, thus registering the tool.
    registerTools(server, allToolConfigs);

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