list_resources
Retrieve a list of specific resource types, such as cards, accounts, or transactions, using the Lithic MCP Server’s API. Ideal for accessing structured banking and card services data.
Instructions
List resources of a specific type
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resourceType | Yes | Type of resource to list (cards, accounts, transactions, etc.) |
Implementation Reference
- src/index.ts:191-226 (handler)Handler for the 'list_resources' tool: validates input, maps resource type to API endpoint, fetches list from Lithic API, returns JSON response or error.} else if (request.params.name === "list_resources") { try { // Parse and validate arguments const args = z.object({ resourceType: resourceTypeSchema }).parse(request.params.arguments); // Map to standardized resource type const standardizedResourceType = RESOURCE_MAP[args.resourceType.toLowerCase()] || args.resourceType; // Map resource type to endpoint const endpoint = mapResourceTypeToEndpoint(standardizedResourceType); const response = await lithicApi.get(endpoint); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2) } ] }; } catch (error: any) { console.error(`Error listing resources:`, error.message); return { isError: true, content: [ { type: "text", text: `Error listing resources: ${error.message}` } ] }; } }
- src/index.ts:100-113 (registration)Tool registration in ListToolsRequestHandler: defines name, description, and input schema for 'list_resources'.{ name: "list_resources", description: "List resources of a specific type", inputSchema: { type: "object", properties: { resourceType: { type: "string", description: "Type of resource to list (cards, accounts, transactions, etc.)" } }, required: ["resourceType"] } }
- src/index.ts:119-148 (helper)Helper function to map resource type to the corresponding Lithic API endpoint, used by list_resources handler.function mapResourceTypeToEndpoint(resourceType: string): string { switch (resourceType) { case 'card': return '/cards'; case 'account': return '/accounts'; case 'financial_account': return '/financial_accounts'; case 'transaction': return '/transactions'; case 'external_bank_account': return '/external_bank_accounts'; case 'event': return '/events'; case 'balance': return '/balances'; case 'card_program': return '/card_programs'; case 'dispute': return '/disputes'; case 'report': return '/reports'; case 'webhook': return '/webhooks'; case 'account_holder': return '/account_holders'; default: return `/${resourceType}s`; // Default to pluralizing the resource type } }
- src/index.ts:29-47 (helper)Helper mapping of resource type aliases to standardized names, used to normalize input for list_resources.const RESOURCE_MAP: Record<string, string> = { 'card': 'card', 'account': 'account', 'financial_account': 'financial_account', 'financial-account': 'financial_account', 'credit': 'financial_account', 'credit-account': 'financial_account', 'transaction': 'transaction', 'event': 'event', 'balance': 'balance', 'dispute': 'dispute', 'bank': 'external_bank_account', 'bank-account': 'external_bank_account', 'external_bank_account': 'external_bank_account', 'report': 'report', 'webhook': 'webhook', 'card_program': 'card_program', 'account_holder': 'account_holder' };