@baruchiro/actual-mcp
Version:
Actual Budget MCP server exposing API functionality
22 lines (21 loc) • 889 B
JavaScript
// Parses and validates input arguments for spending-by-category tool
export class SpendingByCategoryInputParser {
parse(args) {
if (!args || typeof args !== "object") {
throw new Error("Arguments must be an object");
}
const { startDate, endDate, accountId, includeIncome } = args;
if (!startDate || typeof startDate !== "string") {
throw new Error("startDate is required and must be a string (YYYY-MM-DD)");
}
if (!endDate || typeof endDate !== "string") {
throw new Error("endDate is required and must be a string (YYYY-MM-DD)");
}
return {
startDate,
endDate,
accountId: accountId && typeof accountId === "string" ? accountId : undefined,
includeIncome: typeof includeIncome === "boolean" ? includeIncome : false,
};
}
}