toolmenu 0.18.0 → 0.20.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/README.md +17 -5
- package/dist/cli.js +10 -3
- package/dist/clients.d.ts +7 -1
- package/dist/clients.js +29 -6
- package/dist/config.d.ts +2 -0
- package/dist/config.js +6 -2
- package/dist/diff.js +90 -0
- package/dist/help.js +2 -1
- package/dist/lists.d.ts +40 -0
- package/dist/lists.js +91 -0
- package/dist/options.d.ts +3 -0
- package/dist/options.js +1 -0
- package/dist/report.d.ts +1 -1
- package/dist/report.js +19 -1
- package/dist/rules/clients.js +2 -2
- package/dist/rules/description.js +1 -1
- package/dist/rules/index.js +3 -0
- package/dist/rules/lists.d.ts +16 -0
- package/dist/rules/lists.js +102 -0
- package/dist/rules/rule.d.ts +2 -0
- package/dist/rules/search.js +2 -2
- package/dist/rules/spec.d.ts +2 -0
- package/dist/rules/spec.js +17 -8
- package/dist/snapshot.d.ts +5 -0
- package/dist/snapshot.js +33 -2
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,7 +23,15 @@ connections and releases, and checks **when** it changes:
|
|
|
23
23
|
It also checks the menu clients will actually show: a broken `x-mcp-header` or a
|
|
24
24
|
`$ref` they can't resolve hides a tool or fails every call to it. And when a tool
|
|
25
25
|
stops to ask the user something, `session` answers "no" and says whether the tool
|
|
26
|
-
can take it.
|
|
26
|
+
can take it. Handles a server mints (`session_id`) should say how long they last and
|
|
27
|
+
fail readably when unknown; menus that differ by who asks (`--as`) shouldn't be
|
|
28
|
+
cached as public; prompts and resources (`--lists`) are checked like tools. Run
|
|
29
|
+
against the reference server, `@modelcontextprotocol/server-everything` 2.1.0, with
|
|
30
|
+
no false findings ([bench/](bench/README.md)).
|
|
31
|
+
- **For your client.** `--client claude-code | claude-api-search | openai` checks the
|
|
32
|
+
menu the way that client loads it, from its own docs: what it costs up front and per
|
|
33
|
+
tool a search loads, where it cuts descriptions, what its search can find, and names
|
|
34
|
+
its API refuses.
|
|
27
35
|
- **Between releases.** `diff` finds breaking changes and token growth, and checks
|
|
28
36
|
the version bump.
|
|
29
37
|
|
|
@@ -247,9 +255,9 @@ the way OpenAPI breaking-change checkers do it:
|
|
|
247
255
|
|
|
248
256
|
| Class | Changes | Rules |
|
|
249
257
|
|---|---|---|
|
|
250
|
-
| **breaking** (error) | tool removed or renamed, parameter removed, new required parameter, narrower or different type, enum narrowed, unlisted properties now rejected (`additionalProperties: false` added), a tool becoming less safe (no longer read-only, or additive → destructive) | `diff/tool-removed`, `diff/tool-renamed`, `diff/param-removed`, `diff/param-required`, `diff/param-type`, `diff/enum-narrowed`, `diff/properties-closed`, `diff/safety-hint` |
|
|
251
|
-
| **minor** (info) | tool added, new optional parameter, parameter now optional, type or enum widened, unlisted properties now accepted (`additionalProperties: false` removed) | `diff/tool-added`, `diff/param-added`, `diff/param-relaxed`, `diff/type-widened`, `diff/enum-widened`, `diff/properties-opened` |
|
|
252
|
-
| **notice** (info) | optional parameter dropped (extra properties still allowed), description changed (with the text diff: it changes what the agent does), output schema, annotations, other fields, order, a schema restructured but accepting the same input, only the declared `$schema` dialect changed | `diff/param-dropped`, `diff/description`, `diff/schema-other`, `diff/annotations`, `diff/other`, `diff/order`, `diff/schema-equivalent`, `diff/schema-dialect` |
|
|
258
|
+
| **breaking** (error) | tool removed or renamed, parameter removed, new required parameter, narrower or different type, enum narrowed, unlisted properties now rejected (`additionalProperties: false` added), a tool becoming less safe (no longer read-only, or additive → destructive); with `--lists` on both sides, a prompt removed or newly requiring an argument, a resource template removed | `diff/tool-removed`, `diff/tool-renamed`, `diff/param-removed`, `diff/param-required`, `diff/param-type`, `diff/enum-narrowed`, `diff/properties-closed`, `diff/safety-hint`, `diff/prompt-removed`, `diff/prompt-argument-required`, `diff/resource-template-removed` |
|
|
259
|
+
| **minor** (info) | tool added, new optional parameter, parameter now optional, type or enum widened, unlisted properties now accepted (`additionalProperties: false` removed), a prompt or resource template added | `diff/tool-added`, `diff/param-added`, `diff/param-relaxed`, `diff/type-widened`, `diff/enum-widened`, `diff/properties-opened`, `diff/prompt-added`, `diff/resource-template-added` |
|
|
260
|
+
| **notice** (info) | optional parameter dropped (extra properties still allowed), description changed (with the text diff: it changes what the agent does), output schema, annotations, other fields, order, a schema restructured but accepting the same input, only the declared `$schema` dialect changed, a prompt's description or optional arguments, resources added or gone (data, so no bump) | `diff/param-dropped`, `diff/description`, `diff/schema-other`, `diff/annotations`, `diff/other`, `diff/order`, `diff/schema-equivalent`, `diff/schema-dialect`, `diff/prompt-changed`, `diff/resources` |
|
|
253
261
|
|
|
254
262
|
The same rules apply inside parameters: fields of an object parameter, array items,
|
|
255
263
|
and the options of an `anyOf`/`oneOf` union (zod's unions, discriminated unions and
|
|
@@ -394,6 +402,8 @@ server, or from the spec itself. If a rule can't point to one, it doesn't ship.
|
|
|
394
402
|
| `write/no-dry-run` | info | Destructive tools with no dry-run parameter or preview tool, as one summary |
|
|
395
403
|
| `spec/discover` | info | The server only speaks the 2025 protocol, so 2026-07-28 rules are skipped |
|
|
396
404
|
| `spec/deprecated`, `spec/cache-hints` | info | 2026-07-28: deprecated features still advertised; `ttlMs: 0`, or `cacheScope: "public"` on a server that took credentials |
|
|
405
|
+
| `lists/variance` | warn | With `--lists`: `prompts/list`, `resources/list` or `resources/templates/list` differs between two calls, or from a second process or connection (2026-07-28: lists no longer vary per connection) |
|
|
406
|
+
| `lists/schema` | error | With `--lists`: a list result that doesn't match the official schema (2026-07-28 requires `ttlMs` and `cacheScope` on each), or a declared list that fails to answer (warn; info for Method not found, or a setup failure such as missing credentials) |
|
|
397
407
|
| `naming/client-name` | warn | With `--client`: tool names the client's API refuses: `^[a-zA-Z0-9_-]{1,128}$` for the Claude API, `^[a-zA-Z0-9_-]+$` up to 128 for OpenAI's functions. MCP allows names such as `files.read` that neither takes as they are |
|
|
398
408
|
| `menu/auth-variance` | info | With `--as` (or `identities` in the config): the tool set differs by identity, what each adds, lacks or defines differently against the first, and its tokens. Allowed by the spec; a baseline of one identity's menu doesn't cover the others. An identity that can't be listed is said here too |
|
|
399
409
|
| `spec/cache-scope-public` | warn | 2026-07-28, with `--as`: the tool set differs by identity, and `tools/list` says `cacheScope: "public"`, which lets shared caches serve one caller's list to another |
|
|
@@ -455,7 +465,7 @@ client doesn't document is left out, not guessed.
|
|
|
455
465
|
|---|---|---|---|---|
|
|
456
466
|
| `claude-code` | tool names; full definitions for tools marked `_meta["anthropic/alwaysLoad"]` | reads a description up to 4,096 characters | 16,384 through search, 4,096 up front | Claude API's |
|
|
457
467
|
| `claude-api-search` | nothing from tools you defer (keep the 3–5 used most loaded) | name, description, argument names and descriptions; 5 results by default | none documented | `^[a-zA-Z0-9_-]{1,128}$` |
|
|
458
|
-
| `openai` |
|
|
468
|
+
| `openai` | each deferred function's name and description (its schema loads on demand); a deferred MCP server shows only its own name and description | how many results, and which fields, isn't documented, so `search/findable` doesn't run | none documented | `^[a-zA-Z0-9_-]+$`, up to 128 |
|
|
459
469
|
|
|
460
470
|
The snapshot adds a line such as `as Claude Code: up front ~524 tokens · on demand ~344
|
|
461
471
|
per tool a search loads (largest: update_contacts, ~2,093)`, and `--json` a `client`
|
|
@@ -493,6 +503,8 @@ toolmenu sees what the server sends. Plenty of agent failures happen elsewhere:
|
|
|
493
503
|
(2026-07-28 only; an error if the server lacks it)
|
|
494
504
|
--processes <n> server processes or connections to compare (default: 2);
|
|
495
505
|
1 opens no second one, session's scope check included
|
|
506
|
+
--lists <kinds> snapshot: also read and check prompts, resources (comma-separated);
|
|
507
|
+
saved in the menu file beside the tools
|
|
496
508
|
--client <name> snapshot: check the menu for one client, from its own docs:
|
|
497
509
|
claude-code, claude-api-search or openai
|
|
498
510
|
--as <name>:<cred> snapshot: list the menu as this identity too, repeatable:
|
package/dist/cli.js
CHANGED
|
@@ -3,6 +3,7 @@ import { writeFile } from 'node:fs/promises';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { parseArgs } from 'node:util';
|
|
5
5
|
import { CLIENT_NAMES, CLIENTS } from './clients.js';
|
|
6
|
+
import { LIST_WORDS } from './lists.js';
|
|
6
7
|
import { loadConfig } from './config.js';
|
|
7
8
|
import { ELICITATIONS, PROTOCOLS } from './connect.js';
|
|
8
9
|
import { diffMenus } from './diff.js';
|
|
@@ -83,9 +84,15 @@ export async function main(argv) {
|
|
|
83
84
|
const elicitation = (values.elicitation ?? 'decline');
|
|
84
85
|
if (!ELICITATIONS.includes(elicitation))
|
|
85
86
|
throw new UsageError('--elicitation must be decline or cancel');
|
|
87
|
+
if (values.lists !== undefined && sub !== 'snapshot')
|
|
88
|
+
throw new UsageError('--lists goes with snapshot.');
|
|
89
|
+
const lists = values.lists !== undefined ? values.lists.split(',').map((w) => w.trim()).filter(Boolean) : config.lists;
|
|
90
|
+
const badList = (lists ?? []).find((w) => !LIST_WORDS.includes(w));
|
|
91
|
+
if (badList)
|
|
92
|
+
throw new UsageError(`--lists takes ${LIST_WORDS.join(', ')}, comma-separated; not "${badList}"`);
|
|
86
93
|
if (values.client !== undefined && sub !== 'snapshot')
|
|
87
94
|
throw new UsageError('--client goes with snapshot.');
|
|
88
|
-
if (values.client !== undefined && !(values.client
|
|
95
|
+
if (values.client !== undefined && !Object.hasOwn(CLIENTS, values.client))
|
|
89
96
|
throw new UsageError(`--client must be one of ${CLIENT_NAMES.join(', ')}`);
|
|
90
97
|
if (values.as !== undefined && sub !== 'snapshot')
|
|
91
98
|
throw new UsageError('--as goes with snapshot: it lists the menu once per identity.');
|
|
@@ -306,11 +313,11 @@ export async function main(argv) {
|
|
|
306
313
|
const routesPath = values.routes ?? config.routes;
|
|
307
314
|
const routes = routesPath ? await loadRoutes(routesPath) : undefined;
|
|
308
315
|
const client = values.client ?? config.client;
|
|
309
|
-
const { menu, findings, cost } = await snapshot(target, { routes, timeoutMs, processes, identities, client, catalog: values.catalog ? (config.catalog ?? true) : undefined, rules: config.rules, ignore: config.ignore, descriptionLimit: config.descriptionLimit, fullDescriptions: config.fullDescriptions });
|
|
316
|
+
const { menu, findings, cost, notOffered } = await snapshot(target, { routes, timeoutMs, processes, identities, client, lists, catalog: values.catalog ? (config.catalog ?? true) : undefined, rules: config.rules, ignore: config.ignore, descriptionLimit: config.descriptionLimit, fullDescriptions: config.fullDescriptions });
|
|
310
317
|
const outPath = values['no-write'] ? undefined : values.out ?? 'menu.json';
|
|
311
318
|
if (outPath)
|
|
312
319
|
await writeFile(outPath, JSON.stringify(menu, null, 2) + '\n');
|
|
313
|
-
const output = formatSnapshot(menu, findings, format, outPath, cost);
|
|
320
|
+
const output = formatSnapshot(menu, findings, format, outPath, cost, notOffered);
|
|
314
321
|
if (output)
|
|
315
322
|
process.stdout.write(output + '\n');
|
|
316
323
|
return findings.some((f) => SEVERITY_RANK[f.severity] >= SEVERITY_RANK[failOn]) ? 1 : 0;
|
package/dist/clients.d.ts
CHANGED
|
@@ -14,7 +14,11 @@ export interface ClientProfile {
|
|
|
14
14
|
*/
|
|
15
15
|
defers: Sourced<'all' | 'chosen' | 'none'>;
|
|
16
16
|
/** What the model has of a deferred tool before it searches: its name, or nothing. */
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* What the model has of a deferred tool before it searches: its name, nothing, or its
|
|
19
|
+
* name and description (OpenAI defers the parameter schema).
|
|
20
|
+
*/
|
|
21
|
+
beforeSearch?: Sourced<'name' | 'nothing' | 'name-and-description'>;
|
|
18
22
|
/** Where the client cuts a description: for a tool loaded up front, and one loaded through search. */
|
|
19
23
|
descriptionCut?: Sourced<{
|
|
20
24
|
upfront: number;
|
|
@@ -37,6 +41,8 @@ export interface ClientProfile {
|
|
|
37
41
|
}
|
|
38
42
|
export declare const CLIENTS: Record<string, ClientProfile>;
|
|
39
43
|
export declare const CLIENT_NAMES: string[];
|
|
44
|
+
/** A client's profile by name: own keys only ("toString" names no client). */
|
|
45
|
+
export declare function profileOf(name: string | undefined): ClientProfile | undefined;
|
|
40
46
|
/** The profile for a client name, or undefined for none given. Throws for an unknown name. */
|
|
41
47
|
export declare function clientProfile(name: string | undefined): ClientProfile | undefined;
|
|
42
48
|
/** Whether a tool name fits the client's API, and why not. */
|
package/dist/clients.js
CHANGED
|
@@ -9,6 +9,7 @@ const CLAUDE_CODE_MCP = 'https://code.claude.com/docs/en/mcp';
|
|
|
9
9
|
const CLAUDE_TOOL_SEARCH = 'https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool';
|
|
10
10
|
const CLAUDE_DEFINE_TOOLS = 'https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools';
|
|
11
11
|
const OPENAI_SPEC = 'https://github.com/openai/openai-openapi (openapi.yaml: FunctionToolParam, NamespaceToolParam, MCPTool)';
|
|
12
|
+
const OPENAI_TOOL_SEARCH = 'https://developers.openai.com/api/docs/guides/tools-tool-search';
|
|
12
13
|
const READ = '2026-11-02';
|
|
13
14
|
const claudeName = { value: { pattern: '^[a-zA-Z0-9_-]{1,128}$', max: 128, api: 'the Claude API' }, source: CLAUDE_DEFINE_TOOLS, read: READ };
|
|
14
15
|
export const CLIENTS = {
|
|
@@ -42,16 +43,26 @@ export const CLIENTS = {
|
|
|
42
43
|
label: "OpenAI's tool_search (Responses API)",
|
|
43
44
|
// FunctionToolParam.defer_loading, MCPTool.defer_loading: per function, or per MCP server.
|
|
44
45
|
defers: { value: 'chosen', source: OPENAI_SPEC, read: READ },
|
|
46
|
+
// "For an individual deferred function, the model still sees the function name and description,
|
|
47
|
+
// so in practice tool search is mostly deferring the parameter schema." For an MCP server or
|
|
48
|
+
// namespace, "the model sees only the namespace or server name and description at the beginning".
|
|
49
|
+
beforeSearch: { value: 'name-and-description', source: OPENAI_TOOL_SEARCH, read: '2026-11-03' },
|
|
50
|
+
// Not in the guide or the spec: how many tools a search returns, and which fields it matches on.
|
|
51
|
+
// So search/findable doesn't rank for OpenAI.
|
|
45
52
|
// FunctionToolParam.name: maxLength 128, pattern ^[a-zA-Z0-9_-]+$.
|
|
46
53
|
namePattern: { value: { pattern: '^[a-zA-Z0-9_-]+$', max: 128, api: "OpenAI's Responses API" }, source: OPENAI_SPEC, read: READ },
|
|
47
54
|
},
|
|
48
55
|
};
|
|
49
56
|
export const CLIENT_NAMES = Object.keys(CLIENTS);
|
|
57
|
+
/** A client's profile by name: own keys only ("toString" names no client). */
|
|
58
|
+
export function profileOf(name) {
|
|
59
|
+
return name !== undefined && Object.hasOwn(CLIENTS, name) ? CLIENTS[name] : undefined;
|
|
60
|
+
}
|
|
50
61
|
/** The profile for a client name, or undefined for none given. Throws for an unknown name. */
|
|
51
62
|
export function clientProfile(name) {
|
|
52
63
|
if (name === undefined)
|
|
53
64
|
return undefined;
|
|
54
|
-
const profile =
|
|
65
|
+
const profile = profileOf(name);
|
|
55
66
|
if (!profile)
|
|
56
67
|
throw new Error(`unknown client "${name}": one of ${CLIENT_NAMES.join(', ')}`);
|
|
57
68
|
return profile;
|
|
@@ -75,21 +86,33 @@ export function loadsUpfront(tool) {
|
|
|
75
86
|
}
|
|
76
87
|
/** What the menu costs under a client that defers tools: up front, and per tool a search loads. */
|
|
77
88
|
export function clientCost(name, menu) {
|
|
78
|
-
const profile =
|
|
89
|
+
const profile = profileOf(name);
|
|
79
90
|
if (!profile || profile.defers.value === 'none')
|
|
80
91
|
return undefined;
|
|
81
92
|
const loaded = profile.defers.value === 'all' ? menu.tools.filter(loadsUpfront) : [];
|
|
82
93
|
const deferred = menu.tools.filter((t) => !loaded.includes(t));
|
|
83
|
-
const perTool = deferred.length ? Math.round(deferred.reduce((n, t) => n + t.tokens, 0) / deferred.length) : 0;
|
|
84
|
-
const largest = [...deferred].sort((a, b) => b.tokens - a.tokens)[0];
|
|
85
94
|
const loadedTokens = loaded.reduce((n, t) => n + t.tokens, 0);
|
|
86
95
|
const seen = profile.beforeSearch?.value;
|
|
87
|
-
|
|
96
|
+
// OpenAI keeps a deferred function's name and description up front: what a search adds is the rest.
|
|
97
|
+
const seenUpfront = (t) => countTokens(`${t.name}\n${t.description ?? ''}`);
|
|
98
|
+
const upfront = seen === 'name'
|
|
99
|
+
? countTokens(deferred.map((t) => t.name).join('\n')) + loadedTokens
|
|
100
|
+
: seen === 'nothing'
|
|
101
|
+
? loadedTokens
|
|
102
|
+
: seen === 'name-and-description'
|
|
103
|
+
? deferred.reduce((n, t) => n + seenUpfront(t), 0) + loadedTokens
|
|
104
|
+
: undefined;
|
|
105
|
+
const onDemand = (t) => (seen === 'name-and-description' ? Math.max(0, t.tokens - seenUpfront(t)) : t.tokens);
|
|
88
106
|
const basis = seen === 'name'
|
|
89
107
|
? `${profile.label} defers MCP tools and shows their names until a search loads one; the server's instructions load up front too and aren't counted here (${profile.beforeSearch.source}, read ${profile.beforeSearch.read})`
|
|
90
108
|
: seen === 'nothing'
|
|
91
109
|
? `with every tool deferred, the model sees none of them until a search loads one, and the docs advise keeping the 3–5 tools used most loaded (${profile.beforeSearch.source}, read ${profile.beforeSearch.read})`
|
|
92
|
-
:
|
|
110
|
+
: seen === 'name-and-description'
|
|
111
|
+
? `deferred as functions, each tool's name and description stay up front and its schema loads on demand; deferred as one MCP server, the model sees only the server's name and description (set where the server is added) until a search loads its tools (${profile.beforeSearch.source}, read ${profile.beforeSearch.read})`
|
|
112
|
+
: `${profile.label} defers per function or per MCP server; what the model sees before a search isn't documented, so no up-front figure`;
|
|
113
|
+
const perTool = deferred.length ? Math.round(deferred.reduce((n, t) => n + onDemand(t), 0) / deferred.length) : 0;
|
|
114
|
+
const biggest = [...deferred].sort((a, b) => onDemand(b) - onDemand(a))[0];
|
|
115
|
+
const largest = biggest ? { name: biggest.name, tokens: onDemand(biggest) } : undefined;
|
|
93
116
|
return {
|
|
94
117
|
client: name,
|
|
95
118
|
label: profile.label,
|
package/dist/config.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface Config {
|
|
|
26
26
|
headers?: Record<string, string>;
|
|
27
27
|
env?: Record<string, string>;
|
|
28
28
|
}>;
|
|
29
|
+
/** snapshot: which lists to read besides tools: ["prompts", "resources"]. --lists wins. */
|
|
30
|
+
lists?: string[];
|
|
29
31
|
/** snapshot: the client to check the menu for (claude-code, claude-api-search, openai). --client wins. */
|
|
30
32
|
client?: string;
|
|
31
33
|
/** Server processes (stdio) or connections (HTTP) to compare, the main one included (default 2). */
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
3
|
import { CLIENTS } from './clients.js';
|
|
4
|
+
import { LIST_WORDS } from './lists.js';
|
|
4
5
|
import { CLIENT_LIMITS } from './rules/description.js';
|
|
5
6
|
const DEFAULT_PATH = 'toolmenu.config.json';
|
|
6
7
|
/** Optional: no config file is fine. */
|
|
@@ -24,13 +25,16 @@ export async function loadConfig(path) {
|
|
|
24
25
|
throw new Error(`${file}: protocol must be auto, legacy or modern`);
|
|
25
26
|
}
|
|
26
27
|
const limit = config.descriptionLimit;
|
|
27
|
-
if (limit !== undefined && !(typeof limit === 'number' && limit > 0) && !(typeof limit === 'string' && limit
|
|
28
|
+
if (limit !== undefined && !(typeof limit === 'number' && limit > 0) && !(typeof limit === 'string' && Object.hasOwn(CLIENT_LIMITS, limit))) {
|
|
28
29
|
throw new Error(`${file}: descriptionLimit must be a positive number or one of ${Object.keys(CLIENT_LIMITS).join(', ')}`);
|
|
29
30
|
}
|
|
30
31
|
if (config.processes !== undefined && !(Number.isInteger(config.processes) && config.processes >= 1)) {
|
|
31
32
|
throw new Error(`${file}: processes must be a whole number, 1 or more`);
|
|
32
33
|
}
|
|
33
|
-
if (config.
|
|
34
|
+
if (config.lists !== undefined && !(Array.isArray(config.lists) && config.lists.every((l) => LIST_WORDS.includes(l)))) {
|
|
35
|
+
throw new Error(`${file}: lists must be a list of ${LIST_WORDS.join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
if (config.client !== undefined && !(typeof config.client === 'string' && Object.hasOwn(CLIENTS, config.client))) {
|
|
34
38
|
throw new Error(`${file}: client must be one of ${Object.keys(CLIENTS).join(', ')}`);
|
|
35
39
|
}
|
|
36
40
|
if (config.identities !== undefined) {
|
package/dist/diff.js
CHANGED
|
@@ -53,6 +53,17 @@ export const DIFF_RULES = {
|
|
|
53
53
|
'diff/catalog-missing': { severity: 'info' },
|
|
54
54
|
'diff/catalog-added': { severity: 'info' },
|
|
55
55
|
'diff/catalog-queries': { severity: 'info' },
|
|
56
|
+
// snapshot --lists: prompts are called by name like tools, and resource templates are
|
|
57
|
+
// the URIs clients read through. Concrete resources are data (files come and go):
|
|
58
|
+
// counted, no bump. Only compared when both menus read the list.
|
|
59
|
+
'diff/prompt-removed': { severity: 'error', class: 'breaking' },
|
|
60
|
+
'diff/prompt-argument-required': { severity: 'error', class: 'breaking' },
|
|
61
|
+
'diff/prompt-added': { severity: 'info', class: 'minor' },
|
|
62
|
+
'diff/prompt-changed': { severity: 'info', class: 'notice' },
|
|
63
|
+
'diff/resource-template-removed': { severity: 'error', class: 'breaking' },
|
|
64
|
+
'diff/resource-template-added': { severity: 'info', class: 'minor' },
|
|
65
|
+
'diff/resources': { severity: 'info', class: 'notice' },
|
|
66
|
+
'diff/lists-unread': { severity: 'info' },
|
|
56
67
|
};
|
|
57
68
|
/**
|
|
58
69
|
* In fixes: the release a breaking change should ship in. Resolved once the
|
|
@@ -135,6 +146,7 @@ export function diffMenus(before, after, options = {}) {
|
|
|
135
146
|
});
|
|
136
147
|
}
|
|
137
148
|
raw.push(...compareCatalogs(before.catalog, after.catalog, ignored));
|
|
149
|
+
raw.push(...compareLists(before, after));
|
|
138
150
|
// Ignored tools leave the token counts and the budget too.
|
|
139
151
|
const tokens = tokenChange(oldTools, newTools);
|
|
140
152
|
if (options.tokenBudget !== undefined && tokens.after > options.tokenBudget) {
|
|
@@ -1220,6 +1232,84 @@ function expandRefs(schema) {
|
|
|
1220
1232
|
return { schema, expanded: false };
|
|
1221
1233
|
}
|
|
1222
1234
|
}
|
|
1235
|
+
/** The arguments a prompt requires. */
|
|
1236
|
+
function requiredArguments(p) {
|
|
1237
|
+
return (Array.isArray(p.arguments) ? p.arguments : []).filter((a) => a.required === true).map((a) => String(a.name));
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* snapshot --lists: prompts, resource templates and resources between two menus.
|
|
1241
|
+
* A list only one menu read isn't compared (everything would read as added or removed).
|
|
1242
|
+
*/
|
|
1243
|
+
function compareLists(before, after) {
|
|
1244
|
+
const out = [];
|
|
1245
|
+
const unread = [];
|
|
1246
|
+
const pair = (key, label) => {
|
|
1247
|
+
const a = before[key];
|
|
1248
|
+
const b = after[key];
|
|
1249
|
+
if (!a && !b)
|
|
1250
|
+
return undefined;
|
|
1251
|
+
if (!a || !b) {
|
|
1252
|
+
unread.push(`${label} (${a ? 'the old' : 'the new'} menu has them, the ${a ? 'new' : 'old'} one wasn't read with --lists)`);
|
|
1253
|
+
return undefined;
|
|
1254
|
+
}
|
|
1255
|
+
return [a, b];
|
|
1256
|
+
};
|
|
1257
|
+
const prompts = pair('prompts', 'prompts');
|
|
1258
|
+
if (prompts) {
|
|
1259
|
+
const [a, b] = prompts;
|
|
1260
|
+
const oldBy = new Map(a.map((p) => [String(p.name), p]));
|
|
1261
|
+
const newBy = new Map(b.map((p) => [String(p.name), p]));
|
|
1262
|
+
for (const [name] of oldBy) {
|
|
1263
|
+
if (!newBy.has(name))
|
|
1264
|
+
out.push({ rule: 'diff/prompt-removed', message: `Prompt ${code(name)} was removed. Users and clients that invoke it by name (a slash command, a saved workflow) now get an error.`, fix: `Keep ${code(name)} for one release, or ${BREAKING_RELEASE}.` });
|
|
1265
|
+
}
|
|
1266
|
+
for (const [name, p] of newBy) {
|
|
1267
|
+
const old = oldBy.get(name);
|
|
1268
|
+
if (!old) {
|
|
1269
|
+
out.push({ rule: 'diff/prompt-added', message: `Prompt ${code(name)} is new.` });
|
|
1270
|
+
continue;
|
|
1271
|
+
}
|
|
1272
|
+
const required = requiredArguments(p).filter((r) => !requiredArguments(old).includes(r));
|
|
1273
|
+
if (required.length) {
|
|
1274
|
+
out.push({ rule: 'diff/prompt-argument-required', message: `Prompt ${code(name)} now requires ${required.map(code).join(', ')}. Invocations that don't pass ${required.length === 1 ? 'it' : 'them'} now fail.`, fix: `Make ${required.length === 1 ? 'it' : 'them'} optional, or ${BREAKING_RELEASE}.` });
|
|
1275
|
+
}
|
|
1276
|
+
else if (JSON.stringify(old) !== JSON.stringify(p)) {
|
|
1277
|
+
out.push({ rule: 'diff/prompt-changed', message: `Prompt ${code(name)} changed (its description or arguments), and nothing it requires.` });
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
const templates = pair('resourceTemplates', 'resource templates');
|
|
1282
|
+
if (templates) {
|
|
1283
|
+
const [a, b] = templates;
|
|
1284
|
+
const oldSet = new Set(a.map((t) => String(t.uriTemplate)));
|
|
1285
|
+
const newSet = new Set(b.map((t) => String(t.uriTemplate)));
|
|
1286
|
+
for (const t of oldSet)
|
|
1287
|
+
if (!newSet.has(t))
|
|
1288
|
+
out.push({ rule: 'diff/resource-template-removed', message: `Resource template ${code(t)} was removed. Clients that read resources through it now get an error.`, fix: `Keep ${code(t)} for one release, or ${BREAKING_RELEASE}.` });
|
|
1289
|
+
for (const t of newSet)
|
|
1290
|
+
if (!oldSet.has(t))
|
|
1291
|
+
out.push({ rule: 'diff/resource-template-added', message: `Resource template ${code(t)} is new.` });
|
|
1292
|
+
}
|
|
1293
|
+
const resources = pair('resources', 'resources');
|
|
1294
|
+
if (resources) {
|
|
1295
|
+
const [a, b] = resources;
|
|
1296
|
+
const oldSet = new Set(a.map((r) => String(r.uri)));
|
|
1297
|
+
const newSet = new Set(b.map((r) => String(r.uri)));
|
|
1298
|
+
const gone = [...oldSet].filter((u) => !newSet.has(u));
|
|
1299
|
+
const fresh = [...newSet].filter((u) => !oldSet.has(u));
|
|
1300
|
+
if (gone.length || fresh.length) {
|
|
1301
|
+
out.push({
|
|
1302
|
+
rule: 'diff/resources',
|
|
1303
|
+
message: `The resources list changed: ${[fresh.length ? `${fresh.length} new` : '', gone.length ? `${gone.length} gone` : ''].filter(Boolean).join(', ')}. Resources are often data that changes between runs; a resource clients rely on by URI going away is worth a look.`,
|
|
1304
|
+
detail: [...gone.slice(0, 5).map((u) => `gone: ${u}`), ...fresh.slice(0, 5).map((u) => `new: ${u}`), ...(gone.length + fresh.length > 10 ? ['…'] : [])],
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
if (unread.length) {
|
|
1309
|
+
out.push({ rule: 'diff/lists-unread', message: `Not compared: ${unread.join('; ')}.`, fix: 'Snapshot both releases with the same --lists to compare them.' });
|
|
1310
|
+
}
|
|
1311
|
+
return out;
|
|
1312
|
+
}
|
|
1223
1313
|
/** What the operations are behind: the search tool or router by name, or "the command routers" as words. */
|
|
1224
1314
|
function catalogSource(c) {
|
|
1225
1315
|
return (c.routers?.length ?? 0) > 1 ? c.tool : code(c.tool);
|
package/dist/help.js
CHANGED
|
@@ -19,6 +19,7 @@ const OPTIONS = {
|
|
|
19
19
|
env: ['--env <K=V>', ['environment variable for a stdio server, repeatable. The server only', 'gets a minimal environment (PATH, HOME, ...) plus these']],
|
|
20
20
|
protocol: ['--protocol <auto|legacy|modern>', ['which handshake to make (default: auto)', 'legacy: the 2025 handshake only; modern: 2026-07-28 only, an error if the server lacks it']],
|
|
21
21
|
as: ['--as <name>[:<credential>]', ['list the menu as this identity too, repeatable: a header ("reader:Authorization:', 'Bearer ...") or env var ("admin:ROLE=admin") on top of --header/--env. The first', 'is the main one (its menu is saved); the others are compared with it']],
|
|
22
|
+
lists: ['--lists <kinds>', ['which lists to read and check, comma-separated: tools (always),', 'prompts, resources (resources/list and resources/templates/list).', 'Saved in the menu file beside the tools']],
|
|
22
23
|
client: ['--client <name>', ['check the menu for one client, from its own docs: claude-code (tools deferred,', 'its description cut and search), claude-api-search (Claude API tool search)', 'or openai (Responses API tool_search): cost up front and per tool, names it refuses']],
|
|
23
24
|
'no-auth': ['--no-auth', ["don't use a stored OAuth login (toolmenu auth login) for this server"]],
|
|
24
25
|
timeout: ['--timeout <ms>', ['per-request timeout (default: 30000)']],
|
|
@@ -79,7 +80,7 @@ const HELP = {
|
|
|
79
80
|
'reports what in the menu confuses agents or breaks prompt caches.',
|
|
80
81
|
SERVER_NOTE,
|
|
81
82
|
],
|
|
82
|
-
own: ['out', 'no-write', 'routes', 'catalog', 'as', 'client'],
|
|
83
|
+
own: ['out', 'no-write', 'routes', 'catalog', 'as', 'client', 'lists'],
|
|
83
84
|
shared: ['config', 'format', 'json', 'fail-on', 'header', 'env', 'no-auth', 'protocol', 'timeout', 'processes'],
|
|
84
85
|
examples: [
|
|
85
86
|
'toolmenu snapshot -- npx -y @modelcontextprotocol/server-memory',
|
package/dist/lists.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Connection } from './connect.js';
|
|
2
|
+
export declare const LIST_KINDS: readonly ['prompts', 'resources', 'resourceTemplates'];
|
|
3
|
+
export type ListKind = (typeof LIST_KINDS)[number];
|
|
4
|
+
/** The --lists words: `resources` reads both resources/list and resources/templates/list. */
|
|
5
|
+
export declare const LIST_WORDS: readonly ['tools', 'prompts', 'resources'];
|
|
6
|
+
/** Each list's JSON-RPC method, result key, the key that names an item, and its words. */
|
|
7
|
+
export declare const LIST_INFO: Record<ListKind, {
|
|
8
|
+
method: string;
|
|
9
|
+
key: string;
|
|
10
|
+
id: string;
|
|
11
|
+
one: string;
|
|
12
|
+
capability: 'prompts' | 'resources';
|
|
13
|
+
}>;
|
|
14
|
+
/** Pages read at most: a resources list can be a whole file tree. */
|
|
15
|
+
export declare const MAX_PAGES = 50;
|
|
16
|
+
export interface ListRead {
|
|
17
|
+
kind: ListKind;
|
|
18
|
+
items: Record<string, unknown>[];
|
|
19
|
+
/** Raw result pages, as received (spec/schema checks them). */
|
|
20
|
+
pages: Record<string, unknown>[];
|
|
21
|
+
listMeta: {
|
|
22
|
+
ttlMs?: number;
|
|
23
|
+
cacheScope?: string;
|
|
24
|
+
};
|
|
25
|
+
/** Stopped at MAX_PAGES. */
|
|
26
|
+
truncated?: boolean;
|
|
27
|
+
/** Why it couldn't be read. */
|
|
28
|
+
error?: string;
|
|
29
|
+
/** The JSON-RPC error code it failed with, when there was one (-32601: method not found). */
|
|
30
|
+
code?: number;
|
|
31
|
+
}
|
|
32
|
+
/** Read one list, page by page, as the server sends it. */
|
|
33
|
+
export declare function readList(connection: Connection, kind: ListKind, timeoutMs?: number): Promise<ListRead>;
|
|
34
|
+
/** The list kinds the --lists words ask for that the server declares a capability for, and the ones it doesn't. */
|
|
35
|
+
export declare function kindsToRead(words: string[], capabilities: Record<string, unknown>): {
|
|
36
|
+
read: ListKind[];
|
|
37
|
+
undeclared: ListKind[];
|
|
38
|
+
};
|
|
39
|
+
/** Two reads of one list: what changed between them, by item id and in order. */
|
|
40
|
+
export declare function listChanges(kind: ListKind, before: Record<string, unknown>[], after: Record<string, unknown>[]): string[];
|
package/dist/lists.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Prompts and resources: the other lists a client loads up front (2026-07-28:
|
|
3
|
+
* cacheable like tools/list, SEP-2549, and no longer varying per connection).
|
|
4
|
+
* snapshot --lists tools,prompts,resources reads them; the rules in
|
|
5
|
+
* rules/lists.ts check them the way the menu rules check tools.
|
|
6
|
+
*/
|
|
7
|
+
import { quietExclusions } from './connect.js';
|
|
8
|
+
export const LIST_KINDS = ['prompts', 'resources', 'resourceTemplates'];
|
|
9
|
+
/** The --lists words: `resources` reads both resources/list and resources/templates/list. */
|
|
10
|
+
export const LIST_WORDS = ['tools', 'prompts', 'resources'];
|
|
11
|
+
/** Each list's JSON-RPC method, result key, the key that names an item, and its words. */
|
|
12
|
+
export const LIST_INFO = {
|
|
13
|
+
prompts: { method: 'prompts/list', key: 'prompts', id: 'name', one: 'prompt', capability: 'prompts' },
|
|
14
|
+
resources: { method: 'resources/list', key: 'resources', id: 'uri', one: 'resource', capability: 'resources' },
|
|
15
|
+
resourceTemplates: { method: 'resources/templates/list', key: 'resourceTemplates', id: 'uriTemplate', one: 'resource template', capability: 'resources' },
|
|
16
|
+
};
|
|
17
|
+
/** Pages read at most: a resources list can be a whole file tree. */
|
|
18
|
+
export const MAX_PAGES = 50;
|
|
19
|
+
/** Read one list, page by page, as the server sends it. */
|
|
20
|
+
export async function readList(connection, kind, timeoutMs) {
|
|
21
|
+
const info = LIST_INFO[kind];
|
|
22
|
+
const pages = [];
|
|
23
|
+
let cursor;
|
|
24
|
+
try {
|
|
25
|
+
for (let i = 0; i < MAX_PAGES; i++) {
|
|
26
|
+
const mark = connection.wire.responses.length;
|
|
27
|
+
const params = cursor ? { cursor } : undefined;
|
|
28
|
+
const call = () => {
|
|
29
|
+
const c = connection.client;
|
|
30
|
+
const fn = kind === 'prompts' ? 'listPrompts' : kind === 'resources' ? 'listResources' : 'listResourceTemplates';
|
|
31
|
+
return c[fn].call(connection.client, params, { timeout: timeoutMs, cacheMode: 'bypass' });
|
|
32
|
+
};
|
|
33
|
+
let failed;
|
|
34
|
+
await quietExclusions(call).catch((e) => (failed = e));
|
|
35
|
+
// The page as the server sent it: the SDK may reject a result toolmenu still checks.
|
|
36
|
+
const page = connection.wire.since(mark, info.method).at(-1)?.result;
|
|
37
|
+
if (!page)
|
|
38
|
+
throw failed ?? new Error(`no ${info.method} result`);
|
|
39
|
+
pages.push(page);
|
|
40
|
+
cursor = typeof page.nextCursor === 'string' && page.nextCursor ? page.nextCursor : undefined;
|
|
41
|
+
if (!cursor)
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const code = error?.code;
|
|
47
|
+
return { kind, items: [], pages, listMeta: {}, error: (error instanceof Error ? error.message : String(error)).split('\n')[0].replace(/^MCP error -?\d+:\s*/, ''), ...(typeof code === 'number' ? { code } : {}) };
|
|
48
|
+
}
|
|
49
|
+
const first = pages[0] ?? {};
|
|
50
|
+
return {
|
|
51
|
+
kind,
|
|
52
|
+
items: pages.flatMap((p) => (Array.isArray(p[info.key]) ? p[info.key] : [])),
|
|
53
|
+
pages,
|
|
54
|
+
listMeta: {
|
|
55
|
+
...(typeof first.ttlMs === 'number' ? { ttlMs: first.ttlMs } : {}),
|
|
56
|
+
...(typeof first.cacheScope === 'string' ? { cacheScope: first.cacheScope } : {}),
|
|
57
|
+
},
|
|
58
|
+
...(cursor ? { truncated: true } : {}),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** The list kinds the --lists words ask for that the server declares a capability for, and the ones it doesn't. */
|
|
62
|
+
export function kindsToRead(words, capabilities) {
|
|
63
|
+
const wanted = [...(words.includes('prompts') ? ['prompts'] : []), ...(words.includes('resources') ? ['resources', 'resourceTemplates'] : [])];
|
|
64
|
+
return {
|
|
65
|
+
read: wanted.filter((k) => capabilities[LIST_INFO[k].capability] !== undefined),
|
|
66
|
+
undeclared: wanted.filter((k) => capabilities[LIST_INFO[k].capability] === undefined),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** Two reads of one list: what changed between them, by item id and in order. */
|
|
70
|
+
export function listChanges(kind, before, after) {
|
|
71
|
+
const id = (x) => String(x[LIST_INFO[kind].id] ?? JSON.stringify(x));
|
|
72
|
+
const a = new Map(before.map((x) => [id(x), JSON.stringify(x)]));
|
|
73
|
+
const b = new Map(after.map((x) => [id(x), JSON.stringify(x)]));
|
|
74
|
+
const out = [];
|
|
75
|
+
for (const k of a.keys())
|
|
76
|
+
if (!b.has(k))
|
|
77
|
+
out.push(`${k}: gone`);
|
|
78
|
+
for (const k of b.keys())
|
|
79
|
+
if (!a.has(k))
|
|
80
|
+
out.push(`${k}: new`);
|
|
81
|
+
for (const [k, v] of b)
|
|
82
|
+
if (a.has(k) && a.get(k) !== v)
|
|
83
|
+
out.push(`${k}: ${sameKeys(a.get(k), v) ? 'key order changed' : 'changed'}`);
|
|
84
|
+
if (!out.length && [...a.keys()].join('\n') !== [...b.keys()].join('\n'))
|
|
85
|
+
out.push('same items, different order');
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
function sameKeys(x, y) {
|
|
89
|
+
const sort = (v) => (Array.isArray(v) ? v.map(sort) : v && typeof v === 'object' ? Object.fromEntries(Object.entries(v).sort(([p], [q]) => p.localeCompare(q)).map(([k, w]) => [k, sort(w)])) : v);
|
|
90
|
+
return JSON.stringify(sort(JSON.parse(x))) === JSON.stringify(sort(JSON.parse(y)));
|
|
91
|
+
}
|
package/dist/options.d.ts
CHANGED
package/dist/options.js
CHANGED
|
@@ -14,6 +14,7 @@ export const CLI_OPTIONS = {
|
|
|
14
14
|
env: { type: 'string', multiple: true },
|
|
15
15
|
as: { type: 'string', multiple: true },
|
|
16
16
|
client: { type: 'string' },
|
|
17
|
+
lists: { type: 'string' },
|
|
17
18
|
timeout: { type: 'string' },
|
|
18
19
|
protocol: { type: 'string' },
|
|
19
20
|
elicitation: { type: 'string' },
|
package/dist/report.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { type Scenario, type SessionResult } from './session.js';
|
|
|
5
5
|
import { type Finding, type Menu, type Severity } from './types.js';
|
|
6
6
|
export type Format = 'text' | 'json' | 'github' | 'markdown';
|
|
7
7
|
export declare function counts(findings: Finding[]): Record<Severity, number>;
|
|
8
|
-
export declare function formatSnapshot(menu: Menu, findings: Finding[], format: Format, outPath?: string, cost?: ClientCost): string;
|
|
8
|
+
export declare function formatSnapshot(menu: Menu, findings: Finding[], format: Format, outPath?: string, cost?: ClientCost, notOffered?: string[]): string;
|
|
9
9
|
export declare function formatDiff(d: DiffResult, beforeTools: number, afterTools: number, format: Format): string;
|
|
10
10
|
export declare function formatHistory(h: HistoryResult, format: Format, outDir: string, csvPath?: string): string;
|
|
11
11
|
export declare function formatSession(s: SessionResult, format: Format): string;
|
package/dist/report.js
CHANGED
|
@@ -12,6 +12,14 @@ export function counts(findings) {
|
|
|
12
12
|
function plural(n, word) {
|
|
13
13
|
return `${n} ${word}${n === 1 ? '' : 's'}`;
|
|
14
14
|
}
|
|
15
|
+
/** snapshot --lists: "3 prompts · 5 resources · 2 resource templates", or nothing. */
|
|
16
|
+
function otherLists(menu) {
|
|
17
|
+
return [
|
|
18
|
+
menu.prompts ? plural(menu.prompts.length, 'prompt') : '',
|
|
19
|
+
menu.resources ? plural(menu.resources.length, 'resource') : '',
|
|
20
|
+
menu.resourceTemplates ? plural(menu.resourceTemplates.length, 'resource template') : '',
|
|
21
|
+
].filter(Boolean).join(' · ');
|
|
22
|
+
}
|
|
15
23
|
/** --client: "as Claude Code: up front ~N tokens (…) · on demand ~M per tool loaded (largest: x, ~K)". */
|
|
16
24
|
function costLine(cost) {
|
|
17
25
|
const parts = [
|
|
@@ -20,7 +28,7 @@ function costLine(cost) {
|
|
|
20
28
|
].filter(Boolean);
|
|
21
29
|
return `as ${cost.label}: ${parts.join(' · ')}`;
|
|
22
30
|
}
|
|
23
|
-
export function formatSnapshot(menu, findings, format, outPath, cost) {
|
|
31
|
+
export function formatSnapshot(menu, findings, format, outPath, cost, notOffered = []) {
|
|
24
32
|
if (format === 'json') {
|
|
25
33
|
return JSON.stringify({
|
|
26
34
|
command: 'snapshot',
|
|
@@ -30,6 +38,10 @@ export function formatSnapshot(menu, findings, format, outPath, cost) {
|
|
|
30
38
|
listMeta: menu.listMeta,
|
|
31
39
|
breakdown: breakdown(menu),
|
|
32
40
|
...(cost ? { client: cost } : {}),
|
|
41
|
+
...(menu.prompts ? { prompts: menu.prompts.length } : {}),
|
|
42
|
+
...(menu.resources ? { resources: menu.resources.length } : {}),
|
|
43
|
+
...(menu.resourceTemplates ? { resourceTemplates: menu.resourceTemplates.length } : {}),
|
|
44
|
+
...(notOffered.length ? { notOffered } : {}),
|
|
33
45
|
written: outPath ?? null,
|
|
34
46
|
counts: counts(findings),
|
|
35
47
|
findings,
|
|
@@ -44,6 +56,7 @@ export function formatSnapshot(menu, findings, format, outPath, cost) {
|
|
|
44
56
|
'',
|
|
45
57
|
`Protocol ${s.protocolVersion ?? 'unknown'} · ${plural(menu.tools.length, 'tool')} · ~${menu.totalTokens.toLocaleString('en-US')} tokens (estimate)`,
|
|
46
58
|
...(cost ? ['', `${costLine(cost)}. _${cost.basis}._`] : []),
|
|
59
|
+
...(otherLists(menu) ? ['', `Also listed: ${otherLists(menu)}`] : []),
|
|
47
60
|
'',
|
|
48
61
|
...mdFindings(findings),
|
|
49
62
|
...mdBreakdown(menu),
|
|
@@ -56,6 +69,11 @@ export function formatSnapshot(menu, findings, format, outPath, cost) {
|
|
|
56
69
|
];
|
|
57
70
|
if (cost)
|
|
58
71
|
lines.push(` ${costLine(cost)}`, ` ${cost.basis}`);
|
|
72
|
+
const others = otherLists(menu);
|
|
73
|
+
// Lists asked for that the server doesn't offer: said once, not a finding.
|
|
74
|
+
const caps = [...new Set(notOffered.map((k) => (k === 'prompts' ? 'prompts' : 'resources')))];
|
|
75
|
+
if (others || caps.length)
|
|
76
|
+
lines.push(` ${[others ? `also listed: ${others}` : '', caps.length ? `no ${caps.join(' or ')} offered (not declared)` : ''].filter(Boolean).join(' · ')}`);
|
|
59
77
|
if (outPath)
|
|
60
78
|
lines.push(` wrote ${outPath}`);
|
|
61
79
|
lines.push('');
|
package/dist/rules/clients.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nameProblem, profileOf } from '../clients.js';
|
|
2
2
|
import { count, kept } from './rule.js';
|
|
3
3
|
/**
|
|
4
4
|
* --client: tool names the client's API doesn't take. MCP allows names its APIs
|
|
@@ -10,7 +10,7 @@ export const clientName = {
|
|
|
10
10
|
severity: 'warn',
|
|
11
11
|
summary: "Tool names the client's API doesn't accept as they are",
|
|
12
12
|
run(ctx) {
|
|
13
|
-
const profile = ctx.client
|
|
13
|
+
const profile = profileOf(ctx.client);
|
|
14
14
|
if (!profile?.namePattern)
|
|
15
15
|
return [];
|
|
16
16
|
const bad = kept(ctx.menu.tools, ctx)
|
|
@@ -25,7 +25,7 @@ const CLAUDE_CODE_UPFRONT = 4096;
|
|
|
25
25
|
export function resolveLimit(setting) {
|
|
26
26
|
if (typeof setting === 'number')
|
|
27
27
|
return { limit: setting, who: 'your client', assumed: false, perTool: () => setting };
|
|
28
|
-
const client = setting !== undefined && setting
|
|
28
|
+
const client = setting !== undefined && Object.hasOwn(CLIENT_LIMITS, setting) ? setting : DEFAULT_CLIENT;
|
|
29
29
|
const limit = CLIENT_LIMITS[client];
|
|
30
30
|
const upfront = (tool) => tool._meta?.['anthropic/alwaysLoad'] === true;
|
|
31
31
|
return {
|
package/dist/rules/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { buried, cut, lateInstruction } from './description.js';
|
|
|
3
3
|
import { connectionVariance, hostSpecific, nondeterministic, processVariance } from './determinism.js';
|
|
4
4
|
import { authoredIds } from './ids.js';
|
|
5
5
|
import { clientName } from './clients.js';
|
|
6
|
+
import { listSchema, listVariance } from './lists.js';
|
|
6
7
|
import { handleLifetime } from './handles.js';
|
|
7
8
|
import { authVariance, cacheScopePublic } from './identities.js';
|
|
8
9
|
import { route, sharedWord, vagueId } from './naming.js';
|
|
@@ -39,6 +40,8 @@ export const MENU_RULES = [
|
|
|
39
40
|
deprecated,
|
|
40
41
|
cacheHints,
|
|
41
42
|
authVariance,
|
|
43
|
+
listVariance,
|
|
44
|
+
listSchema,
|
|
42
45
|
cacheScopePublic,
|
|
43
46
|
serverInfo,
|
|
44
47
|
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ListKind, type ListRead } from '../lists.js';
|
|
2
|
+
import { type Rule } from './rule.js';
|
|
3
|
+
/** What snapshot read of the other lists, for these rules. */
|
|
4
|
+
export interface ListsContext {
|
|
5
|
+
/** Each list read twice on one connection, and once from a second process (stdio) or connection (HTTP). */
|
|
6
|
+
read: {
|
|
7
|
+
kind: ListKind;
|
|
8
|
+
first: ListRead;
|
|
9
|
+
second?: ListRead;
|
|
10
|
+
probe?: ListRead;
|
|
11
|
+
}[];
|
|
12
|
+
/** Lists asked for that the server declares no capability for. */
|
|
13
|
+
undeclared: ListKind[];
|
|
14
|
+
}
|
|
15
|
+
export declare const listVariance: Rule;
|
|
16
|
+
export declare const listSchema: Rule;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { LIST_INFO, listChanges } from '../lists.js';
|
|
2
|
+
import { classifyFailure, SETUP_FAILURES } from '../failures.js';
|
|
3
|
+
import { count } from './rule.js';
|
|
4
|
+
import { resultValidator } from './spec.js';
|
|
5
|
+
const RESULT = { prompts: 'ListPromptsResult', resources: 'ListResourcesResult', resourceTemplates: 'ListResourceTemplatesResult' };
|
|
6
|
+
export const listVariance = {
|
|
7
|
+
id: 'lists/variance',
|
|
8
|
+
severity: 'warn',
|
|
9
|
+
summary: 'Prompts and resources lists are the same every time they are listed, and from a fresh process or connection',
|
|
10
|
+
run(ctx) {
|
|
11
|
+
const findings = [];
|
|
12
|
+
for (const r of ctx.lists?.read ?? []) {
|
|
13
|
+
const info = LIST_INFO[r.kind];
|
|
14
|
+
if (r.first.error)
|
|
15
|
+
continue;
|
|
16
|
+
const again = r.second && !r.second.error ? listChanges(r.kind, r.first.items, r.second.items) : [];
|
|
17
|
+
if (again.length) {
|
|
18
|
+
findings.push({
|
|
19
|
+
message: `${info.method} differs between two calls on one connection: ${count(again.length, 'change')}. A client that caches it (ttlMs) or compares it to decide whether to refresh sees a new list every time.`,
|
|
20
|
+
detail: again.slice(0, 8).concat(again.length > 8 ? [`…and ${again.length - 8} more`] : []),
|
|
21
|
+
fix: `Build ${info.method} the same way every time: a stable order and no per-call values (timestamps, counters).`,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const fresh = r.probe && !r.probe.error ? listChanges(r.kind, r.first.items, r.probe.items) : [];
|
|
25
|
+
if (fresh.length && !again.length) {
|
|
26
|
+
const where = ctx.transport === 'http' ? 'connection' : 'process';
|
|
27
|
+
findings.push({
|
|
28
|
+
message: `${info.method} from a second ${where} differs from the first: ${count(fresh.length, 'change')}. 2026-07-28 lists no longer vary per connection, so clients and caches treat one ${where}'s list as everyone's.`,
|
|
29
|
+
detail: fresh.slice(0, 8).concat(fresh.length > 8 ? [`…and ${fresh.length - 8} more`] : []),
|
|
30
|
+
fix: `Build ${info.method} from what's the same for every ${where}: no per-start ordering (a set, a hash map), no per-${where} state.`,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return findings;
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const listSchema = {
|
|
38
|
+
id: 'lists/schema',
|
|
39
|
+
severity: 'error',
|
|
40
|
+
summary: 'Prompts and resources list results match the official schema for their protocol version',
|
|
41
|
+
run(ctx) {
|
|
42
|
+
if (!ctx.protocolVersion)
|
|
43
|
+
return [];
|
|
44
|
+
const findings = [];
|
|
45
|
+
for (const r of ctx.lists?.read ?? []) {
|
|
46
|
+
const info = LIST_INFO[r.kind];
|
|
47
|
+
if (r.first.error) {
|
|
48
|
+
const said = r.first.error.replace(/[.\s]+$/, '');
|
|
49
|
+
const failure = classifyFailure(r.first.error, { code: r.first.code });
|
|
50
|
+
if (r.first.code === -32601 || /method not found/i.test(r.first.error)) {
|
|
51
|
+
// A server that declares resources but answers one of their methods with Method not found.
|
|
52
|
+
findings.push({
|
|
53
|
+
severity: 'info',
|
|
54
|
+
message: `The server declares ${info.capability} but answers ${info.method} with Method not found (-32601), so a client that asks for ${info.key === 'resourceTemplates' ? 'resource templates' : info.key} gets an error, not an empty list.`,
|
|
55
|
+
fix: `Answer ${info.method} with an empty list if there are none.`,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
else if (SETUP_FAILURES.has(failure)) {
|
|
59
|
+
// Credentials, this machine, a missing app: a failure of the setup, not of the server.
|
|
60
|
+
findings.push({
|
|
61
|
+
severity: 'info',
|
|
62
|
+
message: `${info.method} couldn't be read here (${said}), so it wasn't checked: a setup problem, not the server's.`,
|
|
63
|
+
fix: `Rerun where ${info.method} can answer (credentials, the app or data it needs) to check it.`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
findings.push({
|
|
68
|
+
severity: 'warn',
|
|
69
|
+
message: `The server declares ${info.capability}, but ${info.method} failed: ${said}. Clients that load ${info.key === 'resourceTemplates' ? 'resource templates' : info.key} up front get an error instead.`,
|
|
70
|
+
fix: `Answer ${info.method} (an empty list is fine), or stop declaring the ${info.capability} capability.`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (r.first.truncated) {
|
|
76
|
+
// Not a defect: said so that no one reads the checks as covering the whole list.
|
|
77
|
+
findings.push({
|
|
78
|
+
severity: 'info',
|
|
79
|
+
message: `${info.method} has more than ${r.first.pages.length} pages; toolmenu read the first ${r.first.pages.length} (${r.first.items.length} items), so the checks and the menu file cover those only.`,
|
|
80
|
+
fix: 'Nothing to change for this; a client that loads the whole list up front pays for every page.',
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const validate = resultValidator(ctx.protocolVersion, RESULT[r.kind]);
|
|
84
|
+
if (!validate)
|
|
85
|
+
continue;
|
|
86
|
+
r.first.pages.forEach((page, i) => {
|
|
87
|
+
if (validate(page))
|
|
88
|
+
return;
|
|
89
|
+
const errors = validate.errors ?? [];
|
|
90
|
+
const missing = [...new Set(errors.filter((e) => !e.instancePath && e.params && 'missingProperty' in e.params).map((e) => String(e.params.missingProperty)))];
|
|
91
|
+
findings.push({
|
|
92
|
+
message: `The ${info.method} result${r.first.pages.length > 1 ? ` (page ${i + 1})` : ''} doesn't match the official ${ctx.protocolVersion} schema, so a strict client may refuse it.`,
|
|
93
|
+
detail: errors.slice(0, 5).map((e) => `${e.instancePath || '(result)'} ${e.message}${e.params && 'missingProperty' in e.params ? `: ${e.params.missingProperty}` : ''}`).concat(errors.length > 5 ? [`…and ${errors.length - 5} more`] : []),
|
|
94
|
+
fix: missing.length
|
|
95
|
+
? `Add ${missing.join(', ')} to the ${info.method} result${missing.some((m) => m === 'ttlMs' || m === 'cacheScope') ? ` (${ctx.protocolVersion} requires cache hints on it, SEP-2549)` : ''}.`
|
|
96
|
+
: `Fix ${errors[0]?.instancePath || 'the result'} first (${errors[0]?.message ?? 'see above'}), then rerun.`,
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return findings;
|
|
101
|
+
},
|
|
102
|
+
};
|
package/dist/rules/rule.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export interface RuleContext {
|
|
|
28
28
|
server?: string;
|
|
29
29
|
/** snapshot --as: each identity's menu, the main one first (menu/auth-variance, spec/cache-scope-public). */
|
|
30
30
|
identities?: import('./identities.js').IdentityMenu[];
|
|
31
|
+
/** snapshot --lists: the prompts and resources lists read (lists/* rules). */
|
|
32
|
+
lists?: import('./lists.js').ListsContext;
|
|
31
33
|
/** --client: the client profile the menu is checked for (src/clients.ts). */
|
|
32
34
|
client?: string;
|
|
33
35
|
/** Where clients are assumed to cut tool descriptions (description/buried). */
|
package/dist/rules/search.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { profileOf } from '../clients.js';
|
|
2
2
|
import { buildIndex, placeIn, placeOf, SEARCH_LIMIT } from '../search.js';
|
|
3
3
|
import { commonWords, VERBS, words } from '../words.js';
|
|
4
4
|
import { clip, count, kept, names, num } from './rule.js';
|
|
@@ -20,7 +20,7 @@ export const findable = {
|
|
|
20
20
|
summary: 'Each tool comes up when searched for by its own name, for clients that defer tools',
|
|
21
21
|
run(ctx) {
|
|
22
22
|
const tools = ctx.menu.tools;
|
|
23
|
-
const profile = ctx.client
|
|
23
|
+
const profile = profileOf(ctx.client);
|
|
24
24
|
if (profile) {
|
|
25
25
|
// A client that defers tools does it at any size; one whose search results
|
|
26
26
|
// aren't documented (OpenAI's spec doesn't say how many) isn't ranked against a guess.
|
package/dist/rules/spec.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Rule } from './rule.js';
|
|
2
|
+
/** A validator for one result type ($defs name) of a protocol version, or null when this toolmenu has no schema for it. */
|
|
3
|
+
export declare function resultValidator(version: string, result?: string): import("ajv").ValidateFunction<unknown> | null;
|
|
2
4
|
export declare const schema: Rule;
|
|
3
5
|
export declare const toolsCapability: Rule;
|
|
4
6
|
export declare const duplicateName: Rule;
|
package/dist/rules/spec.js
CHANGED
|
@@ -7,24 +7,33 @@ import addFormatsImport from 'ajv-formats';
|
|
|
7
7
|
const addFormats = (addFormatsImport.default ?? addFormatsImport);
|
|
8
8
|
const SCHEMA_DIR = fileURLToPath(new URL('../../schemas/', import.meta.url));
|
|
9
9
|
const validators = new Map();
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/** A validator for one result type ($defs name) of a protocol version, or null when this toolmenu has no schema for it. */
|
|
11
|
+
export function resultValidator(version, result = 'ListToolsResult') {
|
|
12
|
+
const key = `${version}\0${result}`;
|
|
13
|
+
if (!validators.has(key)) {
|
|
12
14
|
const file = `${SCHEMA_DIR}${version}.json`;
|
|
13
15
|
if (!existsSync(file)) {
|
|
14
|
-
validators.set(
|
|
16
|
+
validators.set(key, null);
|
|
15
17
|
}
|
|
16
18
|
else {
|
|
17
19
|
const schema = JSON.parse(readFileSync(file, 'utf8'));
|
|
18
20
|
// 2025-11-25 and later are draft 2020-12 with $defs; earlier ones are draft-07 with definitions.
|
|
19
21
|
const modernDraft = String(schema.$schema).includes('2020-12');
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const pool = modernDraft ? schema.$defs : schema.definitions;
|
|
23
|
+
if (!pool?.[result]) {
|
|
24
|
+
validators.set(key, null);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const ajv = modernDraft ? new Ajv2020({ strict: false, allErrors: true }) : new Ajv({ strict: false, allErrors: true });
|
|
28
|
+
addFormats(ajv);
|
|
29
|
+
ajv.addSchema(schema, 'mcp');
|
|
30
|
+
validators.set(key, ajv.compile({ $ref: `mcp#/${modernDraft ? '$defs' : 'definitions'}/${result}` }));
|
|
31
|
+
}
|
|
24
32
|
}
|
|
25
33
|
}
|
|
26
|
-
return validators.get(
|
|
34
|
+
return validators.get(key) ?? null;
|
|
27
35
|
}
|
|
36
|
+
const listToolsValidator = (version) => resultValidator(version, 'ListToolsResult');
|
|
28
37
|
export const schema = {
|
|
29
38
|
id: 'spec/schema',
|
|
30
39
|
severity: 'error',
|
package/dist/snapshot.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Target } from './connect.js';
|
|
2
2
|
import { type Identity } from './probe.js';
|
|
3
|
+
import { type ListKind } from './lists.js';
|
|
3
4
|
import type { IdentityMenu } from './rules/identities.js';
|
|
4
5
|
import { type ClientCost } from './clients.js';
|
|
5
6
|
import { type RuleSettings } from './rules/index.js';
|
|
@@ -23,6 +24,8 @@ export interface SnapshotOptions extends RuleSettings {
|
|
|
23
24
|
* menu is the one saved and checked; the others are compared with it.
|
|
24
25
|
*/
|
|
25
26
|
identities?: Identity[];
|
|
27
|
+
/** --lists: which lists besides tools to read and check (prompts, resources). */
|
|
28
|
+
lists?: string[];
|
|
26
29
|
/** --client: check the menu for this client (src/clients.ts): its description cut, its search, its name format. */
|
|
27
30
|
client?: string;
|
|
28
31
|
}
|
|
@@ -33,6 +36,8 @@ export interface SnapshotResult {
|
|
|
33
36
|
identities?: IdentityMenu[];
|
|
34
37
|
/** --client: what the menu costs up front and per tool a search loads. */
|
|
35
38
|
cost?: ClientCost;
|
|
39
|
+
/** --lists: lists asked for that the server declares no capability for, so weren't read. */
|
|
40
|
+
notOffered?: ListKind[];
|
|
36
41
|
}
|
|
37
42
|
/** Establish the menu: connect, list the tools twice, run the menu rules. */
|
|
38
43
|
export declare function snapshot(given: Target, options?: SnapshotOptions): Promise<SnapshotResult>;
|
package/dist/snapshot.js
CHANGED
|
@@ -2,7 +2,8 @@ import { listTools } from './connect.js';
|
|
|
2
2
|
import { patiently, tooMany } from './failures.js';
|
|
3
3
|
import { ConnectError } from './explain.js';
|
|
4
4
|
import { buildMenu } from './menu.js';
|
|
5
|
-
import { asIdentity, connectPatiently, isContainerWrapper, MAIN_SEED, probeMenu, probeVariance, seeded } from './probe.js';
|
|
5
|
+
import { asIdentity, connectPatiently, isContainerWrapper, MAIN_SEED, PROBE_SEED, probeMenu, probeVariance, seeded } from './probe.js';
|
|
6
|
+
import { kindsToRead, readList } from './lists.js';
|
|
6
7
|
import { clientCost } from './clients.js';
|
|
7
8
|
import { MENU_RULES, runRules } from './rules/index.js';
|
|
8
9
|
import { catalogFindings, readCatalog } from './catalog.js';
|
|
@@ -18,6 +19,8 @@ export async function snapshot(given, options = {}) {
|
|
|
18
19
|
let menu;
|
|
19
20
|
let secondList;
|
|
20
21
|
let first;
|
|
22
|
+
const reads = [];
|
|
23
|
+
let undeclared = [];
|
|
21
24
|
try {
|
|
22
25
|
first = await patiently(() => listTools(connection, options), { error: tooMany });
|
|
23
26
|
const second = await patiently(() => listTools(connection, options), { error: tooMany });
|
|
@@ -29,6 +32,16 @@ export async function snapshot(given, options = {}) {
|
|
|
29
32
|
};
|
|
30
33
|
menu = buildMenu(first.tools, server, first.listMeta);
|
|
31
34
|
secondList = buildMenu(second.tools, server, second.listMeta).tools;
|
|
35
|
+
// --lists: prompts and resources, each read twice on this connection.
|
|
36
|
+
const kinds = kindsToRead(options.lists ?? [], connection.capabilities);
|
|
37
|
+
undeclared = kinds.undeclared;
|
|
38
|
+
for (const kind of kinds.read) {
|
|
39
|
+
const first = await readList(connection, kind, options.timeoutMs);
|
|
40
|
+
const second = first.error ? undefined : await readList(connection, kind, options.timeoutMs);
|
|
41
|
+
reads.push({ kind, first, ...(second ? { second } : {}) });
|
|
42
|
+
if (!first.error)
|
|
43
|
+
menu[kind] = first.items;
|
|
44
|
+
}
|
|
32
45
|
if (options.catalog) {
|
|
33
46
|
menu.catalog = await readCatalog(connection, menu.tools, { ...(typeof options.catalog === 'object' ? options.catalog : {}), timeoutMs: options.timeoutMs });
|
|
34
47
|
}
|
|
@@ -46,6 +59,23 @@ export async function snapshot(given, options = {}) {
|
|
|
46
59
|
// After the main process has exited: a server that holds a file or a port
|
|
47
60
|
// shouldn't have to share it with its own probe.
|
|
48
61
|
const probes = await probeVariance(target, menu.tools, options.processes ?? 2, options.timeoutMs ?? 30_000);
|
|
62
|
+
// The other lists from a second process (stdio) or connection (HTTP), as tools get.
|
|
63
|
+
if ((options.processes ?? 2) > 1 && reads.some((r) => !r.first.error)) {
|
|
64
|
+
try {
|
|
65
|
+
const probe = await connectPatiently(seeded(target, PROBE_SEED), { timeoutMs: options.timeoutMs });
|
|
66
|
+
try {
|
|
67
|
+
for (const r of reads)
|
|
68
|
+
if (!r.first.error)
|
|
69
|
+
r.probe = await readList(probe, r.kind, options.timeoutMs);
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
await probe.close().catch(() => { });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// The tool probe above says why a second process or connection failed.
|
|
77
|
+
}
|
|
78
|
+
}
|
|
49
79
|
// Each other identity's menu, from its own process (stdio) or connection (HTTP).
|
|
50
80
|
const identities = mainIdentity
|
|
51
81
|
? [{ name: mainIdentity.name, tools: menu.tools, tokens: menu.totalTokens, cacheScope: menu.listMeta?.cacheScope }]
|
|
@@ -80,6 +110,7 @@ export async function snapshot(given, options = {}) {
|
|
|
80
110
|
serverInfo: connection.server,
|
|
81
111
|
server: serverArgs(target),
|
|
82
112
|
identities,
|
|
113
|
+
...(reads.length || undeclared.length ? { lists: { read: reads, undeclared } } : {}),
|
|
83
114
|
}, options);
|
|
84
115
|
// What --catalog called and what it got, under the same settings as the rules
|
|
85
116
|
// (rules: { "catalog/read": "off" }, ignore).
|
|
@@ -94,7 +125,7 @@ export async function snapshot(given, options = {}) {
|
|
|
94
125
|
findings.sort((a, b) => SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity]);
|
|
95
126
|
}
|
|
96
127
|
const cost = options.client ? clientCost(options.client, menu) : undefined;
|
|
97
|
-
return { menu, findings, ...(identities ? { identities } : {}), ...(cost ? { cost } : {}) };
|
|
128
|
+
return { menu, findings, ...(identities ? { identities } : {}), ...(cost ? { cost } : {}), ...(undeclared.length ? { notOffered: undeclared } : {}) };
|
|
98
129
|
}
|
|
99
130
|
const firstLine = (error) => (error instanceof Error ? error.message : String(error)).split('\n')[0].trim();
|
|
100
131
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -62,6 +62,10 @@ export interface Menu {
|
|
|
62
62
|
ttlMs?: number;
|
|
63
63
|
cacheScope?: string;
|
|
64
64
|
};
|
|
65
|
+
/** snapshot --lists: the other lists as the server sent them (additive; readers that don't know them ignore them). */
|
|
66
|
+
prompts?: Record<string, unknown>[];
|
|
67
|
+
resources?: Record<string, unknown>[];
|
|
68
|
+
resourceTemplates?: Record<string, unknown>[];
|
|
65
69
|
/**
|
|
66
70
|
* 'session': every tool a session saw (session --union-out), in the order first
|
|
67
71
|
* seen, which is the unlock order, not an order any client was served.
|
package/package.json
CHANGED