Frontmatter
| id | 7674 |
| title | Fix(toolService): Create union type for multiple response schemas |
| state | Closed |
| labels | bugairefactoring |
| assignees | tobiu |
| createdAt | Oct 27, 2025, 12:35 PM |
| updatedAt | Oct 27, 2025, 1:06 PM |
| githubUrl | https://github.com/neomjs/neo/issues/7674 |
| author | tobiu |
| commentsCount | 0 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Oct 27, 2025, 1:06 PM |
The
toolService.mjswas 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
buildOutputZodSchemato iterate over all possible responses for an operation and combine their schemas into az.union()type. This ensures the generatedoutputSchemaaccurately reflects all possible return shapes (both success and error), making the tool definitions more robust.