UNPKG

actual-mcp

Version:

Actual Budget MCP server exposing API functionality

31 lines 1.08 kB
// ---------------------------- // GET ACCOUNTS TOOL // ---------------------------- import { successWithJson, errorFromCatch } from '../../utils/response.js'; import { fetchAllAccounts } from '../../core/data/fetch-accounts.js'; import { z } from 'zod'; import { zodToJsonSchema } from 'zod-to-json-schema'; // Define an empty schema with zod const GetAccountsArgsSchema = z.object({}); export const schema = { name: 'get-accounts', description: 'Retrieve a list of all accounts with their current balance and ID.', inputSchema: zodToJsonSchema(GetAccountsArgsSchema), }; export async function handler() { try { const accounts = await fetchAllAccounts(); const structured = accounts.map((account) => ({ id: account.id, name: account.name, type: account.type || 'Account', closed: account.closed, offBudget: account.offbudget, })); return successWithJson(structured); } catch (err) { return errorFromCatch(err); } } //# sourceMappingURL=index.js.map