@mastra/mcp 2.6.0-alpha.1 → 2.6.0-alpha.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/dist/index.js CHANGED
@@ -20877,21 +20877,31 @@ var MCPServer = class extends MCPServerBase {
20877
20877
  ui: { resourceUri },
20878
20878
  [RESOURCE_URI_META_KEY]: resourceUri
20879
20879
  } } : {};
20880
- if (!tool.outputSchema) return {
20881
- isError: false,
20882
- content: [{
20883
- type: "text",
20884
- text: typeof value === "string" ? value : JSON.stringify(value)
20885
- }],
20886
- ...meta
20887
- };
20888
- const structuredContent = value;
20880
+ if (!tool.outputSchema) {
20881
+ const text = typeof value === "string" ? value : JSON.stringify(value);
20882
+ return {
20883
+ isError: false,
20884
+ content: text === void 0 ? [] : [{
20885
+ type: "text",
20886
+ text
20887
+ }],
20888
+ ...meta
20889
+ };
20890
+ }
20891
+ const text = JSON.stringify(value);
20892
+ if (text === void 0) {
20893
+ this.logger.warn(`Tool '${name}' declares an outputSchema but returned no structured output.`);
20894
+ return {
20895
+ ...errorResult$1(`Tool '${name}' declares an outputSchema but returned no output.`),
20896
+ ...meta
20897
+ };
20898
+ }
20889
20899
  return {
20890
20900
  isError: false,
20891
- structuredContent,
20901
+ structuredContent: value,
20892
20902
  content: [{
20893
20903
  type: "text",
20894
- text: JSON.stringify(structuredContent)
20904
+ text
20895
20905
  }],
20896
20906
  ...meta
20897
20907
  };