actual-mcp
Version:
Actual Budget MCP server exposing API functionality
47 lines • 1.44 kB
JavaScript
// ----------------------------
// UPDATE PAYEE TOOL
// ----------------------------
import { successWithJson, errorFromCatch } from '../../../utils/response.js';
import { updatePayee } from '../../../actual-api.js';
export const schema = {
name: 'update-payee',
description: 'Update a payee',
inputSchema: {
type: 'object',
properties: {
id: {
type: 'string',
description: 'ID of the payee. Should be in UUID format.',
},
name: {
type: 'string',
description: 'New name for the payee',
},
transferAccount: {
type: 'string',
description: 'New ID for the transfer account. Should be in UUID format.',
},
},
required: ['id'],
},
};
export async function handler(args) {
try {
if (!args.id || typeof args.id !== 'string') {
return errorFromCatch('id is required and must be a string');
}
const data = {};
if (args.name) {
data.name = args.name;
}
if (args.transferAccount) {
data.transfer_acct = args.transferAccount;
}
await updatePayee(args.id, data);
return successWithJson('Successfully updated payee ' + args.id);
}
catch (err) {
return errorFromCatch(err);
}
}
//# sourceMappingURL=index.js.map