get-share-token
Retrieve a saved portfolio share token from local cache to access shared cryptocurrency portfolio data in the CoinStats MCP Server.
Instructions
Retrieves the saved portfolio share token from local cache.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/toolFactory.ts:37-49 (handler)The core handler logic for the 'get-share-token' tool. It retrieves the share token from the local cache using getFromCache and returns it in the tool response format, or an error message if not found.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, }, ], }; }
- src/tools/toolConfigs.ts:450-457 (schema)Tool configuration (ToolConfig) defining the name, description, empty input parameters schema (using Zod), and flags for local execution.{ name: 'get-share-token', description: 'Retrieves the saved portfolio share token from local cache.', endpoint: '', // Empty string since this is a local operation method: 'GET', parameters: {}, isLocal: true, // Flag indicating this is a local operation that doesn't use an API },
- src/index.ts:17-18 (registration)Registration of all tools, including 'get-share-token', by passing allToolConfigs to the registerTools function from toolFactory.// Register all tools from configurations registerTools(server, allToolConfigs);
- src/utils/cache.ts:54-62 (helper)Helper utility function used by the handler to fetch the share token value from the local JSON cache file.export async function getFromCache(key: string): Promise<any | undefined> { try { const cacheData = await readCache(); return cacheData[key]; } catch (error) { console.error(`Error getting '${key}' from cache:`, error); return undefined; // Return undefined on error instead of throwing } }