fix(ui): send trace_path direction and depth in the server's vocabulary

RpcIntelligenceClient.tracePath sent direction "callers"/"callees" and
"max_depth", but the trace_path schema in src/mcp/mcp.c accepts
"inbound"/"outbound"/"both" and "depth". The server therefore ignored both
arguments and always traced with its defaults. The client now takes and
sends the schema's names.

Signed-off-by: Bernhard Jackiewicz <bj@techport.io>
This commit is contained in:
Bernhard Jackiewicz
2026-10-02 18:48:14 +02:00
parent 0b03df4c27
commit 69b2ac6b59
2 changed files with 17 additions and 2 deletions
+10
View File
@@ -237,6 +237,16 @@ describe('die Werkzeuge, die erst auf Bitte JSON liefern', () => {
expect(result.callers).toHaveLength(1);
});
it('spricht Richtung und Tiefe in den Woertern des trace_path-Schemas', async () => {
const { client: c, rpc } = client([{ tool: 'trace_path', json: { function: 'createUser', direction: 'inbound' } }]);
await c.tracePath(RECORDED_PROJECT, 'createUser', { direction: 'inbound', depth: 2 });
expect(rpc.calls[0].args).toMatchObject({ function_name: 'createUser', direction: 'inbound', depth: 2 });
expect(rpc.calls[0].args).not.toHaveProperty('max_depth');
await c.tracePath(RECORDED_PROJECT, 'createUser');
expect(rpc.calls[1].args).not.toHaveProperty('direction');
expect(rpc.calls[1].args).not.toHaveProperty('depth');
});
it('gibt die Ablehnung wegen Mehrdeutigkeit als Antwort weiter, nicht als Fehler', async () => {
const { client: c } = client([{
tool: 'trace_path',
+7 -2
View File
@@ -331,17 +331,22 @@ export class RpcIntelligenceClient {
* Pfade von einem Symbol aus laufen. Liefert die Vereinigung: eine
* Ablehnung wegen Mehrdeutigkeit ist hier eine normale Antwort, kein
* Fehler.
*
* Richtung und Tiefe in den Woertern des Servers (src/mcp/mcp.c,
* `trace_path`): `inbound`/`outbound`/`both` und `depth`. Bis zum Review
* vom 2026-10-02 gingen hier `callers`/`callees` und `max_depth` hinaus,
* und beides kennt das Schema nicht.
*/
async tracePath(
project: string,
functionName: string,
args: { direction?: 'callers' | 'callees' | 'both'; maxDepth?: number } = {},
args: { direction?: 'inbound' | 'outbound' | 'both'; depth?: number } = {},
): Promise<PathResult> {
return readPathResult(await this.json('trace_path', {
project,
function_name: functionName,
...(args.direction ? { direction: args.direction } : {}),
...(args.maxDepth !== undefined ? { max_depth: args.maxDepth } : {}),
...(args.depth !== undefined ? { depth: args.depth } : {}),
}));
}