card_create
Create a new credit card in Money Manager by specifying card details, linking payment assets, and setting balance and payment parameters for financial tracking.
Instructions
Creates a new credit card.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cardName | Yes | Credit card name | |
| linkAssetId | Yes | Linked payment asset ID | |
| linkAssetName | Yes | Linked payment asset name | |
| notPayMoney | Yes | Unpaid balance (negative value) | |
| jungsanDay | No | Optional: Balance calculation day (1-31) | |
| paymentDay | No | Optional: Payment due day (1-31) |
Implementation Reference
- src/tools/handlers.ts:549-576 (handler)The handleCardCreate function implements the core logic for the card_create tool. It validates the input using CardCreateInputSchema, sends a POST request to the '/addAssetCard' endpoint with the card details, and returns a CardOperationResponse indicating success and the new card ID./** * Handler for card_create tool * Creates a new credit card */ export async function handleCardCreate( httpClient: HttpClient, input: unknown, ): Promise<CardOperationResponse> { const validated = CardCreateInputSchema.parse(input); const response = await httpClient.post<ApiOperationResponse>( "/addAssetCard", { cardName: validated.cardName, linkAssetId: validated.linkAssetId, linkAssetName: validated.linkAssetName, notPayMoney: validated.notPayMoney, jungsanDay: validated.jungsanDay, paymentDay: validated.paymentDay, }, ); return { success: response.success !== false && response.result !== "fail", cardId: response.cardId || response.assetId, message: response.message, }; }
- src/schemas/index.ts:256-268 (schema)Zod schema defining the input parameters for the card_create tool, including validation rules for card name, linked asset, unpaid balance, and optional settlement/payment days. Also exports the inferred TypeScript type./** * Input schema for card_create tool */ export const CardCreateInputSchema = z.object({ cardName: NonEmptyString, linkAssetId: AssetIdSchema, linkAssetName: NonEmptyString, notPayMoney: z.number(), jungsanDay: DayOfMonthSchema.optional(), paymentDay: DayOfMonthSchema.optional(), }); export type CardCreateInput = z.infer<typeof CardCreateInputSchema>;
- src/index.ts:296-322 (registration)MCP tool registration in TOOL_DEFINITIONS array: defines the 'card_create' tool with name, description, and JSON schema for input validation, used by the MCP server's list_tools handler.{ name: "card_create", description: "Creates a new credit card.", inputSchema: { type: "object" as const, properties: { cardName: { type: "string", description: "Credit card name" }, linkAssetId: { type: "string", description: "Linked payment asset ID" }, linkAssetName: { type: "string", description: "Linked payment asset name", }, notPayMoney: { type: "number", description: "Unpaid balance (negative value)", }, jungsanDay: { type: "number", description: "Optional: Balance calculation day (1-31)", }, paymentDay: { type: "number", description: "Optional: Payment due day (1-31)", }, }, required: ["cardName", "linkAssetId", "linkAssetName", "notPayMoney"], },
- src/tools/handlers.ts:813-815 (registration)Internal registration mapping 'card_create' string key to the handleCardCreate handler function within the toolHandlers object, used by executeToolHandler to dispatch calls.card_list: handleCardList, card_create: handleCardCreate, card_update: handleCardUpdate,