skedyul 1.0.21 → 1.0.23

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/.build-stamp CHANGED
@@ -1 +1 @@
1
- 1773896446931
1
+ 1773979023721
@@ -191,11 +191,14 @@ function createSkedyulServer(config, registry, webhookRegistry) {
191
191
  invocation: toolInvocation,
192
192
  });
193
193
  // Handle error case
194
+ const hasOutputSchema = Boolean(outputZodSchema);
194
195
  if (result.error) {
195
196
  const errorOutput = { error: result.error };
196
197
  return {
197
198
  content: [{ type: 'text', text: JSON.stringify(errorOutput) }],
198
- structuredContent: errorOutput,
199
+ // Don't provide structuredContent for error responses when tool has outputSchema
200
+ // because the error response won't match the success schema and MCP SDK validates it
201
+ structuredContent: hasOutputSchema ? undefined : errorOutput,
199
202
  isError: true,
200
203
  billing: result.billing,
201
204
  };
@@ -204,11 +207,20 @@ function createSkedyulServer(config, registry, webhookRegistry) {
204
207
  // Note: effect is embedded in structuredContent because the MCP SDK
205
208
  // transport strips custom top-level fields in dedicated mode
206
209
  const outputData = result.output;
207
- const structuredContent = outputData
208
- ? { ...outputData, __effect: result.effect }
209
- : result.effect
210
- ? { __effect: result.effect }
211
- : undefined;
210
+ // MCP SDK requires structuredContent when outputSchema is defined
211
+ // Always provide it (even as empty object) to satisfy validation
212
+ let structuredContent;
213
+ if (outputData) {
214
+ structuredContent = { ...outputData, __effect: result.effect };
215
+ }
216
+ else if (result.effect) {
217
+ structuredContent = { __effect: result.effect };
218
+ }
219
+ else if (hasOutputSchema) {
220
+ // Tool has outputSchema but returned null/undefined output
221
+ // Provide empty object to satisfy MCP SDK validation
222
+ structuredContent = {};
223
+ }
212
224
  return {
213
225
  content: [{ type: 'text', text: JSON.stringify(result.output) }],
214
226
  structuredContent,
@@ -633,18 +633,29 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
633
633
  const errorOutput = { error: toolResult.error };
634
634
  result = {
635
635
  content: [{ type: 'text', text: JSON.stringify(errorOutput) }],
636
- structuredContent: errorOutput,
636
+ // Don't provide structuredContent for error responses when tool has outputSchema
637
+ // because the error response won't match the success schema and MCP SDK validates it
638
+ structuredContent: hasOutputSchema ? undefined : errorOutput,
637
639
  isError: true,
638
640
  billing: toolResult.billing,
639
641
  };
640
642
  }
641
643
  else {
642
644
  const outputData = toolResult.output;
643
- const structuredContent = outputData
644
- ? { ...outputData, __effect: toolResult.effect }
645
- : toolResult.effect
646
- ? { __effect: toolResult.effect }
647
- : undefined;
645
+ // MCP SDK requires structuredContent when outputSchema is defined
646
+ // Always provide it (even as empty object) to satisfy validation
647
+ let structuredContent;
648
+ if (outputData) {
649
+ structuredContent = { ...outputData, __effect: toolResult.effect };
650
+ }
651
+ else if (toolResult.effect) {
652
+ structuredContent = { __effect: toolResult.effect };
653
+ }
654
+ else if (hasOutputSchema) {
655
+ // Tool has outputSchema but returned null/undefined output
656
+ // Provide empty object to satisfy MCP SDK validation
657
+ structuredContent = {};
658
+ }
648
659
  result = {
649
660
  content: [{ type: 'text', text: JSON.stringify(toolResult.output) }],
650
661
  structuredContent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",