LearnNewsExamplesServices
Frontmatter
id9545
titleFix Knowledge Base Tool Argument Routing (x-pass-as-object)
stateClosed
labels
bugai
assigneestobiu
createdAtMar 24, 2026, 8:59 PM
updatedAtMar 24, 2026, 9:00 PM
githubUrlhttps://github.com/neomjs/neo/issues/9545
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 24, 2026, 9:00 PM

Fix Knowledge Base Tool Argument Routing (x-pass-as-object)

Closed v12.1.0 bugai
tobiu
tobiu commented on Mar 24, 2026, 8:59 PM

Goal

Fix a routing bug in the neo.mjs-knowledge-base MCP server that prevented the manage_knowledge_base and manage_database tools from receiving their arguments correctly when called via the internal Node.js SDK (ai/services.mjs).

Context

During an attempt to trigger a knowledge base sync, the manage_knowledge_base tool threw an error: Invalid action: undefined. Investigation revealed that ai/services.mjs uses OpenApiValidator.mjs and the openapi.yaml spec to dynamically generate Zod schemas and validate/route arguments to the underlying service methods.

If an OpenAPI endpoint lacks the x-pass-as-object: true annotation, the SDK attempts to map the JSON request body properties to positional arguments based on a heuristic, which fails for complex service methods that expect a single destructured config object (e.g., manageKnowledgeBase({action})).

The query_documents tool had this annotation, but the newer manage_database and manage_knowledge_base tools introduced in Epic #8315 were missing it.

Acceptance Criteria

  • Add x-pass-as-object: true to the /db/manage (manage_database) path in ai/mcp/server/knowledge-base/openapi.yaml.
  • Add x-pass-as-object: true to the /db/data/manage (manage_knowledge_base) path in the same file.
  • Verify that calling these tools via the SDK correctly passes the arguments as an object.
tobiu added the bug label on Mar 24, 2026, 8:59 PM
tobiu added the ai label on Mar 24, 2026, 8:59 PM
tobiu referenced in commit ca3b26e - "fix(ai): add x-pass-as-object to manage tools in KB openapi spec (#9545) on Mar 24, 2026, 9:00 PM
tobiu assigned to @tobiu on Mar 24, 2026, 9:00 PM
tobiu closed this issue on Mar 24, 2026, 9:00 PM