Skip to content

fix(mcp): drop top-level oneOf from context tool schema - #126

Merged
balcsida merged 2 commits into
mainfrom
fix/mcp-context-tool-schema
Sep 30, 2026
Merged

balcsida merged 2 commits into
mainfrom
fix/mcp-context-tool-schema

Conversation

@balcsida

Copy link
Copy Markdown
Owner

Summary

The MCP context tool could not be loaded through OpenAI-compatible function calling (Azure OpenAI via LiteLLM). Its input schema expressed the uid-or-name choice as a top-level oneOf, which those APIs reject:

Invalid schema for function 'graphnest_context': schema must have type 'object' and not have 'oneOf'/'anyOf'/'allOf'/'enum'/'const'/'not' at the top level.

Because the full tool list is sent with every request, one rejected schema failed every call, across every fallback model.

Changes

  • Remove the top-level oneOf from the context tool schema. The service already rejects requests with neither or both of uid and name (internal/graphservice/context.go), so validation is unchanged. The tool description now states the rule so models still learn it.
  • Add TestToolSchemasAcceptedByFunctionCalling, which registers every tool (search, repositories, SCIP, graph, supply chain) and asserts each input schema is a plain object with no top-level oneOf/anyOf/allOf/enum/const/not. It fails on the previous schema.
  • Changelog entry under Unreleased.

No configuration, schema, or security implications.

Verification

go vet ./internal/mcpserver/
go test ./internal/mcpserver/

🤖 Generated with Claude Code

balcsida and others added 2 commits September 30, 2026 17:54
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@balcsida
balcsida merged commit 015350d into main Sep 30, 2026
11 of 12 checks passed
@balcsida
balcsida deleted the fix/mcp-context-tool-schema branch September 30, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant