@bevel-software/platform-mcp-core 0.25.0 → 0.26.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/index.d.ts CHANGED
@@ -26,6 +26,7 @@
26
26
  * thing as session recovery, and stays each surface's own.
27
27
  */
28
28
  export { type ProxiedTool, toListedTool, sanitizeInputSchema, flattenManualTool, flattenDiscoveredTool, } from './proxied-tool.js';
29
+ export { type SchemaDefect, inputSchemaDefect, schemaDefectMarker, } from './schema-validity.js';
29
30
  export { describeToolFailure, withTransportDetail, toCallToolResult, renderProgress, toolError, needsAuthorizationResult, MCP_IMAGE_RESULT_KIND, type McpImageResult, mcpImageResult, isMcpImageResult, omitImagePayloads, } from './results.js';
30
31
  export { codeModeMetaTools, chainNamespaceExample, META_TOOL_NAMES, CALL_TOOL_CHAIN_MAX_OUTPUT, CALL_TOOL_CHAIN_NAME, CHAIN_FAILURES_RULE, CHAIN_LARGE_RESULTS_RULE, type CodeModeMetaToolsOptions, type SpillPort, dispatchMetaTool, } from './meta-tools.js';
31
32
  export { CHAIN_RUNTIME_PRELUDE, CHAIN_TIMEOUT_DEFAULT_MS, CHAIN_TIMEOUT_MAX_MS, CHAIN_TIMEOUT_MIN_MS, type ChainNamespaces, type ToolChainOutcome, chainNamespaces, chainOutOfMemoryMessage, chainTimeoutMessage, describeChainFailure, runToolChain, unknownNamespaceMessage, withChainRuntime, } from './chain-runtime.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,KAAK,WAAW,EAChB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,wBAAwB,EACxB,q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AsB,EACtB,+BAA+B,EAC/B,uBAAuB,EACvB,oCAAoC,EACpC,mCAAmC,EACnC,+BAA+B,EAC/B,0BAA0B,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,GAChC,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,KAAK,WAAW,EAChB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,KAAK,YAAY,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,cAAc,EACnB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EACd,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAM3C,OAAO,EACL,gCAAgC,EAChC,gBAAgB,EAChB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,EACvB,oCAAoC,EACpC,mCAAmC,EACnC,+BAA+B,EAC/B,0BAA0B,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,GAChC,MAAM,mCAAmC,CAAC"}
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@
26
26
  * thing as session recovery, and stays each surface's own.
27
27
  */
28
28
  export { toListedTool, sanitizeInputSchema, flattenManualTool, flattenDiscoveredTool, } from './proxied-tool.js';
29
+ export { inputSchemaDefect, schemaDefectMarker, } from './schema-validity.js';
29
30
  export { describeToolFailure, withTransportDetail, toCallToolResult, renderProgress, toolError, needsAuthorizationResult, MCP_IMAGE_RESULT_KIND, mcpImageResult, isMcpImageResult, omitImagePayloads, } from './results.js';
30
31
  export { codeModeMetaTools, chainNamespaceExample, META_TOOL_NAMES, CALL_TOOL_CHAIN_MAX_OUTPUT, CALL_TOOL_CHAIN_NAME, CHAIN_FAILURES_RULE, CHAIN_LARGE_RESULTS_RULE, dispatchMetaTool, } from './meta-tools.js';
31
32
  export { CHAIN_RUNTIME_PRELUDE, CHAIN_TIMEOUT_DEFAULT_MS, CHAIN_TIMEOUT_MAX_MS, CHAIN_TIMEOUT_MIN_MS, chainNamespaces, chainOutOfMemoryMessage, chainTimeoutMessage, describeChainFailure, runToolChain, unknownNamespaceMessage, withChainRuntime, } from './chain-runtime.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAEL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,wBAAwB,EACxB,qBAAqB,EAErB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EAGxB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EAGpB,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAGL,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC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,oBAAoB,EACpB,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAGL,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAGL,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,yDAAyD;AACzD,OAAO,EACL,gCAAgC,EAChC,gBAAgB,EAChB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,EACvB,oCAAoC,EACpC,mCAAmC,EACnC,+BAA+B,EAC/B,0BAA0B,GAG3B,MAAM,mCAAmC,CAAC"}
@@ -15,7 +15,7 @@ import { type ChainExampleTool } from './chain-example.js';
15
15
  *
16
16
  * What a chain DOES, though — to a failure, to a large result, to an image —
17
17
  * is true of every call, and those rules are stated once, in the handshake
18
- * instructions and in the platform-managed agent guide, rather than on each
18
+ * instructions and in the platform's agent guide, rather than on each
19
19
  * tool they cover. So on a surface that has those rules the chain description
20
20
  * ends with the same pointer sentence every file tool ends with, composed
21
21
  * where the tool is served and the guide's configured name is known
@@ -17,7 +17,7 @@ import { CHAIN_TIMEOUT_DEFAULT_MS, CHAIN_TIMEOUT_MAX_MS, CHAIN_TIMEOUT_MIN_MS, r
17
17
  *
18
18
  * What a chain DOES, though — to a failure, to a large result, to an image —
19
19
  * is true of every call, and those rules are stated once, in the handshake
20
- * instructions and in the platform-managed agent guide, rather than on each
20
+ * instructions and in the platform's agent guide, rather than on each
21
21
  * tool they cover. So on a surface that has those rules the chain description
22
22
  * ends with the same pointer sentence every file tool ends with, composed
23
23
  * where the tool is served and the guide's configured name is known
@@ -20,9 +20,28 @@ export declare function toListedTool(tool: ProxiedTool): McpTool | null;
20
20
  * - drop non-standard `format` values (OpenAPI's `int32`/`byte`/… — only the
21
21
  * JSON-Schema-standard formats above are accepted; `format` is advisory, so
22
22
  * dropping it doesn't change tool behavior).
23
- * Depth-bounded so a recursive schema degrades to a permissive `{}` node instead
24
- * of hanging or emitting the unsupported recursion; non-local/external refs
25
- * degrade the same way. Exported for direct testing.
23
+ * Everything else is passed through UNCHANGED, and both recursion guards are
24
+ * built so that hitting one cannot change a schema either:
25
+ *
26
+ * - a `$ref` that resolves back onto a schema we are already inlining is
27
+ * recursive, and inlining has no finite answer for it. It degrades to a
28
+ * permissive `{}` — which is legal, because a `$ref` only ever stands where
29
+ * a SCHEMA is expected and `{}` there means "any value". Non-local and
30
+ * unresolvable refs degrade the same way, and so does one past
31
+ * {@link MAX_INLINED_NODES}.
32
+ * - the depth cap keeps the rest of the subtree's shape, replacing only the
33
+ * objects in it with `{}` — see {@link stripPastDepth}. It cannot reach
34
+ * inside instance data, because the walk never descends into a
35
+ * {@link DATA_VALUED_KEYWORDS} value in the first place.
36
+ *
37
+ * That second rule is the fix for three tools AI clients silently dropped. The
38
+ * cap used to return `{}` at WHATEVER position it stopped at, and most
39
+ * positions in a schema are not schema positions: a tool nested deeper than
40
+ * the cap reached clients with `anyOf: {}`, `required: [{}]` or `type: {}` in
41
+ * it. None of those is valid JSON Schema, so the client refused the tool — and
42
+ * said so about a server that had sent a perfectly good schema.
43
+ *
44
+ * Exported for direct testing.
26
45
  */
27
46
  export declare function sanitizeInputSchema(schema: unknown): unknown;
28
47
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"proxied-tool.d.ts","sourceRoot":"","sources":["../src/proxied-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE9D,2FAA2F;AAC3F,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;IACxB;qFACiF;IACjF,UAAU,EAAE,MAAM,CAAC;CACpB;AAoBD,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,GAAG,IAAI,CA4C9D;AAgBD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAkD5D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,GAAG,WAAW,CAsBnF;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,CASjF"}
1
+ {"version":3,"file":"proxied-tool.d.ts","sourceRoot":"","sources":["../src/proxied-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE9D,2FAA2F;AAC3F,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;IACxB;qFACiF;IACjF,UAAU,EAAE,MAAM,CAAC;CACpB;AAoBD,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,GAAG,IAAI,CA4C9D;AA+ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAoK5D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,GAAG,WAAW,CAsBnF;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,CASjF"}
@@ -56,6 +56,69 @@ export function toListedTool(tool) {
56
56
  inputSchema: inputSchema,
57
57
  };
58
58
  }
59
+ /**
60
+ * How deep {@link sanitizeInputSchema} descends before it stops walking and
61
+ * passes the remainder through untouched. Generous on purpose: a real schema
62
+ * costs two levels per nesting (the `properties` keyword, then the field name),
63
+ * and the whole reason for this constant is the call stack, not the schema.
64
+ */
65
+ const MAX_SANITIZE_DEPTH = 200;
66
+ /**
67
+ * How many nodes one schema's `$ref` inlining may produce before a `$ref`
68
+ * stops being expanded.
69
+ *
70
+ * The recursion guard tracks only the pointers on the ACTIVE path, which is
71
+ * what `$ref` recursion means — but it does not make expansion cheap. A
72
+ * schema whose references form a DAG rather than a tree (two `allOf` branches
73
+ * pointing at one `$defs` entry, that entry doing the same) expands its target
74
+ * once per branch, and that doubles per level: a few hundred bytes on the wire
75
+ * can ask `tools/list` for a reply no amount of memory will hold. Past this
76
+ * budget a `$ref` degrades to the same permissive `{}` a recursive one does,
77
+ * which stands at a schema position and leaves the result valid JSON Schema.
78
+ */
79
+ const MAX_INLINED_NODES = 20_000;
80
+ /**
81
+ * The stand-in for a subtree past {@link MAX_SANITIZE_DEPTH}: every plain
82
+ * object becomes `{}`, while arrays and scalars keep their shape. Iterative,
83
+ * because the whole reason for being here is that the recursion has to stop.
84
+ *
85
+ * `{}` is legal exactly where a SCHEMA stands, and an object this deep inside a
86
+ * schema is at a schema position. The positions the old cap destroyed were an
87
+ * `anyOf` LIST, a `required` entry and a `type` STRING — none of them an
88
+ * object, all of them handed back as they came. And because no object survives,
89
+ * nothing past the cap can carry a `$ref` left dangling by the `$defs` block
90
+ * this walk drops, or a `format` the Anthropic validator refuses.
91
+ */
92
+ function stripPastDepth(node) {
93
+ if (!node || typeof node !== 'object')
94
+ return node;
95
+ if (!Array.isArray(node))
96
+ return {};
97
+ const out = [];
98
+ const queue = [{ from: node, to: out }];
99
+ for (let i = 0; i < queue.length; i += 1) {
100
+ const { from, to } = queue[i];
101
+ for (const item of from) {
102
+ if (!item || typeof item !== 'object')
103
+ to.push(item);
104
+ else if (!Array.isArray(item))
105
+ to.push({});
106
+ else {
107
+ const nested = [];
108
+ to.push(nested);
109
+ queue.push({ from: item, to: nested });
110
+ }
111
+ }
112
+ }
113
+ return out;
114
+ }
115
+ /**
116
+ * Keywords whose value is INSTANCE DATA rather than a schema. A schema says
117
+ * what a value may be; these carry values themselves, so nothing in them is a
118
+ * construct for the sanitizer to touch — and nothing in them is a place where
119
+ * `{}` would mean "any value" either.
120
+ */
121
+ const DATA_VALUED_KEYWORDS = new Set(['const', 'default', 'enum', 'examples']);
59
122
  /** JSON-Schema string `format` values the Anthropic tool validator accepts. */
60
123
  const SUPPORTED_SCHEMA_FORMATS = new Set([
61
124
  'date-time',
@@ -77,9 +140,28 @@ const SUPPORTED_SCHEMA_FORMATS = new Set([
77
140
  * - drop non-standard `format` values (OpenAPI's `int32`/`byte`/… — only the
78
141
  * JSON-Schema-standard formats above are accepted; `format` is advisory, so
79
142
  * dropping it doesn't change tool behavior).
80
- * Depth-bounded so a recursive schema degrades to a permissive `{}` node instead
81
- * of hanging or emitting the unsupported recursion; non-local/external refs
82
- * degrade the same way. Exported for direct testing.
143
+ * Everything else is passed through UNCHANGED, and both recursion guards are
144
+ * built so that hitting one cannot change a schema either:
145
+ *
146
+ * - a `$ref` that resolves back onto a schema we are already inlining is
147
+ * recursive, and inlining has no finite answer for it. It degrades to a
148
+ * permissive `{}` — which is legal, because a `$ref` only ever stands where
149
+ * a SCHEMA is expected and `{}` there means "any value". Non-local and
150
+ * unresolvable refs degrade the same way, and so does one past
151
+ * {@link MAX_INLINED_NODES}.
152
+ * - the depth cap keeps the rest of the subtree's shape, replacing only the
153
+ * objects in it with `{}` — see {@link stripPastDepth}. It cannot reach
154
+ * inside instance data, because the walk never descends into a
155
+ * {@link DATA_VALUED_KEYWORDS} value in the first place.
156
+ *
157
+ * That second rule is the fix for three tools AI clients silently dropped. The
158
+ * cap used to return `{}` at WHATEVER position it stopped at, and most
159
+ * positions in a schema are not schema positions: a tool nested deeper than
160
+ * the cap reached clients with `anyOf: {}`, `required: [{}]` or `type: {}` in
161
+ * it. None of those is valid JSON Schema, so the client refused the tool — and
162
+ * said so about a server that had sent a perfectly good schema.
163
+ *
164
+ * Exported for direct testing.
83
165
  */
84
166
  export function sanitizeInputSchema(schema) {
85
167
  const root = schema;
@@ -91,33 +173,143 @@ export function sanitizeInputSchema(schema) {
91
173
  const part = partRaw.replace(/~1/g, '/').replace(/~0/g, '~');
92
174
  if (!node || typeof node !== 'object')
93
175
  return undefined;
176
+ // Own members only: `#/constructor` names nothing, not `Object`.
177
+ if (!Object.prototype.hasOwnProperty.call(node, part))
178
+ return undefined;
94
179
  node = node[part];
95
180
  }
96
181
  return node;
97
182
  };
98
- // `isPropertyMap` marks the value of `properties`/`patternProperties`: its
99
- // keys are the tool's OWN field names, not schema keywords, so a field
100
- // literally named `format`, `$ref` or `definitions` must survive untouched
101
- // (its VALUE is still a schema and is walked as one).
183
+ // The pointers currently being inlined, on THIS path. A `$ref` that points
184
+ // at a schema we are already inside is recursive: JSON Schema says that with
185
+ // the reference, and an inlined copy has no finite form.
186
+ const inlining = new Set();
187
+ // Nodes charged to the expansion budget so far, against MAX_INLINED_NODES.
188
+ let inlined = 0;
189
+ // The size of each referenced target — objects, arrays, their entries and
190
+ // scalars, one count per pointer — stopped early past the budget, since
191
+ // past it the exact number no longer matters.
192
+ const costs = new Map();
193
+ const costOf = (pointer) => {
194
+ const known = costs.get(pointer);
195
+ if (known !== undefined)
196
+ return known;
197
+ // Counted with a bounded frontier: children are pushed one at a time and
198
+ // only while the count is under the cap, so a target wider than the
199
+ // budget costs the cap in work and in memory, never its own width.
200
+ let count = 0;
201
+ const stack = [resolvePointer(pointer)];
202
+ const over = () => count + stack.length > MAX_INLINED_NODES;
203
+ while (stack.length > 0 && !over()) {
204
+ const item = stack.pop();
205
+ count += 1;
206
+ if (!item || typeof item !== 'object')
207
+ continue;
208
+ if (Array.isArray(item)) {
209
+ for (let i = 0; i < item.length && !over(); i += 1)
210
+ stack.push(item[i]);
211
+ }
212
+ else {
213
+ for (const key in item) {
214
+ if (over())
215
+ break;
216
+ if (Object.prototype.hasOwnProperty.call(item, key))
217
+ stack.push(item[key]);
218
+ }
219
+ }
220
+ }
221
+ const cost = over() ? MAX_INLINED_NODES + 1 : count;
222
+ costs.set(pointer, cost);
223
+ return cost;
224
+ };
225
+ // `isPropertyMap` marks the value of `properties`/`patternProperties`, and
226
+ // of `dependentSchemas`/`dependencies`: its keys are the tool's OWN field
227
+ // names, not schema keywords, so a field literally named `format`, `$ref`,
228
+ // `definitions` or `default` must survive untouched (its VALUE is still a
229
+ // schema and is walked as one).
102
230
  const walk = (node, depth, isPropertyMap = false) => {
103
- if (depth > 20)
104
- return {}; // recursion/cycle guard — permissive fallback
105
- if (Array.isArray(node))
106
- return node.map((item) => walk(item, depth + 1));
231
+ // Stack guard, not a schema rule: `$ref` recursion is caught below, so
232
+ // nothing a server legitimately sends reaches this. Stopping must never
233
+ // make a schema INVALID — which is exactly what the old cap did, by
234
+ // returning `{}` at whatever position it had reached.
235
+ if (depth > MAX_SANITIZE_DEPTH)
236
+ return stripPastDepth(node);
107
237
  if (!node || typeof node !== 'object')
108
238
  return node;
239
+ if (Array.isArray(node))
240
+ return node.map((item) => walk(item, depth + 1));
109
241
  const obj = node;
110
- if (!isPropertyMap && typeof obj.$ref === 'string') {
111
- const target = resolvePointer(obj.$ref);
242
+ // `$dynamicRef` is a reference like `$ref` (2020-12's late-bound form):
243
+ // resolved the same way when it is a local pointer, degraded the same way
244
+ // when it is not — never left standing, because the `$defs` block it
245
+ // reaches into is dropped below and a dangling reference is what clients
246
+ // reject. Both at once is legal and both apply, so both are inlined, as
247
+ // the `allOf` they amount to.
248
+ const references = ['$ref', '$dynamicRef']
249
+ .map((keyword) => obj[keyword])
250
+ .filter((value) => typeof value === 'string');
251
+ if (!isPropertyMap && references.length > 0) {
112
252
  // JSON Schema allows siblings next to $ref; keep them, target wins ties.
113
253
  const siblings = { ...obj };
114
254
  delete siblings.$ref;
115
- const resolved = walk(target ?? {}, depth + 1);
116
- return resolved && typeof resolved === 'object' && !Array.isArray(resolved)
117
- ? { ...siblings, ...resolved }
118
- : Object.keys(siblings).length
119
- ? siblings
120
- : resolved ?? {};
255
+ delete siblings.$dynamicRef;
256
+ // Sanitized ONCE, here, because every path below can return them: the
257
+ // siblings are schema keywords in their own right, and an unsupported
258
+ // `format` or a nested `$ref` left in them is precisely what this
259
+ // function exists to keep out of a listing. (`siblings` no longer holds
260
+ // a `$ref`, so this cannot re-enter this branch at this node; deeper
261
+ // ones terminate on `inlining` or on the depth cap.)
262
+ const kept = Object.keys(siblings).length ? walk(siblings, depth + 1) : null;
263
+ // Recursive, or past the expansion budget: `{}` ("any value") is the only
264
+ // finite answer, and a `$ref` stands at a schema position, so `{}` there
265
+ // is valid JSON Schema. The reference itself has to go — the `$defs`
266
+ // block it points into is dropped below, and a dangling `$ref` is what
267
+ // clients reject.
268
+ //
269
+ // The budget is charged AT THE REFERENCE, by the whole size of what it
270
+ // would copy — every object, array, array entry and scalar in the
271
+ // target, counted once per pointer — before a byte of it is copied. A
272
+ // target that does not fit the remaining budget is `{}` whole, never a
273
+ // partial copy: the only thing a copy can cost is what the reference
274
+ // multiplies, and that is the target's full size whatever shapes it is
275
+ // made of (a `required` list of ten thousand names as much as ten
276
+ // thousand properties).
277
+ const resolveOne = (pointer) => {
278
+ if (inlining.has(pointer))
279
+ return {};
280
+ const cost = costOf(pointer);
281
+ if (inlined + cost > MAX_INLINED_NODES)
282
+ return {};
283
+ inlined += cost;
284
+ inlining.add(pointer);
285
+ try {
286
+ return walk(resolvePointer(pointer) ?? {}, depth + 1);
287
+ }
288
+ finally {
289
+ inlining.delete(pointer);
290
+ }
291
+ };
292
+ const asObject = (value) => value && typeof value === 'object' && !Array.isArray(value) ? value : {};
293
+ if (references.length === 1) {
294
+ const resolved = resolveOne(references[0]);
295
+ // An object target merges over the siblings; a boolean target is a
296
+ // schema in its own right (`false` rejects everything) and stands
297
+ // alone, or under `allOf` beside siblings; anything else a pointer
298
+ // can land on — a string, a number, an array — is not a schema and
299
+ // becomes `{}`, never the raw value.
300
+ if (typeof resolved === 'boolean') {
301
+ return kept ? { ...kept, allOf: [...(Array.isArray(kept.allOf) ? kept.allOf : []), resolved] } : resolved;
302
+ }
303
+ return { ...(kept ?? {}), ...asObject(resolved) };
304
+ }
305
+ // A boolean target is a schema too (`false` rejects everything) and is
306
+ // kept as it is; anything that is not an object schema is `{}`.
307
+ const targets = references.map((pointer) => {
308
+ const resolved = resolveOne(pointer);
309
+ return typeof resolved === 'boolean' ? resolved : asObject(resolved);
310
+ });
311
+ const allOf = Array.isArray(kept?.allOf) ? kept.allOf : [];
312
+ return { ...(kept ?? {}), allOf: [...allOf, ...targets] };
121
313
  }
122
314
  const out = {};
123
315
  for (const [key, value] of Object.entries(obj)) {
@@ -127,12 +319,21 @@ export function sanitizeInputSchema(schema) {
127
319
  }
128
320
  if (key === '$defs' || key === 'definitions')
129
321
  continue; // inlined above
322
+ // Instance DATA, not a schema: handed back exactly as it came. A `default`
323
+ // or an `enum` entry that happens to carry a key named `format` or `$ref`
324
+ // is a value the tool expects, not a construct to rewrite — and since the
325
+ // walk never descends into one, the depth cap cannot reach inside it
326
+ // either.
327
+ if (DATA_VALUED_KEYWORDS.has(key)) {
328
+ out[key] = value;
329
+ continue;
330
+ }
130
331
  // Drop a non-standard `format` (OpenAPI `int32`/`byte`/…) — the validator
131
332
  // only allows the JSON-Schema-standard set; the annotation is non-load-bearing.
132
333
  if (key === 'format' && (typeof value !== 'string' || !SUPPORTED_SCHEMA_FORMATS.has(value))) {
133
334
  continue;
134
335
  }
135
- out[key] = walk(value, depth + 1, key === 'properties' || key === 'patternProperties');
336
+ out[key] = walk(value, depth + 1, key === 'properties' || key === 'patternProperties' || key === 'dependentSchemas' || key === 'dependencies');
136
337
  }
137
338
  return out;
138
339
  };
@@ -1 +1 @@
1
- {"version":3,"file":"proxied-tool.js","sourceRoot":"","sources":["../src/proxied-tool.ts"],"names":[],"mappings":"AAcA;;;;;;;;;GASG;AACH,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAC5C,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,sFAAsF;AACtF,MAAM,UAAU,YAAY,CAAC,IAAiB;IAC5C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,iBAAiB,EAAE,CAAC;QACpF,OAAO,CAAC,IAAI,CACV,wBAAwB,IAAI,CAAC,OAAO,iDAAiD;YACnF,eAAe,gBAAgB,YAAY,iBAAiB,WAAW;YACvE,yFAAyF,CAC5F,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,4EAA4E;IAC5E,8EAA8E;IAC9E,0EAA0E;IAC1E,oBAAoB;IACpB,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC;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?
3
+ *
4
+ * AI clients ask this question themselves, and when the answer is no they drop
5
+ * the tool WITHOUT SAYING SO: the tool is simply missing for the agent, with
6
+ * nothing in Hexis to look at. So Hexis asks it first, when a server's tools
7
+ * are loaded, and keeps such a tool off every agent surface with a marker the
8
+ * server's owner can read.
9
+ *
10
+ * The check is the JSON Schema META-SCHEMA (2020-12, the draft the MCP
11
+ * specification names), run by `ajv` — the same validator the MCP SDK and the
12
+ * clients use, so a tool is hidden on exactly the violations a client would
13
+ * also refuse, and the reason is quoted in the words the client reports. The
14
+ * three refusals this started from reproduce to the character:
15
+ *
16
+ * /properties/…/socialLinks/items/anyOf must be an array
17
+ * /properties/…/value/anyOf/0/required/0 must be a string
18
+ * /properties/…/value/properties/table/type must be equal to one of the allowed values
19
+ *
20
+ * One thing the meta-schema does not cover is checked beside it: a `pattern`
21
+ * (or a `patternProperties` key) that is not a compilable regular expression.
22
+ * The meta-schema says only that it is a string, while a client COMPILES it and
23
+ * drops the tool when that throws — see {@link regexDefect}.
24
+ *
25
+ * NOT a repair. Nothing here rewrites a schema — the proxy passes a connected
26
+ * server's schema through as sent, and an invalid one is reported, never fixed.
27
+ */
28
+ /** Where a schema is not valid JSON Schema, and why. */
29
+ export interface SchemaDefect {
30
+ /** JSON Pointer into the schema, e.g. `/properties/value/required/0`. */
31
+ path: string;
32
+ /** The violation in the validator's own words, e.g. `must be a string`. */
33
+ reason: string;
34
+ }
35
+ /**
36
+ * The first place `schema` is not valid JSON Schema, or `null` when it is.
37
+ *
38
+ * FAIL-OPEN: a schema the validator itself cannot process (an unknown
39
+ * `$schema` dialect, say) is reported as having no defect. A validator fault
40
+ * is not evidence against the tool, and the cost of being wrong here is one
41
+ * tool hidden from every agent.
42
+ */
43
+ export declare function inputSchemaDefect(schema: unknown): SchemaDefect | null;
44
+ /**
45
+ * The sentence the tool's owner reads, wherever the marker is shown — the tool
46
+ * setup page and `list_tool_setup` say the same thing in the same words,
47
+ * because they are the same finding.
48
+ */
49
+ export declare function schemaDefectMarker(defect: SchemaDefect): string;
50
+ //# sourceMappingURL=schema-validity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-validity.d.ts","sourceRoot":"","sources":["../src/schema-validity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,wDAAwD;AACxD,MAAM,WAAW,YAAY;IAC3B,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;CAChB;AAsCD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAwBtE;AA8ID;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAE/D"}