fix: add type: object hint for oneOf/anyOf/allOf with object options#234
Open
JMonde wants to merge 4 commits intomakenotion:mainfrom
Open
fix: add type: object hint for oneOf/anyOf/allOf with object options#234JMonde wants to merge 4 commits intomakenotion:mainfrom
JMonde wants to merge 4 commits intomakenotion:mainfrom
Conversation
|
+1 We're also hitting this exact issue with Affected tools: Symptoms: Every call returns Would love to see this merged — it's blocking page creation and reorganization workflows entirely. Thanks @JMonde for the fix! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
MCP clients were encountering schema validation errors when passing complex object parameters (like
parent,data,new_parent) to tools withoneOf,anyOf, orallOfschemas. The error message was:This occurred because the JSON Schema generated from OpenAPI didn't explicitly include
type: "object"for composite schemas where all options were objects, causing some MCP clients to incorrectly serialize the parameters.Related issue: #209
Solution
Enhanced the
convertOpenApiSchemaToJsonSchemamethod inparser.tsto automatically addtype: "object"when all options in aoneOf,anyOf, orallOfschema are object types.The fix:
type: "object",properties, or are$refreferences to object-like schemas (Request, Response, Object)type: "object"into the composite schema to guide MCP clientsChanges
File:
src/openapi-mcp-server/openapi/parser.tsAdded logic to three schema conversion blocks:
type: "object"if all are objectsEach block uses a helper check that:
type: "object"orproperties$refpaths and checks if they reference Request/Response/Object schemasTesting
Manually tested by creating pages in a Notion database using the
post-pagetool with complexparentparameter:Impact
typehintsLabels
bugenhancementReviewers