asset_create
Add new financial accounts or assets to track balances and organize personal finances in the Money Manager system.
Instructions
Creates a new asset/account.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assetGroupId | Yes | Asset group ID | |
| assetGroupName | Yes | Asset group name | |
| assetName | Yes | Asset name | |
| assetMoney | Yes | Initial balance | |
| linkAssetId | No | Optional: Linked asset ID | |
| linkAssetName | No | Optional: Linked asset name |
Implementation Reference
- src/tools/handlers.ts:440-464 (handler)The main handler function for the asset_create tool. Validates input using AssetCreateInputSchema and makes a POST request to the /assetAdd API endpoint to create a new asset./** * Handler for asset_create tool * Creates a new asset/account */ export async function handleAssetCreate( httpClient: HttpClient, input: unknown, ): Promise<AssetOperationResponse> { const validated = AssetCreateInputSchema.parse(input); const response = await httpClient.post<ApiOperationResponse>("/assetAdd", { assetGroupId: validated.assetGroupId, assetGroupName: validated.assetGroupName, assetName: validated.assetName, assetMoney: validated.assetMoney, linkAssetId: validated.linkAssetId || "", linkAssetName: validated.linkAssetName || "", }); return { success: response.success !== false && response.result !== "fail", assetId: response.assetId, message: response.message, }; }
- src/schemas/index.ts:202-214 (schema)Zod schema definition for validating input parameters of the asset_create tool, including assetGroupId, assetGroupName, assetName, assetMoney, and optional link fields./** * Input schema for asset_create tool */ export const AssetCreateInputSchema = z.object({ assetGroupId: NonEmptyString, assetGroupName: NonEmptyString, assetName: NonEmptyString, assetMoney: z.number(), linkAssetId: z.string().optional(), linkAssetName: z.string().optional(), }); export type AssetCreateInput = z.infer<typeof AssetCreateInputSchema>;
- src/index.ts:224-245 (registration)MCP tool registration in the TOOL_DEFINITIONS array, defining the name, description, and inputSchema for the asset_create tool.{ name: "asset_create", description: "Creates a new asset/account.", inputSchema: { type: "object" as const, properties: { assetGroupId: { type: "string", description: "Asset group ID" }, assetGroupName: { type: "string", description: "Asset group name" }, assetName: { type: "string", description: "Asset name" }, assetMoney: { type: "number", description: "Initial balance" }, linkAssetId: { type: "string", description: "Optional: Linked asset ID", }, linkAssetName: { type: "string", description: "Optional: Linked asset name", }, }, required: ["assetGroupId", "assetGroupName", "assetName", "assetMoney"], }, },
- src/tools/handlers.ts:792-828 (registration)Internal tool handler registry mapping 'asset_create' to the handleAssetCreate function.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/types/index.ts:137-145 (schema)TypeScript interface definition for AssetCreateInput used in conjunction with the Zod schema.*/ export interface AssetCreateInput { assetGroupId: string; assetGroupName: string; assetName: string; assetMoney: number; linkAssetId?: string; linkAssetName?: string; }