LearnNewsExamplesServices
Frontmatter
id7535
titleEnhance MCP ToolService to Support OpenAPI Keywords
stateClosed
labels
enhancementai
assigneestobiu
createdAtOct 18, 2025, 11:40 AM
updatedAtOct 18, 2025, 12:08 PM
githubUrlhttps://github.com/neomjs/neo/issues/7535
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtOct 18, 2025, 12:08 PM

Enhance MCP ToolService to Support OpenAPI Keywords

Closed v11.0.0 enhancementai
tobiu
tobiu commented on Oct 18, 2025, 11:40 AM

The ai/mcp/server/toolService.mjs is responsible for parsing OpenAPI specifications and generating Zod schemas for validating tool inputs and outputs. The current implementation of buildZodSchemaFromResponse is too simplistic and does not support common OpenAPI keywords like oneOf, required, and nullable. This leads to schema validation errors when the OpenAPI spec uses these features.

This ticket is to enhance the buildZodSchemaFromResponse function to correctly handle these keywords, making the tool service more robust and compliant with the OpenAPI specification.

Acceptance Criteria

  1. The buildZodSchemaFromResponse function in ai/mcp/server/toolService.mjs is updated to handle the oneOf keyword by mapping it to Zod's z.union.
  2. The function is updated to handle the required keyword for object properties, making properties optional in the Zod schema if they are not in the required list.
  3. The function is updated to handle nullable: true by applying .nullable() to the Zod schema.
  4. The openapi.yaml for the memory-core server is simplified to use nullable: true for the pid property, removing the need for complex oneOf constructs.
  5. The neo-memory-core__healthcheck tool passes successfully with these changes.
tobiu assigned to @tobiu on Oct 18, 2025, 11:40 AM
tobiu added the enhancement label on Oct 18, 2025, 11:40 AM
tobiu added the ai label on Oct 18, 2025, 11:40 AM
tobiu
tobiu Oct 18, 2025, 12:08 PM

resolved via https://github.com/neomjs/neo/commit/e272eb7bb355091d08b7fac278a1cd7f3850a85e (used the wrong ticket id for the commit)

tobiu closed this issue on Oct 18, 2025, 12:08 PM