LearnNewsExamplesServices
Frontmatter
id7674
titleFix(toolService): Create union type for multiple response schemas
stateClosed
labels
bugairefactoring
assigneestobiu
createdAtOct 27, 2025, 12:35 PM
updatedAtOct 27, 2025, 1:06 PM
githubUrlhttps://github.com/neomjs/neo/issues/7674
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtOct 27, 2025, 1:06 PM

Fix(toolService): Create union type for multiple response schemas

Closed v11.0.0 bugairefactoring
tobiu
tobiu commented on Oct 27, 2025, 12:35 PM

The toolService.mjs was not correctly interpreting the OpenAPI specification to create a comprehensive output schema for tools. It only considered success responses (200, 201, 202), ignoring defined error responses (e.g., 500, 404).

This caused the MCP client to reject valid error objects returned by tools, as they did not match the success-only output schema.

This ticket covers the fix implemented in buildOutputZodSchema to iterate over all possible responses for an operation and combine their schemas into a z.union() type. This ensures the generated outputSchema accurately reflects all possible return shapes (both success and error), making the tool definitions more robust.

tobiu added the bug label on Oct 27, 2025, 12:35 PM
tobiu added the ai label on Oct 27, 2025, 12:35 PM
tobiu added the refactoring label on Oct 27, 2025, 12:35 PM
tobiu assigned to @tobiu on Oct 27, 2025, 12:35 PM
tobiu closed this issue on Oct 27, 2025, 1:06 PM