card_list
Retrieve all credit cards in a hierarchical structure to monitor and manage your financial accounts within the Money Manager MCP Server.
Instructions
Retrieves all credit cards in a hierarchical structure.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/handlers.ts:519-547 (handler)The main handler function for the 'card_list' tool. It validates input, fetches credit card data from '/getCardData' endpoint, calculates total unpaid balance using the toNumber helper, and returns structured card groups with total.* Handler for card_list tool * Retrieves all credit cards in a hierarchical structure */ export async function handleCardList( httpClient: HttpClient, input: unknown, ): Promise<CardListResponse> { CardListInputSchema.parse(input); const rawResponse = await httpClient.get<CardGroup[]>("/getCardData"); // Calculate total unpaid balance from all card groups let totalUnpaid = 0; const cardGroups: CardGroup[] = Array.isArray(rawResponse) ? rawResponse : []; for (const group of cardGroups) { if (group.children) { for (const card of group.children) { // API returns notPayMoney as string, need to parse it totalUnpaid += Math.abs(toNumber(card.notPayMoney)); } } } return { cardGroups, totalUnpaid, }; }
- src/schemas/index.ts:250-254 (schema)Zod input schema for 'card_list' tool, which takes no parameters. Also defines the TypeScript type.* Input schema for card_list tool (no parameters) */ export const CardListInputSchema = z.object({}); export type CardListInput = z.infer<typeof CardListInputSchema>;
- src/index.ts:289-295 (registration)MCP tool registration in TOOL_DEFINITIONS array, defining name, description, and input schema for the server to expose the tool.name: "card_list", description: "Retrieves all credit cards in a hierarchical structure.", inputSchema: { type: "object" as const, properties: {}, }, },
- src/tools/handlers.ts:812-813 (registration)Internal registration of the handleCardList function in the toolHandlers object, mapping 'card_list' to its handler.// Credit Cards card_list: handleCardList,
- src/types/index.ts:239-242 (schema)TypeScript interface defining the output response structure for the 'card_list' tool.export interface CardListResponse { cardGroups: CardGroup[]; totalUnpaid: number; }