Files
AtreidesAssetsFree/server/mcp/tools.mjs
T

74 lines
2.9 KiB
JavaScript
Raw Permalink Normal View History

2026-10-29 11:57:29 +01:00
// Generated, do not edit. sha256:31e7aeb1ea48c942e3f7c7a1b1a04f9c89a81975a5bc92fbc88810da09fb4d6c
import { CONFIG } from '../../shared/config.js';
import { assertScope } from '../ai/gate.js';
import { precisionSettings } from '../ai/precision.js';
import { activeName } from '../portfolios.mjs';
import { READ_TOOLS } from './read-tools.mjs';
import { DETAIL_TOOLS } from './detail-tool.mjs';
import { PLACES_TOOLS } from './places-tool.mjs';
import { CONTROL_TOOLS } from './control-tools.mjs';
import { WRITE_TOOLS } from './write-tools.mjs';
import { WEALTH_TOOLS } from './wealth-tool.mjs';
import { PRICE_TOOLS } from './price-tool.mjs';
import { mcpTools } from '../registers.mjs';
const NOTE_MAX = 200;
export const TOOLS = Object.freeze([
...READ_TOOLS,
...DETAIL_TOOLS,
...PLACES_TOOLS,
...WEALTH_TOOLS,
...PRICE_TOOLS,
...CONTROL_TOOLS,
...WRITE_TOOLS,
Object.freeze({
name: 'connection_test',
title: 'Verbinding testen',
description:
'Controleert of de verbinding met AssetApp werkt. Deze tool leest geen gegevens uit het '
+ 'portfolio en verandert er niets aan: hij bevestigt alleen dat het bericht is aangekomen en '
+ 'legt de aanroep vast in het activiteitenlogboek van de app, waar de eigenaar hem terugvindt.',
inputSchema: Object.freeze({
type: 'object',
properties: {
note: {
type: 'string',
maxLength: NOTE_MAX,
description: 'Optionele korte notitie die in het logboek van de app komt te staan.',
},
},
additionalProperties: false,
}),
scope: 'none',
async run(args) {
assertScope('none');
const note = typeof args?.note === 'string' ? args.note.slice(0, NOTE_MAX) : null;
const portefeuille = activeName();
const onbewerkt = precisionSettings().rawValues;
return {
text: [
`Verbinding met ${CONFIG.AI.SERVER_NAME} werkt.`,
`Open portefeuille: ${portefeuille}.`,
onbewerkt
? 'Onbewerkt delen staat AAN voor deze portefeuille: namen en bedragen komen ongefilterd '
+ 'terug, zonder verwijzingen en marges. Dat hoort alleen zo te zijn in een portefeuille '
+ 'zonder echte gegevens.'
: 'Namen en bedragen komen als verwijzing en marge terug, niet als echte waarde.',
'Er zijn geen portfolio-gegevens opgevraagd of gewijzigd.',
note
? `De notitie "${note}" staat nu in het activiteitenlogboek van de app.`
: 'Deze aanroep staat nu in het activiteitenlogboek van de app, zonder notitie.',
].join('\n'),
fieldsShared: ['portfolio'],
};
},
}),
]);
export function allTools() {
const extra = mcpTools.list().map(e => e.tool);
const dubbel = extra.find(t => TOOLS.some(c => c.name === t.name));
if (dubbel) throw new Error(`mcp tool '${dubbel.name}' is registered and also a core tool`);
return Object.freeze([...TOOLS, ...extra]);
}