Skip to main content
Glama
shahlaukik

Money Manager MCP Server

by shahlaukik

transaction_create

Add income or expense transactions to track financial activity with date, amount, category, and account details.

Instructions

Creates a new income or expense transaction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mbDateYesTransaction date (YYYY-MM-DD)
assetIdYesAsset/Account ID
payTypeYesPayment type name
mcidYesCategory ID
mbCategoryYesCategory name
mbCashYesAmount
inOutCodeYes0=Income, 1=Expense
inOutTypeYesTransaction type name
mcscidNoOptional: Subcategory ID
subCategoryNoOptional: Subcategory name
mbContentNoOptional: Description
mbDetailContentNoOptional: Detailed notes

Implementation Reference

  • The main handler function that executes the transaction_create tool logic: validates input schema, posts to /create API endpoint, and returns operation response.
    /**
     * Handler for transaction_create tool
     * Creates a new income or expense transaction
     */
    export async function handleTransactionCreate(
      httpClient: HttpClient,
      input: unknown,
    ): Promise<TransactionOperationResponse> {
      const validated = TransactionCreateInputSchema.parse(input);
    
      const response = await httpClient.post<ApiOperationResponse>("/create", {
        mbDate: validated.mbDate,
        assetId: validated.assetId,
        payType: validated.payType,
        mcid: validated.mcid,
        mbCategory: validated.mbCategory,
        mbCash: validated.mbCash,
        inOutCode: validated.inOutCode,
        inOutType: validated.inOutType,
        mcscid: validated.mcscid || "",
        subCategory: validated.subCategory || "",
        mbContent: validated.mbContent || "",
        mbDetailContent: validated.mbDetailContent || "",
      });
    
      return {
        success: response.success !== false && response.result !== "fail",
        transactionId: response.id,
        message: response.message,
      };
    }
  • Zod input schema definition (TransactionCreateInputSchema) and type for validating transaction_create tool parameters.
    /**
     * Input schema for transaction_create tool
     */
    export const TransactionCreateInputSchema = z.object({
      mbDate: DateSchema,
      assetId: AssetIdSchema,
      payType: NonEmptyString,
      mcid: CategoryIdSchema,
      mbCategory: NonEmptyString,
      mbCash: PositiveNumber,
      inOutCode: InOutCodeSchema,
      inOutType: NonEmptyString,
      mcscid: z.string().optional(),
      subCategory: z.string().optional(),
      mbContent: z.string().optional(),
      mbDetailContent: z.string().optional(),
    });
    
    export type TransactionCreateInput = z.infer<
      typeof TransactionCreateInputSchema
    >;
  • Registration of the handleTransactionCreate handler in the toolHandlers map used to execute tools by name.
    export const toolHandlers = {
      // Initialization
      init_get_data: handleInitGetData,
    
      // Transactions
      transaction_list: handleTransactionList,
      transaction_create: handleTransactionCreate,
      transaction_update: handleTransactionUpdate,
      transaction_delete: handleTransactionDelete,
    
      // Summary
      summary_get_period: handleSummaryGetPeriod,
      summary_export_excel: handleSummaryExportExcel,
    
      // Assets
      asset_list: handleAssetList,
      asset_create: handleAssetCreate,
      asset_update: handleAssetUpdate,
      asset_delete: handleAssetDelete,
    
      // Credit Cards
      card_list: handleCardList,
      card_create: handleCardCreate,
      card_update: handleCardUpdate,
    
      // Transfers
      transfer_create: handleTransferCreate,
      transfer_update: handleTransferUpdate,
    
      // Dashboard
      dashboard_get_overview: handleDashboardGetOverview,
      dashboard_get_asset_chart: handleDashboardGetAssetChart,
    
      // Backup
      backup_download: handleBackupDownload,
      backup_restore: handleBackupRestore,
    } as const;
  • src/index.ts:72-115 (registration)
    MCP tool registration in TOOL_DEFINITIONS array, including name, description, and JSON input schema.
    {
      name: "transaction_create",
      description: "Creates a new income or expense transaction.",
      inputSchema: {
        type: "object" as const,
        properties: {
          mbDate: {
            type: "string",
            description: "Transaction date (YYYY-MM-DD)",
          },
          assetId: { type: "string", description: "Asset/Account ID" },
          payType: { type: "string", description: "Payment type name" },
          mcid: { type: "string", description: "Category ID" },
          mbCategory: { type: "string", description: "Category name" },
          mbCash: { type: "number", description: "Amount" },
          inOutCode: {
            type: "string",
            enum: ["0", "1"],
            description: "0=Income, 1=Expense",
          },
          inOutType: { type: "string", description: "Transaction type name" },
          mcscid: { type: "string", description: "Optional: Subcategory ID" },
          subCategory: {
            type: "string",
            description: "Optional: Subcategory name",
          },
          mbContent: { type: "string", description: "Optional: Description" },
          mbDetailContent: {
            type: "string",
            description: "Optional: Detailed notes",
          },
        },
        required: [
          "mbDate",
          "assetId",
          "payType",
          "mcid",
          "mbCategory",
          "mbCash",
          "inOutCode",
          "inOutType",
        ],
      },
    },
  • Schema registry (ToolSchemas) mapping tool names to their Zod schemas, including transaction_create.
    export const ToolSchemas = {
      // Initialization
      init_get_data: InitGetDataInputSchema,
    
      // Transactions
      transaction_list: TransactionListInputSchema,
      transaction_create: TransactionCreateInputSchema,
      transaction_update: TransactionUpdateInputSchema,
      transaction_delete: TransactionDeleteInputSchema,
    
      // Summary
      summary_get_period: SummaryGetPeriodInputSchema,
      summary_export_excel: SummaryExportExcelInputSchema,
    
      // Assets
      asset_list: AssetListInputSchema,
      asset_create: AssetCreateInputSchema,
      asset_update: AssetUpdateInputSchema,
      asset_delete: AssetDeleteInputSchema,
    
      // Credit Cards
      card_list: CardListInputSchema,
      card_create: CardCreateInputSchema,
      card_update: CardUpdateInputSchema,
    
      // Transfers
      transfer_create: TransferCreateInputSchema,
      transfer_update: TransferUpdateInputSchema,
    
      // Dashboard
      dashboard_get_overview: DashboardGetOverviewInputSchema,
      dashboard_get_asset_chart: DashboardGetAssetChartInputSchema,
    
      // Backup
      backup_download: BackupDownloadInputSchema,
      backup_restore: BackupRestoreInputSchema,
    } as const;

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