Add support for the HTTP QUERY method#65
Merged
Merged
Conversation
QUERY method
There was a problem hiding this comment.
Pull request overview
Adds support for the HTTP QUERY method when registering MCP tools from OpenAPI specs, including OpenAPI 3.2’s native query Path Item operation and a backwards-compatible x-query extension for older OpenAPI 3.x documents.
Changes:
- Parse and register
QUERYoperations from Path Items (nativequeryorx-queryextension) and mark them read-only + idempotent in tool annotations. - Add tests validating tool registration + invocation uses the
QUERYmethod for both native and extension forms. - Document
QUERYsupport and add an RFC reference in the README.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| README.md | Documents QUERY support and adds RFC 10008 link/reference. |
| internal/openapi.go | Extracts a QUERY operation from the Path Item YAML node / extension and registers it as a tool with safe-method annotations. |
| internal/openapi_test.go | Adds regression tests for native query and x-query extension behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Guard against non-mapping Path Item nodes and avoid a data race in the QUERY test by passing the observed request over a channel.
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.
Related to #64
Adds support for the HTTP
QUERYmethod (RFC 10008). OpenAPI 3.2 specifications can use the nativequeryPath Item operation, while older OpenAPI 3.x specifications can use thex-queryextension. The operation is parsed as a standard OpenAPI Operation Object, registered as an MCP tool, and annotated as read-only and idempotent.