@webmcp-auto-ui/agent 2.5.16 → 2.5.18

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/tool-layers.ts +19 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmcp-auto-ui/agent",
3
- "version": "2.5.16",
3
+ "version": "2.5.18",
4
4
  "description": "LLM agent loop + remote/WASM/local providers + MCP wrapper",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "type": "module",
@@ -189,14 +189,32 @@ export function resolveCanonicalTools(tools: McpToolDef[]): CanonicalMatch[] {
189
189
  */
190
190
  export const toolAliasMap = new Map<string, string>();
191
191
 
192
- /** Check if a schema is compatible with strict tool use (no additionalProperties: true anywhere) */
192
+ /** Check if a schema is compatible with strict tool use.
193
+ * Anthropic requires additionalProperties to be exactly `false` — reject `true` and schema objects. */
193
194
  function isStrictCompatible(schema: Record<string, unknown>): boolean {
194
195
  if (schema.additionalProperties === true) return false;
196
+ if (schema.additionalProperties && typeof schema.additionalProperties === 'object') return false;
195
197
  if (schema.properties) {
196
198
  for (const prop of Object.values(schema.properties as Record<string, Record<string, unknown>>)) {
197
199
  if (prop && typeof prop === 'object' && !isStrictCompatible(prop)) return false;
198
200
  }
199
201
  }
202
+ if (schema.items && typeof schema.items === 'object' && !Array.isArray(schema.items)) {
203
+ if (!isStrictCompatible(schema.items as Record<string, unknown>)) return false;
204
+ }
205
+ if (Array.isArray(schema.items)) {
206
+ for (const item of schema.items) {
207
+ if (item && typeof item === 'object' && !isStrictCompatible(item as Record<string, unknown>)) return false;
208
+ }
209
+ }
210
+ for (const key of ['anyOf', 'allOf'] as const) {
211
+ const arr = schema[key];
212
+ if (Array.isArray(arr)) {
213
+ for (const sub of arr) {
214
+ if (sub && typeof sub === 'object' && !isStrictCompatible(sub as Record<string, unknown>)) return false;
215
+ }
216
+ }
217
+ }
200
218
  return true;
201
219
  }
202
220