toolmenu 0.7.1 → 0.9.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/snapshot.js CHANGED
@@ -1,11 +1,15 @@
1
1
  import { connect, listTools } from './connect.js';
2
2
  import { buildMenu } from './menu.js';
3
+ import { isContainerWrapper, MAIN_SEED, probeVariance, seeded } from './probe.js';
3
4
  import { MENU_RULES, runRules } from './rules/index.js';
4
5
  /** Establish the menu: connect, list the tools twice, run the menu rules. */
5
6
  export async function snapshot(target, options = {}) {
6
- const connection = await connect(target, { timeoutMs: options.timeoutMs });
7
+ const connection = await connect(seeded(target, MAIN_SEED), { timeoutMs: options.timeoutMs });
8
+ let menu;
9
+ let secondList;
10
+ let first;
7
11
  try {
8
- const first = await listTools(connection, options);
12
+ first = await listTools(connection, options);
9
13
  const second = await listTools(connection, options);
10
14
  const server = {
11
15
  name: connection.server.name,
@@ -13,22 +17,8 @@ export async function snapshot(target, options = {}) {
13
17
  protocolVersion: connection.protocolVersion,
14
18
  era: connection.era,
15
19
  };
16
- const menu = buildMenu(first.tools, server, first.listMeta);
17
- const secondMenu = buildMenu(second.tools, server, second.listMeta);
18
- const findings = runRules(MENU_RULES, {
19
- menu,
20
- secondList: secondMenu.tools,
21
- pages: first.pages,
22
- clientError: first.clientError,
23
- protocolVersion: connection.protocolVersion,
24
- era: connection.era,
25
- capabilities: connection.capabilities,
26
- usedAuth: connection.usedAuth,
27
- routes: options.routes,
28
- descriptionLimit: options.descriptionLimit,
29
- fullDescriptions: options.fullDescriptions,
30
- }, options);
31
- return { menu, findings };
20
+ menu = buildMenu(first.tools, server, first.listMeta);
21
+ secondList = buildMenu(second.tools, server, second.listMeta).tools;
32
22
  }
33
23
  catch (error) {
34
24
  const stderr = connection.stderr().trim();
@@ -39,4 +29,24 @@ export async function snapshot(target, options = {}) {
39
29
  finally {
40
30
  await connection.close().catch(() => { });
41
31
  }
32
+ // After the main process has exited: a server that holds a file or a port
33
+ // shouldn't have to share it with its own probe.
34
+ const probes = await probeVariance(target, menu.tools, options.processes ?? 2, options.timeoutMs ?? 30_000);
35
+ const findings = runRules(MENU_RULES, {
36
+ menu,
37
+ secondList,
38
+ pages: first.pages,
39
+ clientError: first.clientError,
40
+ protocolVersion: connection.protocolVersion,
41
+ era: connection.era,
42
+ capabilities: connection.capabilities,
43
+ usedAuth: connection.usedAuth,
44
+ routes: options.routes,
45
+ descriptionLimit: options.descriptionLimit,
46
+ fullDescriptions: options.fullDescriptions,
47
+ transport: target.kind,
48
+ probes,
49
+ wrapper: isContainerWrapper(target),
50
+ }, options);
51
+ return { menu, findings };
42
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolmenu",
3
- "version": "0.7.1",
3
+ "version": "0.9.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",