@mastra/mcp 1.3.1 → 1.3.2
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/CHANGELOG.md +18 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-tools-mcp-client.md +1 -1
- package/dist/index.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/server/server.d.ts.map +1 -1
- package/package.json +7 -5
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AsyncLocalStorage } from 'async_hooks';
|
|
|
2
2
|
import $RefParser from '@apidevtools/json-schema-ref-parser';
|
|
3
3
|
import { MastraBase } from '@mastra/core/base';
|
|
4
4
|
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
5
|
-
import { createTool } from '@mastra/core/tools';
|
|
5
|
+
import { createTool, isValidationError } from '@mastra/core/tools';
|
|
6
6
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
7
7
|
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
8
8
|
import { StdioClientTransport, getDefaultEnvironment } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
@@ -2812,8 +2812,17 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
|
|
|
2812
2812
|
}
|
|
2813
2813
|
};
|
|
2814
2814
|
const result = await tool.execute(validation?.value ?? request.params.arguments ?? {}, mcpOptions);
|
|
2815
|
-
this.logger.debug(`CallTool: Tool '${request.params.name}' executed successfully with result:`, result);
|
|
2816
2815
|
const duration = Date.now() - startTime;
|
|
2816
|
+
if (isValidationError(result)) {
|
|
2817
|
+
this.logger.warn(`CallTool: Tool '${request.params.name}' returned a validation error in ${duration}ms.`, {
|
|
2818
|
+
error: result.message
|
|
2819
|
+
});
|
|
2820
|
+
return {
|
|
2821
|
+
content: [{ type: "text", text: result.message }],
|
|
2822
|
+
isError: true
|
|
2823
|
+
};
|
|
2824
|
+
}
|
|
2825
|
+
this.logger.debug(`CallTool: Tool '${request.params.name}' executed successfully with result:`, result);
|
|
2817
2826
|
this.logger.info(`Tool '${request.params.name}' executed successfully in ${duration}ms.`);
|
|
2818
2827
|
const response = { isError: false, content: [] };
|
|
2819
2828
|
if (tool.outputSchema) {
|