@lousy-agents/mcp 5.6.1 → 5.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.
@@ -40023,6 +40023,10 @@ class Protocol {
40023
40023
  this._progressHandlers.clear();
40024
40024
  this._taskProgressTokens.clear();
40025
40025
  this._pendingDebouncedNotifications.clear();
40026
+ for (const info of this._timeoutInfo.values()) {
40027
+ clearTimeout(info.timeoutId);
40028
+ }
40029
+ this._timeoutInfo.clear();
40026
40030
  // Abort all in-flight request handlers so they stop sending messages
40027
40031
  for (const controller of this._requestHandlerAbortControllers.values()) {
40028
40032
  controller.abort();
@@ -40182,7 +40186,11 @@ class Protocol {
40182
40186
  })
40183
40187
  .catch(error => this._onerror(new Error(`Failed to send response: ${error}`)))
40184
40188
  .finally(() => {
40185
- this._requestHandlerAbortControllers.delete(request.id);
40189
+ // Only delete if the stored controller is still ours; after close()+connect(),
40190
+ // a new connection may have reused the same request ID with a different controller.
40191
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
40192
+ this._requestHandlerAbortControllers.delete(request.id);
40193
+ }
40186
40194
  });
40187
40195
  }
40188
40196
  _onprogress(notification) {
@@ -42568,9 +42576,10 @@ class McpServer {
42568
42576
  }
42569
42577
  }
42570
42578
  else if (typeof firstArg === 'object' && firstArg !== null) {
42571
- // Not a ZodRawShapeCompat, so must be annotations in this position
42572
- // Case: tool(name, annotations, cb)
42573
- // Or: tool(name, description, annotations, cb)
42579
+ // ToolAnnotations values are primitives. Nested objects indicate a misplaced schema
42580
+ if (Object.values(firstArg).some(v => typeof v === 'object' && v !== null)) {
42581
+ throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
42582
+ }
42574
42583
  annotations = rest.shift();
42575
42584
  }
42576
42585
  }
@@ -42740,7 +42749,7 @@ function isZodRawShapeCompat(obj) {
42740
42749
  }
42741
42750
  /**
42742
42751
  * Converts a provided Zod schema to a Zod object if it is a ZodRawShapeCompat,
42743
- * otherwise returns the schema as is.
42752
+ * otherwise returns the schema as is. Throws if the value is not a valid Zod schema.
42744
42753
  */
42745
42754
  function getZodSchemaObject(schema) {
42746
42755
  if (!schema) {
@@ -42749,6 +42758,9 @@ function getZodSchemaObject(schema) {
42749
42758
  if (isZodRawShapeCompat(schema)) {
42750
42759
  return objectFromShape(schema);
42751
42760
  }
42761
+ if (!isZodSchemaInstance(schema)) {
42762
+ throw new Error('inputSchema must be a Zod schema or raw shape, received an unrecognized object');
42763
+ }
42752
42764
  return schema;
42753
42765
  }
42754
42766
  function promptArgumentsFromSchema(schema) {