toolmenu 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/session.d.ts CHANGED
@@ -54,6 +54,16 @@ export interface SessionResult {
54
54
  connectionCheck?: 'same' | 'different';
55
55
  steps: StepRecord[];
56
56
  findings: Finding[];
57
+ /**
58
+ * Every tool the session saw, in the order first seen, each as last seen: the
59
+ * menu to diff between releases when tools only appear after an unlock.
60
+ */
61
+ union: Menu;
62
+ /** With --auto: which tools were called, and which weren't and why. */
63
+ auto?: {
64
+ called: string[];
65
+ skipped: import('./auto.js').AutoPlan['skipped'];
66
+ };
57
67
  }
58
68
  export interface SessionOptions {
59
69
  timeoutMs?: number;
package/dist/session.js CHANGED
@@ -2,7 +2,7 @@ import { readFile } from 'node:fs/promises';
2
2
  import { parse } from 'yaml';
3
3
  import { cacheBreak, compareMenus } from './compare.js';
4
4
  import { connect, listTools } from './connect.js';
5
- import { buildMenu } from './menu.js';
5
+ import { buildMenu, toolDefinition } from './menu.js';
6
6
  import { isContainerWrapper, MAIN_SEED, probeMenu, probeVariance, seeded } from './probe.js';
7
7
  import { varianceFinding } from './rules/determinism.js';
8
8
  import { classifyFailure, FAILURE_LABELS, SETUP_FAILURES } from './failures.js';
@@ -86,6 +86,10 @@ export async function session(target, scenario, options = {}) {
86
86
  }
87
87
  const menuOf = async (c) => buildMenu((await listTools(c, { timeoutMs })).tools, serverOf(c));
88
88
  let current = await menuOf(conn);
89
+ // Map keeps first-insertion order; set() on a known name updates it in place.
90
+ const seen = new Map();
91
+ const see = (menu) => menu.tools.forEach((t) => seen.set(t.name, t));
92
+ see(current);
89
93
  const baseline = current;
90
94
  // Fresh processes or connections, same credentials, must see the same menu.
91
95
  let connectionCheck;
@@ -210,6 +214,7 @@ export async function session(target, scenario, options = {}) {
210
214
  raw.push(...scopeFindings(record.scope, modern, index));
211
215
  }
212
216
  current = next;
217
+ see(next);
213
218
  }
214
219
  record.listChanged = conn.wire.notificationsSince(mark, LIST_CHANGED);
215
220
  record.tools = current.tools.length;
@@ -227,6 +232,7 @@ export async function session(target, scenario, options = {}) {
227
232
  connectionCheck,
228
233
  steps,
229
234
  findings: settle(mergeSideEffects(raw), options),
235
+ union: buildMenu([...seen.values()].map(toolDefinition), baseline.server),
230
236
  };
231
237
  }
232
238
  finally {
@@ -1,5 +1,6 @@
1
1
  import { type Target } from './connect.js';
2
2
  import { type RuleSettings } from './rules/index.js';
3
+ import { type CatalogOptions } from './catalog.js';
3
4
  import type { Routes } from './routes.js';
4
5
  import type { Finding, Menu } from './types.js';
5
6
  export interface SnapshotOptions extends RuleSettings {
@@ -12,6 +13,8 @@ export interface SnapshotOptions extends RuleSettings {
12
13
  * included. Default 2; 1 turns the check off.
13
14
  */
14
15
  processes?: number;
16
+ /** Also read the operations behind a catalog search tool (true, or which tool and queries). */
17
+ catalog?: boolean | CatalogOptions;
15
18
  }
16
19
  export interface SnapshotResult {
17
20
  menu: Menu;
package/dist/snapshot.js CHANGED
@@ -2,6 +2,7 @@ import { connect, listTools } from './connect.js';
2
2
  import { buildMenu } from './menu.js';
3
3
  import { isContainerWrapper, MAIN_SEED, probeVariance, seeded } from './probe.js';
4
4
  import { MENU_RULES, runRules } from './rules/index.js';
5
+ import { readCatalog } from './catalog.js';
5
6
  /** Establish the menu: connect, list the tools twice, run the menu rules. */
6
7
  export async function snapshot(target, options = {}) {
7
8
  const connection = await connect(seeded(target, MAIN_SEED), { timeoutMs: options.timeoutMs });
@@ -19,6 +20,9 @@ export async function snapshot(target, options = {}) {
19
20
  };
20
21
  menu = buildMenu(first.tools, server, first.listMeta);
21
22
  secondList = buildMenu(second.tools, server, second.listMeta).tools;
23
+ if (options.catalog) {
24
+ menu.catalog = await readCatalog(connection, menu.tools, { ...(typeof options.catalog === 'object' ? options.catalog : {}), timeoutMs: options.timeoutMs });
25
+ }
22
26
  }
23
27
  catch (error) {
24
28
  const stderr = connection.stderr().trim();
package/dist/types.d.ts CHANGED
@@ -46,4 +46,6 @@ export interface Menu {
46
46
  ttlMs?: number;
47
47
  cacheScope?: string;
48
48
  };
49
+ /** Operations behind a search tool (snapshot --catalog). Not part of the menu or its tokens. */
50
+ catalog?: import('./catalog.js').Catalog;
49
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolmenu",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Lint your MCP server's tool menu for changes that confuse agents or break caches.",
5
5
  "author": "Niksa (https://niksa.me)",
6
6
  "main": "dist/index.js",