Skip to main content
Glama
shahlaukik

Money Manager MCP Server

by shahlaukik

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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,
      };
    }
  • 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: {},
      },
    },
  • Internal registration of the handleCardList function in the toolHandlers object, mapping 'card_list' to its handler.
    // Credit Cards
    card_list: handleCardList,
  • TypeScript interface defining the output response structure for the 'card_list' tool.
    export interface CardListResponse {
      cardGroups: CardGroup[];
      totalUnpaid: number;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shahlaukik/money-manager-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server