@zackbart/connecta 0.14.2 → 0.15.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/src/catalog.ts CHANGED
@@ -3,6 +3,8 @@ import type { JsonSchema, ToolDef } from "./types.js";
3
3
  const DEFAULT_DESCRIPTION_LENGTH = 240;
4
4
  const DISCOVERY_DESCRIPTION_LENGTH = 160;
5
5
  export const MAX_COMPACT_DISCOVERY_SCHEMA_BYTES = 1_024;
6
+ const MAX_COMPACT_DISCOVERY_ENUM_BYTES =
7
+ MAX_COMPACT_DISCOVERY_SCHEMA_BYTES / 4;
6
8
  const schemaEncoder = new TextEncoder();
7
9
  const COMPACT_DISCOVERY_TRUNCATION = " /* truncated */";
8
10
 
@@ -126,6 +128,8 @@ export interface RankedTool {
126
128
  tool: ToolDef;
127
129
  score: number;
128
130
  order: number;
131
+ exactName: boolean;
132
+ matchedTermCount: number;
129
133
  }
130
134
 
131
135
  const searchIndexes = new WeakMap<ToolDef[], SearchIndex>();
@@ -304,8 +308,8 @@ function scoreDocument(
304
308
  terms: string[],
305
309
  mode: LexicalMatchMode,
306
310
  statistics: LexicalCorpusStatistics,
307
- ): number | null {
308
- if (!phrase) return 0;
311
+ ): { score: number; matchedTermCount: number } | null {
312
+ if (!phrase) return { score: 0, matchedTermCount: 0 };
309
313
  const matchedTerms = terms.filter((term) =>
310
314
  statistics.nameMatches.get(term)?.has(doc.tool) ||
311
315
  statistics.descriptionMatches.get(term)?.has(doc.tool),
@@ -343,10 +347,19 @@ function scoreDocument(
343
347
  score += 1.5 * weight;
344
348
  }
345
349
  }
346
- return score;
350
+ return { score, matchedTermCount: matchedTerms.length };
347
351
  }
348
352
 
349
- /** Rank a connector's tools while caching its normalized plain-data index. */
353
+ function queryContainsExactName(doc: SearchDocument, phrase: string): boolean {
354
+ if (!doc.name || !phrase) return false;
355
+ return (` ${phrase} `).includes(` ${doc.name} `);
356
+ }
357
+
358
+ /**
359
+ * Rank a connector's tools while caching its normalized plain-data index.
360
+ * `exactNameQuery` may retain framing removed from the scoring query: those
361
+ * words are weak term evidence, but remain part of a real tool-name phrase.
362
+ */
350
363
  export function rankTools(
351
364
  tools: ToolDef[],
352
365
  query: string,
@@ -355,13 +368,23 @@ export function rankTools(
355
368
  [tools],
356
369
  query,
357
370
  ),
371
+ exactNameQuery: string = query,
358
372
  ): RankedTool[] {
359
373
  const phrase = normalized(query);
374
+ const exactNamePhrase = normalized(exactNameQuery);
360
375
  const terms = [...new Set(phrase.split(/\s+/).filter(Boolean))];
361
376
  const ranked: RankedTool[] = [];
362
377
  documentsFor(tools).forEach((doc, order) => {
363
- const score = scoreDocument(doc, phrase, terms, mode, statistics);
364
- if (score !== null) ranked.push({ tool: doc.tool, score, order });
378
+ const scored = scoreDocument(doc, phrase, terms, mode, statistics);
379
+ if (scored !== null) {
380
+ ranked.push({
381
+ tool: doc.tool,
382
+ score: scored.score,
383
+ order,
384
+ exactName: queryContainsExactName(doc, exactNamePhrase),
385
+ matchedTermCount: scored.matchedTermCount,
386
+ });
387
+ }
365
388
  });
366
389
  return ranked;
367
390
  }
@@ -405,6 +428,36 @@ function grouped(part: string): string {
405
428
  return part;
406
429
  }
407
430
 
431
+ function renderEnum(
432
+ values: unknown[],
433
+ byteLimit: number | undefined,
434
+ onTruncated: (() => void) | undefined,
435
+ ): string {
436
+ if (values.length === 0) return "never";
437
+ const renderedValues = values.map((value) => JSON.stringify(value));
438
+ const full = renderedValues.join(" | ");
439
+ if (
440
+ byteLimit === undefined ||
441
+ schemaEncoder.encode(full).length <= byteLimit
442
+ ) {
443
+ return full;
444
+ }
445
+
446
+ onTruncated?.();
447
+ const marker = (omitted: number) =>
448
+ `unknown /* ${omitted} enum ${omitted === 1 ? "value" : "values"} omitted */`;
449
+ let rendered = `(${marker(values.length)})`;
450
+ const prefix: string[] = [];
451
+ for (let index = 0; index < renderedValues.length - 1; index += 1) {
452
+ prefix.push(renderedValues[index] as string);
453
+ const omitted = renderedValues.length - prefix.length;
454
+ const candidate = `(${prefix.join(" | ")} | ${marker(omitted)})`;
455
+ if (schemaEncoder.encode(candidate).length > byteLimit) break;
456
+ rendered = candidate;
457
+ }
458
+ return rendered;
459
+ }
460
+
408
461
  function renderSchema(
409
462
  schema: unknown,
410
463
  defs: Record<string, unknown>,
@@ -413,6 +466,8 @@ function renderSchema(
413
466
  options: {
414
467
  propertyDescriptions: boolean;
415
468
  requiredFirst: boolean;
469
+ enumByteLimit?: number;
470
+ onEnumTruncated?: () => void;
416
471
  },
417
472
  ): string {
418
473
  if (depth > 4) return "…";
@@ -463,7 +518,7 @@ function renderSchema(
463
518
  );
464
519
  }
465
520
  if (Array.isArray(s.enum)) {
466
- return s.enum.map((value) => JSON.stringify(value)).join(" | ");
521
+ return renderEnum(s.enum, options.enumByteLimit, options.onEnumTruncated);
467
522
  }
468
523
  // Checked before type/properties so a discriminator like
469
524
  // { type: "string", const: "emoji" } renders as "emoji" rather than string.
@@ -602,10 +657,18 @@ export function compactDiscoverySchema(
602
657
  ...(schema.definitions as Record<string, unknown>),
603
658
  };
604
659
  let rendered: string;
660
+ let enumTruncated = false;
605
661
  try {
606
662
  rendered = renderSchema(schema, defs, new Set(), 0, {
607
663
  propertyDescriptions: false,
608
664
  requiredFirst: true,
665
+ // Three near-cap enums spend about three quarters of the complete shape
666
+ // budget, leaving the final quarter for surrounding syntax before the
667
+ // unchanged global fallback applies. Whole values keep this UTF-8 safe.
668
+ enumByteLimit: MAX_COMPACT_DISCOVERY_ENUM_BYTES,
669
+ onEnumTruncated: () => {
670
+ enumTruncated = true;
671
+ },
609
672
  });
610
673
  } catch {
611
674
  rendered = JSON.stringify(schema);
@@ -613,7 +676,7 @@ export function compactDiscoverySchema(
613
676
  const bytes = schemaEncoder.encode(rendered);
614
677
  let result: CompactDiscoverySchema;
615
678
  if (bytes.length <= MAX_COMPACT_DISCOVERY_SCHEMA_BYTES) {
616
- result = { text: rendered, truncated: false };
679
+ result = { text: rendered, truncated: enumTruncated };
617
680
  } else {
618
681
  result = {
619
682
  text: truncatedDiscoverySchema(schema),
@@ -86,10 +86,10 @@ export interface ApiOptions {
86
86
  * conversion if you prefer zod). call_tool JSON-wraps the handler's return.
87
87
  *
88
88
  * Arguments are validated against `inputSchema` before the handler runs
89
- * (disable with `validateArgs: false`). This is deliberately asymmetric with
90
- * remote MCP connectors, which stay pass-through: the downstream server is
91
- * authoritative for its own schemas, and re-validating with our JSON Schema
92
- * draft/format semantics could reject calls the downstream would accept.
89
+ * (disable with `validateArgs: false`). Remote MCP inputs are also validated,
90
+ * but in the shared invocation path against the request-local downstream
91
+ * catalog. These API-only controls stay here because hand-written handlers may
92
+ * deliberately accept loose coercion or choose fail-closed schema handling.
93
93
  */
94
94
  export function api(id: string, opts: ApiOptions): Connector {
95
95
  const defs: ToolDef[] = opts.tools.map((t) => ({
package/src/execute.ts CHANGED
@@ -1274,19 +1274,20 @@ function discardedEmitsText(emitted: EmitCollector): string {
1274
1274
  const executeDescription = (
1275
1275
  emitBudgets: { maxBytes: number; maxBlocks: number },
1276
1276
  connectorGuides: boolean,
1277
- ) => `Choose the route before discovery. Exactly one unknown-address read uses top-level search_tools then call_tool; a known address uses call_tool directly. This is the primary surface for everything wider. If any result will be reduced — even from one connector call — or work has dependent/multiple calls, loops, joins, or branches, make exactly one execute_code call that searches, selects, calls, and reduces before returning. A discovery-only program wastes its round trip: finish here, don't return catalog matches for a later call. Only readOnlyHint: true tools are available. Limits: ${EXECUTE_MAX_HOST_CALLS} host calls per run, ${EXECUTE_MAX_BATCH_CALLS} per batch, ${EXECUTE_HOST_CALL_TIMEOUT_MS / 1_000}-second host deadline.
1277
+ ) => `Choose the route before discovery. Exactly one unknown-address read uses top-level search_tools then call_tool; a known address uses call_tool directly. This is the primary surface for everything wider. For any reduction, dependency, multiple calls, loop, join, or branch, make exactly one execute_code call that searches, selects, calls, and reduces. A discovery-only program wastes its round trip: finish here, don't return catalog matches for a later call. Only readOnlyHint: true tools are available. Limits: ${EXECUTE_MAX_HOST_CALLS} host calls per run, ${EXECUTE_MAX_BATCH_CALLS} per batch, ${EXECUTE_HOST_CALL_TIMEOUT_MS / 1_000}-second host deadline.
1278
1278
 
1279
- Write an async arrow function. It runs with NO network, filesystem, timers, or imports — the only capabilities are:
1280
- - Connector globals call <connectorId>.<toolName>(args) with one schema-matching args object. Sanitization: non-[A-Za-z0-9_$] → "_" (my-service.get.thing → my_service.get_thing), leading digit "_" prefix, reserved word → "_" suffix.
1281
- - connecta.call(address, args) and connecta.batch(calls) call raw addresses. Every batch entry is { address, ok: true, data } or { address, ok: false, error, errorDetails: { code, retryable } }; destructure that, not a bare result.
1282
- - connecta.search(args) loads catalogs and must be followed by selection and calls in this program; set connector to the obvious id to load one, otherwise it loads all. For distinct operations, make separate short searches here. Require address/description to match the operation, then check requiredInputKeys, truncation, safety, and outputs; never take the first lexical or merely input-compatible match. Choose the best compatible match; do not require it to be the only match. Missing outputKeys means inspect outputSchema, not discard the candidate. Compatible means every required key has a task/prior-result value; do not prefer zero required keys. Put every requiredInputKey in call args. For dependencies, match an earlier outputKey to the later requiredInputKey. Use displayed names; [] means no required keys, not permission to invent args. Describe only a truncated/insufficient compact shape. Reducers use declared outputKeys, never guessed items/results roots. connecta.describe takes { address: "<connectorId>.<toolName>" } or { addresses: [...] }. Use safety: "readOnly" to avoid advertising calls this sandbox cannot execute; it changes results, not authority. A missing key list means a non-object shape, not no fields — read the schema.${connectorGuides ? " A match with guideRequired: true is a hard stop: do not call it; describing the exact schema clears only a schema_truncated reason, so for any other reason return the exact guide name, fetch that guide with the top-level skills tool, then write the informed call." : ""}
1279
+ Write an async arrow function. NO network, filesystem, timers, or imports; only:
1280
+ - Connector globals call <connectorId>.<toolName>(args). Sanitization: non-[A-Za-z0-9_$] → "_" (my-service.get.thing → my_service.get_thing); prefix a leading digit; suffix a reserved word.
1281
+ - connecta.call(address, args) and connecta.batch(calls) use canonical addresses. Every batch entry is { address, ok: true, data } or { address, ok: false, error, errorDetails: { code, retryable } }; destructure it.
1282
+ - top-level search_tools returns { connectors: [{ id, tools }], total, offset, limit, hasMore }; connecta.search returns { tools, total, offset, limit, hasMore }; connecta.describe returns { tools }.
1283
+ - connecta.search(args) loads catalogs and must be followed by selection and calls in this program; set connector to the obvious id to load one, otherwise it loads all. For distinct operations, make separate short searches here. Require address/description to match the operation, then check requiredInputKeys, truncation, safety, and outputs; never take the first lexical or merely input-compatible match. Select by fit; do not require it to be the only match. Missing outputKeys means inspect outputSchema, not discard the candidate. Every required key needs task/prior-result data; do not prefer zero required keys. Put every requiredInputKey in call args. For dependencies, match an earlier outputKey to the later requiredInputKey. [] means no required keys, not permission to invent args. Describe only a truncated/insufficient compact shape. Reducers use declared outputKeys, never guessed items/results roots. connecta.describe takes { address: "<connectorId>.<toolName>" } or { addresses: [...] }. Use safety: "readOnly" to avoid advertising calls this sandbox cannot execute; it changes results, not authority. Missing key list = non-object, not no fields; read the schema.${connectorGuides ? " guideRequired: true = stop. Describe clears only schema_truncated; otherwise return its exact guide, fetch with top-level skills, then write the informed call." : ""}
1283
1284
  - connecta.emit(block) — emit exactly { type: "text", text } or { type: "image" | "audio", data (base64), mimeType }. Success-only, no host call, ${emitBudgets.maxBlocks} blocks/${emitBudgets.maxBytes} bytes; invalid or over-budget throws before accepting.
1284
- - connecta.ui(html, options?) — one success-only view. One arg is display-only; live reads use { reads: { name: { address, fixedArgs?, viewArgs? } } }, then markup calls connecta.read(name, args). Read admission is enforced; fixed keys cannot be overridden and undeclared keys fail. It shares the ${emitBudgets.maxBytes}-byte emit budget one budget, not two; a second, over-budget, or invalid call throws catchably. Bytes stay out of context, so the model reads the return value, not the view: return the initial summary from its variables; later reads update only the view.
1285
+ - connecta.ui(html, options?) — one success-only view; one arg is display-only. Reads declare { reads: { name: { address, fixedArgs?, viewArgs? } } }; markup calls connecta.read(name, args). Admission applies. It shares the ${emitBudgets.maxBytes}-byte emit budget: one budget, not two; a second, over-budget, or invalid call throws catchably. Bytes stay out; the model reads the return value, not the view; return the initial summary from its variables.
1285
1286
  - console.log(...) — captured and returned with the result.
1286
1287
 
1287
1288
  Dependent example (only when the second call requires a value returned by the first): async () => { const { tools } = await connecta.search({ query: "pipeline run job logs", safety: "readOnly", includeSchemas: "compact" }); const pick = (suffix) => { const match = tools.find((t) => t.address.endsWith(suffix)); if (!match) throw new Error("no tool for " + suffix); return match.address; }; const run = await connecta.call(pick(".get_run"), { runId: 42 }); const logs = await connecta.call(pick(".get_job_logs"), { jobId: run.failedJobId }); return [run, logs]; }
1288
1289
 
1289
- Calls return plain values (JSON-parsing MCP text when possible) and throw; catch errors. A thrown error is only a message; connecta.batch tells a policy refusal from a transient failure. Never retry retryable: false or rate_limited immediately — there are no timers. Return JSON; large results truncate, so reduce instead of returning raw payloads.
1290
+ Calls return plain values (JSON-parsing MCP text when possible) and throw; catch errors. A thrown error is only a message; connecta.batch tells a policy refusal from a transient failure. Never retry retryable: false, or rate_limited immediately; no timers. Return JSON; reduce large results before they truncate.
1290
1291
 
1291
1292
  Plain JS, no TypeScript. Compact schemas are TypeScript-like, not JSON Schema: write the property names they display; never guess positions or aliases.`;
1292
1293
 
package/src/meta-tools.ts CHANGED
@@ -1372,7 +1372,7 @@ export function createMetaTools(
1372
1372
  };
1373
1373
  }
1374
1374
 
1375
- const SEARCH_DESC = `Use top-level search only for exactly one unreduced read, then call_tool, or for write-capable work, then call_destructive_tool. For read-only reduction, dependent or multiple calls, never search here: make one execute_code program that searches and calls. Use 2–4 distinctive action/object terms, not the full request; set connector to the obvious integration id to load one catalog instead of all; omit limit initially (default ${DEFAULT_SEARCH_LIMIT}), page to ${MAX_SEARCH_LIMIT} if needed. safety="readOnly" returns only calls available to call_tool/code; "approvalRequired" returns the rest; omitted/"all" returns all. This filters results, not authority. includeSchemas="compact" adds the input and any declared output shape, bounded; plain objects expose inputKeys, requiredInputKeys, and outputKeys; truncation flags mark incomplete shapes; matches also carry declared annotations. Require purpose/address fit plus compatible inputs, truncation, safety, and outputs — never the first lexical match. Empty query browses all.`;
1375
+ const SEARCH_DESC = `Use top-level search only for exactly one unreduced read, then call_tool, or for write-capable work, then call_destructive_tool. For read-only reduction, dependent or multiple calls, never search here: make one execute_code program that searches and calls. Use 2–4 distinctive action/object terms, not the full request; set connector to the obvious integration id to load one catalog instead of all; omit limit initially (default ${DEFAULT_SEARCH_LIMIT}), page to ${MAX_SEARCH_LIMIT} if needed. safety="readOnly" returns only calls available to call_tool/code; "approvalRequired" returns the rest; omitted/"all" returns all. This filters results, not authority. includeSchemas="compact" adds the input and any declared output shape, bounded; plain objects expose inputKeys, requiredInputKeys, and outputKeys; truncation flags mark incomplete shapes; matches also carry declared annotations. Require purpose/address fit plus compatible inputs, truncation, safety, and outputs — never the first lexical match. Empty or whitespace-only query browses all; non-empty input with no ASCII terms returns no match.`;
1376
1376
  const CALL_DESC =
1377
1377
  'Use for ONE tool explicitly annotated readOnlyHint: true — the cheapest path for a single cold call. For two or more calls, dependent steps, loops, joins, or data reduction use execute_code, whose connecta.call and connecta.batch reach the same tools. Unannotated, write-capable, and destructive tools are refused and require call_destructive_tool. fields selects JSON dot-paths; traverse arrays with [] (for example results[].id). Misses return data plus `$connecta` feedback. resultMode "value" unwraps results, timeoutMs sets a deadline, safe maxRetries are annotation-gated, diagnostics adds timing, and large results page through get_result.';
1378
1378
  const CALL_DESTRUCTIVE_DESC =
package/src/validate.ts CHANGED
@@ -57,6 +57,18 @@ interface ValidationUnit {
57
57
  error: string;
58
58
  }
59
59
 
60
+ const CONTAINER_VALIDATION_KEYWORDS = new Set([
61
+ "properties",
62
+ "items",
63
+ "allOf",
64
+ "anyOf",
65
+ "oneOf",
66
+ "if",
67
+ "not",
68
+ "patternProperties",
69
+ "additionalProperties",
70
+ ]);
71
+
60
72
  function decodePointerPart(value: string): string {
61
73
  return value.replaceAll("~1", "/").replaceAll("~0", "~");
62
74
  }
@@ -81,6 +93,110 @@ function argumentPath(location: string): string {
81
93
  return location.startsWith("#") ? location.slice(1) || "/" : "/";
82
94
  }
83
95
 
96
+ function validationUnitKey(unit: ValidationUnit): string {
97
+ return JSON.stringify([
98
+ unit.keyword,
99
+ unit.keywordLocation,
100
+ unit.instanceLocation,
101
+ unit.error,
102
+ ]);
103
+ }
104
+
105
+ function childPropertyName(
106
+ parentLocation: string,
107
+ childLocation: string,
108
+ ): string | undefined {
109
+ const prefix = parentLocation === "#" ? "#/" : `${parentLocation}/`;
110
+ if (!childLocation.startsWith(prefix)) return undefined;
111
+ const encoded = childLocation.slice(prefix.length);
112
+ return !encoded.includes("/") ? decodePointerPart(encoded) : undefined;
113
+ }
114
+
115
+ function schemaDeclaresProperty(schema: unknown, property: string): boolean {
116
+ if (schema === null || typeof schema !== "object" || Array.isArray(schema)) {
117
+ return false;
118
+ }
119
+ const record = schema as Record<string, unknown>;
120
+ const properties = record.properties;
121
+ if (
122
+ properties !== null &&
123
+ typeof properties === "object" &&
124
+ !Array.isArray(properties) &&
125
+ Object.hasOwn(properties, property)
126
+ ) {
127
+ return true;
128
+ }
129
+ const patterns = record.patternProperties;
130
+ if (
131
+ patterns === null ||
132
+ typeof patterns !== "object" ||
133
+ Array.isArray(patterns)
134
+ ) {
135
+ return false;
136
+ }
137
+ for (const pattern of Object.keys(patterns)) {
138
+ try {
139
+ if (new RegExp(pattern).test(property)) return true;
140
+ } catch {
141
+ // The validator owns schema support. An unusable pattern cannot prove
142
+ // that this additional-properties branch is a duplicate.
143
+ }
144
+ }
145
+ return false;
146
+ }
147
+
148
+ function isDuplicateAdditionalPropertiesBranch(
149
+ schema: JsonSchema,
150
+ units: ValidationUnit[],
151
+ index: number,
152
+ ): boolean {
153
+ const unit = units[index];
154
+ const wrapper = units[index - 1];
155
+ if (
156
+ unit?.keyword !== "false" ||
157
+ wrapper?.keyword !== "additionalProperties" ||
158
+ !wrapper.keywordLocation.endsWith("/additionalProperties")
159
+ ) {
160
+ return false;
161
+ }
162
+ const property = childPropertyName(
163
+ wrapper.instanceLocation,
164
+ unit.instanceLocation,
165
+ );
166
+ if (property === undefined) return false;
167
+ const parentSchemaLocation = wrapper.keywordLocation.slice(
168
+ 0,
169
+ -"/additionalProperties".length,
170
+ );
171
+ return schemaDeclaresProperty(
172
+ pointerValue(schema, parentSchemaLocation || "#"),
173
+ property,
174
+ );
175
+ }
176
+
177
+ function normalizedValidationUnits(
178
+ schema: JsonSchema,
179
+ units: ValidationUnit[],
180
+ ): ValidationUnit[] {
181
+ const seen = new Set<string>();
182
+ return units.filter((unit, index) => {
183
+ if (CONTAINER_VALIDATION_KEYWORDS.has(unit.keyword)) return false;
184
+ if (isDuplicateAdditionalPropertiesBranch(schema, units, index)) {
185
+ return false;
186
+ }
187
+ const key = validationUnitKey(unit);
188
+ if (seen.has(key)) return false;
189
+ seen.add(key);
190
+ return true;
191
+ });
192
+ }
193
+
194
+ function agentFacingValidationError(unit: ValidationUnit): string {
195
+ return unit.keyword === "false"
196
+ ? "Value is not allowed by the declared schema."
197
+ : unit.error;
198
+ }
199
+
84
200
  function expectedType(schema: JsonSchema, unit: ValidationUnit): string | undefined {
85
201
  if (unit.keyword === "type") {
86
202
  const value = pointerValue(schema, unit.keywordLocation);
@@ -120,22 +236,8 @@ function validationDetails(
120
236
  schema: JsonSchema,
121
237
  units: ValidationUnit[],
122
238
  ): ArgumentValidationDetails {
123
- const leafUnits = units.filter(
124
- (unit) =>
125
- ![
126
- "properties",
127
- "items",
128
- "allOf",
129
- "anyOf",
130
- "oneOf",
131
- "if",
132
- "not",
133
- "patternProperties",
134
- "additionalProperties",
135
- ].includes(unit.keyword),
136
- );
137
239
  const issues: ArgumentValidationIssue[] = [];
138
- for (const unit of leafUnits) {
240
+ for (const unit of units) {
139
241
  const missing =
140
242
  unit.keyword === "required"
141
243
  ? REQUIRED_PROPERTY_RE.exec(unit.error)?.[1]
@@ -246,15 +348,18 @@ export function validateToolInput(
246
348
  return opts.failClosed ? unevaluableSchema(opts.address) : null;
247
349
  }
248
350
  if (result && !result.valid) {
249
- const units = result.errors.filter((u) => u.instanceLocation !== "#");
250
- const detail = (units.length > 0 ? units : result.errors)
251
- .slice(0, 3)
252
- .map((u) => `${u.instanceLocation}: ${u.error}`)
351
+ const units = normalizedValidationUnits(schema, result.errors);
352
+ const nestedUnits = units.filter((unit) => unit.instanceLocation !== "#");
353
+ const detail = (nestedUnits.length > 0 ? nestedUnits : units)
354
+ .slice(0, MAX_ARGUMENT_VALIDATION_ISSUES)
355
+ .map((unit) =>
356
+ `${unit.instanceLocation}: ${agentFacingValidationError(unit)}`,
357
+ )
253
358
  .join("; ");
254
359
  return new ConnectorCallError(
255
360
  "invalid_args",
256
361
  `Invalid arguments for "${opts.address}": ${detail || "input does not match the tool's inputSchema"}`,
257
- { validation: validationDetails(schema, result.errors) },
362
+ { validation: validationDetails(schema, units) },
258
363
  );
259
364
  }
260
365
  return null;
package/src/version.ts CHANGED
@@ -4,4 +4,4 @@
4
4
  * a bump that forgets this file fails the build rather than shipping a stale
5
5
  * version to `/health` and to downstream MCP handshakes.
6
6
  */
7
- export const CONNECTA_VERSION = "0.14.2";
7
+ export const CONNECTA_VERSION = "0.15.0";
@@ -12,7 +12,7 @@
12
12
  "typecheck": "tsc --noEmit"
13
13
  },
14
14
  "dependencies": {
15
- "@zackbart/connecta": "0.14.2",
15
+ "@zackbart/connecta": "0.15.0",
16
16
  "quickjs-emscripten": "0.32.0"
17
17
  },
18
18
  "devDependencies": {