get-share-token
Retrieve the saved portfolio share token from local cache to access and manage cryptocurrency portfolio data through the CoinStats API.
Instructions
Retrieves the saved portfolio share token from local cache.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/tools/toolFactory.ts:37-49 (handler)The core handler function for the 'get-share-token' tool. It fetches the share token from the local cache using getFromCache and returns it in the MCP 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 object defining the name, description, empty parameters schema (no inputs), and flags indicating it's a local GET operation.{ 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)Registers all tools, including 'get-share-token', by calling registerTools with the allToolConfigs array on the MCP server instance.// Register all tools from configurations registerTools(server, allToolConfigs);
- src/utils/cache.ts:54-62 (helper)Helper utility function getFromCache used directly in the tool handler to retrieve the 'shareToken' 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 } }