toolmenu 0.7.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.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +311 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +283 -0
  5. package/dist/compare.d.ts +32 -0
  6. package/dist/compare.js +108 -0
  7. package/dist/config.d.ts +19 -0
  8. package/dist/config.js +27 -0
  9. package/dist/connect.d.ts +66 -0
  10. package/dist/connect.js +122 -0
  11. package/dist/diff.d.ts +58 -0
  12. package/dist/diff.js +404 -0
  13. package/dist/history.d.ts +88 -0
  14. package/dist/history.js +219 -0
  15. package/dist/index.d.ts +10 -0
  16. package/dist/index.js +9 -0
  17. package/dist/menu.d.ts +9 -0
  18. package/dist/menu.js +57 -0
  19. package/dist/report.d.ts +11 -0
  20. package/dist/report.js +278 -0
  21. package/dist/routes.d.ts +22 -0
  22. package/dist/routes.js +76 -0
  23. package/dist/rules/description.d.ts +28 -0
  24. package/dist/rules/description.js +158 -0
  25. package/dist/rules/determinism.d.ts +2 -0
  26. package/dist/rules/determinism.js +35 -0
  27. package/dist/rules/ids.d.ts +11 -0
  28. package/dist/rules/ids.js +138 -0
  29. package/dist/rules/index.d.ts +11 -0
  30. package/dist/rules/index.js +42 -0
  31. package/dist/rules/naming.d.ts +4 -0
  32. package/dist/rules/naming.js +145 -0
  33. package/dist/rules/rule.d.ts +33 -0
  34. package/dist/rules/rule.js +1 -0
  35. package/dist/rules/spec.d.ts +5 -0
  36. package/dist/rules/spec.js +102 -0
  37. package/dist/rules/write.d.ts +3 -0
  38. package/dist/rules/write.js +55 -0
  39. package/dist/semver.d.ts +11 -0
  40. package/dist/semver.js +41 -0
  41. package/dist/session.d.ts +90 -0
  42. package/dist/session.js +519 -0
  43. package/dist/snapshot.d.ts +16 -0
  44. package/dist/snapshot.js +42 -0
  45. package/dist/types.d.ts +49 -0
  46. package/dist/types.js +1 -0
  47. package/dist/version.d.ts +2 -0
  48. package/dist/version.js +3 -0
  49. package/dist/words.d.ts +14 -0
  50. package/dist/words.js +63 -0
  51. package/package.json +57 -0
  52. package/schemas/2024-11-05.json +2077 -0
  53. package/schemas/2025-03-26.json +2139 -0
  54. package/schemas/2025-06-18.json +2517 -0
  55. package/schemas/2025-11-25.json +4058 -0
  56. package/schemas/2026-07-28.json +3963 -0
package/dist/words.js ADDED
@@ -0,0 +1,63 @@
1
+ /** Lowercase words in a tool or parameter name: `listTeamAudits`, `list_team_audits` → list, team, audits. */
2
+ export function words(name) {
3
+ return name
4
+ .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
5
+ .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
6
+ .split(/[^A-Za-z0-9]+/)
7
+ .filter(Boolean)
8
+ .map((w) => w.toLowerCase());
9
+ }
10
+ export function singular(word) {
11
+ // status, analysis, address: not plurals
12
+ if (/(us|ss|is)$/.test(word))
13
+ return word;
14
+ if (word.length > 4 && word.endsWith('ies'))
15
+ return word.slice(0, -3) + 'y';
16
+ if (word.length > 4 && /(ses|xes|ches|shes)$/.test(word))
17
+ return word.slice(0, -2);
18
+ if (word.length > 3 && word.endsWith('s') && !word.endsWith('ss'))
19
+ return word.slice(0, -1);
20
+ return word;
21
+ }
22
+ export const VERBS = new Set([
23
+ 'get', 'list', 'search', 'find', 'query', 'lookup', 'look', 'fetch', 'read', 'browse', 'resolve', 'retrieve',
24
+ 'create', 'add', 'new', 'insert', 'update', 'edit', 'patch', 'put', 'set', 'upsert', 'modify', 'change',
25
+ 'delete', 'remove', 'drop', 'purge', 'destroy', 'clear', 'revoke', 'cancel', 'archive', 'close',
26
+ 'send', 'post', 'publish', 'submit', 'write', 'save', 'upload', 'move', 'rename', 'copy', 'duplicate',
27
+ 'run', 'start', 'stop', 'execute', 'exec', 'open', 'check', 'count', 'describe', 'validate',
28
+ 'preview', 'plan', 'simulate', 'dry', 'unlock', 'enable', 'disable', 'assign', 'invite', 'approve',
29
+ 'toggle', 'trigger', 'subscribe', 'unsubscribe', 'notify', 'sync', 'import', 'export', 'download',
30
+ 'convert', 'generate', 'compute', 'calculate', 'print', 'echo', 'reset', 'refresh', 'restart',
31
+ 'take', 'install', 'uninstall', 'upgrade', 'navigate', 'resize', 'select', 'apply', 'scale', 'merge',
32
+ 'push', 'pull', 'inspect', 'analyze', 'emulate', 'handle', 'press', 'click', 'drag', 'fill', 'hover',
33
+ 'type', 'wait', 'evaluate', 'forward', 'reconnect', 'scrape', 'crawl', 'map', 'extract', 'upload',
34
+ ]);
35
+ export const LOOKUP_VERBS = new Set(['list', 'search', 'find', 'query', 'lookup', 'look', 'get', 'fetch', 'read', 'browse', 'resolve', 'retrieve']);
36
+ /** Lookups that return collections: they hand out IDs even when they take one (get_block_children). */
37
+ export const COLLECTION_VERBS = new Set(['list', 'search', 'find', 'query', 'browse']);
38
+ export const WRITE_VERBS = new Set([
39
+ 'create', 'add', 'insert', 'update', 'edit', 'patch', 'put', 'set', 'upsert', 'modify', 'change',
40
+ 'delete', 'remove', 'drop', 'purge', 'destroy', 'clear', 'revoke', 'cancel', 'archive', 'close',
41
+ 'send', 'post', 'publish', 'submit', 'write', 'save', 'upload', 'move', 'rename', 'assign', 'invite', 'approve',
42
+ ]);
43
+ /** Words too generic to tell tools apart. */
44
+ const GENERIC = new Set(['tool', 'mcp', 'api', 'data', 'info', 'item', 'object', 'value', 'result', 'detail', 'all', 'by', 'for', 'of', 'to', 'from', 'with', 'and', 'or', 'the', 'a', 'an', 'my']);
45
+ /** Words most of a server's tool names share (`firecrawl_`, `API-`, `browser_`): no information. */
46
+ export function commonWords(names) {
47
+ const counts = new Map();
48
+ for (const name of names)
49
+ for (const w of new Set(words(name)))
50
+ counts.set(w, (counts.get(w) ?? 0) + 1);
51
+ return new Set([...counts].filter(([, n]) => names.length >= 4 && n >= names.length * 0.6).map(([w]) => w));
52
+ }
53
+ /** The tool's verb: the first word that is one, skipping prefixes like `API-`. */
54
+ export function verbOf(name) {
55
+ return words(name).find((w) => VERBS.has(w));
56
+ }
57
+ /** The nouns in a tool name, singular: `list_team_audits` → team, audit. */
58
+ export function nouns(name) {
59
+ return words(name)
60
+ .filter((w) => w.length > 1 && !VERBS.has(w) && !/^\d+$/.test(w))
61
+ .map(singular)
62
+ .filter((w) => !GENERIC.has(w));
63
+ }
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "toolmenu",
3
+ "version": "0.7.0",
4
+ "description": "Lint your MCP server's tool menu for changes that confuse agents or break caches.",
5
+ "author": "Niksa (https://niksa.me)",
6
+ "main": "dist/index.js",
7
+ "scripts": {
8
+ "build": "tsc -p tsconfig.json",
9
+ "test": "npm run build && node --test --test-reporter=spec test/*.test.mjs",
10
+ "typecheck": "tsc -p tsconfig.json --noEmit",
11
+ "prepublishOnly": "npm run build"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/niksa90/toolmenu.git"
16
+ },
17
+ "keywords": [
18
+ "mcp",
19
+ "model-context-protocol",
20
+ "linter",
21
+ "agents",
22
+ "prompt-caching",
23
+ "cli"
24
+ ],
25
+ "license": "MIT",
26
+ "bugs": {
27
+ "url": "https://github.com/niksa90/toolmenu/issues"
28
+ },
29
+ "homepage": "https://github.com/niksa90/toolmenu#readme",
30
+ "dependencies": {
31
+ "@modelcontextprotocol/client": "^2.1.0",
32
+ "ajv": "^8.20.0",
33
+ "ajv-formats": "^3.0.1",
34
+ "js-tiktoken": "^1.0.21",
35
+ "yaml": "^2.9.1"
36
+ },
37
+ "devDependencies": {
38
+ "@modelcontextprotocol/server": "^2.1.0",
39
+ "@types/node": "^22.20.4",
40
+ "typescript": "^7.0.2",
41
+ "zod": "^4.6.5"
42
+ },
43
+ "type": "module",
44
+ "bin": {
45
+ "toolmenu": "dist/cli.js"
46
+ },
47
+ "types": "dist/index.d.ts",
48
+ "files": [
49
+ "dist",
50
+ "schemas",
51
+ "README.md",
52
+ "LICENSE"
53
+ ],
54
+ "engines": {
55
+ "node": ">=22"
56
+ }
57
+ }