init_get_data
Retrieves initial financial data including categories, payment types, asset groups, and multi-book configuration for Money Manager MCP Server.
Instructions
Retrieves initial application data including categories, payment types, asset groups, and multi-book configuration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mbid | No | Optional: Money book ID |
Implementation Reference
- src/tools/handlers.ts:122-154 (handler)The main handler function for the init_get_data tool. It validates input, calls the Money Manager API /getInitData endpoint, and transforms the raw response into the expected InitDataResponse format./** * Handler for init_get_data tool * Retrieves initial application data including categories, payment types, etc. */ export async function handleInitGetData( httpClient: HttpClient, input: unknown, ): Promise<InitDataResponse> { const validated = InitGetDataInputSchema.parse(input); const params: Record<string, string | undefined> = {}; if (validated.mbid) { params["mbid"] = validated.mbid; } const rawResponse = await httpClient.get<RawInitDataResponse>( "/getInitData", params, ); // Transform the raw response to the expected format return { initData: rawResponse.initData, categories: { income: rawResponse.category_0 || [], expense: rawResponse.category_1 || [], }, paymentTypes: rawResponse.payType || [], multiBooks: rawResponse.multiBooks || [], assetGroups: rawResponse.assetGroups || [], assetNames: rawResponse.assetNames || [], }; }
- src/schemas/index.ts:62-69 (schema)Zod schema defining the input for init_get_data tool: optional mbid string./** * Input schema for init_get_data tool */ export const InitGetDataInputSchema = z.object({ mbid: z.string().optional(), }); export type InitGetDataInput = z.infer<typeof InitGetDataInputSchema>;
- src/tools/handlers.ts:794-794 (registration)Registration of the handleInitGetData function in the toolHandlers map used for tool execution.init_get_data: handleInitGetData,
- src/index.ts:30-43 (registration)MCP protocol tool definition registration, including name, description, and JSON schema for input validation.{ name: "init_get_data", description: "Retrieves initial application data including categories, payment types, asset groups, and multi-book configuration.", inputSchema: { type: "object" as const, properties: { mbid: { type: "string", description: "Optional: Money book ID", }, }, }, },
- src/schemas/index.ts:376-376 (registration)Registration of the input schema in the ToolSchemas registry for validation lookup.init_get_data: InitGetDataInputSchema,