get-wallet-transactions
Retrieve and filter transaction history for a cryptocurrency wallet, including deposits, withdrawals, and fees, with date range and pagination options.
Instructions
Get transaction data for a specific wallet. Ensure transactions are synced by calling PATCH /transactions first.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | Wallet address | |
| connectionId | Yes | The identifier of connection, which you received from /wallet/blockchains call response. | |
| currency | No | Currency for price data | USD |
| from | No | Start date in ISO 8601 format | |
| limit | No | Number of results per page | |
| page | No | Page number | |
| to | No | End date in ISO 8601 format | |
| txId | No | To search with transaction hash | |
| types | No | Transaction types, comma separated (deposit,withdraw,approve,executed,balance,fee) |
Implementation Reference
- src/tools/toolConfigs.ts:205-221 (schema)Tool configuration defining the name, description, endpoint, HTTP method, and Zod input schema (parameters) for the 'get-wallet-transactions' tool.{ name: 'get-wallet-transactions', description: 'Get transaction data for a specific wallet. Ensure transactions are synced by calling PATCH /transactions first.', endpoint: '/wallet/transactions', method: 'GET', parameters: { address: z.string().describe('Wallet address'), connectionId: z.string().describe('The identifier of connection, which you received from /wallet/blockchains call response.'), page: z.number().optional().describe('Page number').default(1), limit: z.number().optional().describe('Number of results per page').default(20), from: z.string().optional().describe('Start date in ISO 8601 format'), to: z.string().optional().describe('End date in ISO 8601 format'), currency: z.string().optional().describe('Currency for price data').default('USD'), types: z.string().optional().describe('Transaction types, comma separated (deposit,withdraw,approve,executed,balance,fee)'), txId: z.string().optional().describe('To search with transaction hash'), }, },
- src/index.ts:17-18 (registration)Registers all tools, including 'get-wallet-transactions', with the MCP server by invoking the registerTools function with the server instance and tool configurations.// Register all tools from configurations registerTools(server, allToolConfigs);
- src/tools/toolFactory.ts:20-21 (registration)Uses server.tool() to register each tool (including 'get-wallet-transactions') with its name, description, input schema, and handler function.toolConfigs.forEach((config) => { server.tool(config.name, config.description, config.parameters, async (params: Record<string, any>) => {
- src/tools/toolFactory.ts:21-77 (handler)Generic handler function registered for all non-local tools like 'get-wallet-transactions'. Determines if local or API operation and delegates API calls to universalApiHandler with the tool's endpoint, method, and parameters.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); } });
- src/services/request.ts:35-97 (helper)Performs the HTTP request to the CoinStats API: processes path parameters, handles special query param transformations, fetches data using makeRequestCsApi, and returns the JSON response in MCP content format or error.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 }], }; } }