Repository navigation
Conversation
quackapi already publishes its routes as GET /openapi.json; this serves the same catalog as an MCP (JSON-RPC) endpoint, so a DuckDB that declares routes is an MCP server with no SQL middleware: initialize and ping; tools/list is one tool per OpenAPI operation (name = route name, input schema = its parameters); tools/call runs that route through the normal request path (POST: arguments as the JSON body, GET: as the query string) and returns its body as the tool text, isError for 4xx/5xx. Notifications get 202. JSON is read and written with DuckDB's own from_json/to_json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/call synthesized the sub-request with call.path = the raw route
pattern, so a route like GET /users/:id matched with the literal
placeholder ':id' as the captured value while the real argument sat
unused in the query string/body. The tool returned isError:false with a
wrong answer. Substitute :name/{name} segments from the arguments
before matching; a path param with no argument value is -32602
(Invalid params) instead of a silent placeholder. Path params stay out
of the GET query string so each value has one source. Regression tests
in test/sql/quackapi_mcp.test.
Fixes the Format Check on CI (clang-format 11). No behavior change.
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.
quackapi already publishes its routes as
GET /openapi.json(FastAPI parity). This serves the same catalog as an MCP endpoint, so a DuckDB that declares routes is an MCP server with no SQL middleware.initialize,pingtools/list: one tool per OpenAPI operation. Name = route name (operationId), input schema = its parameters.tools/call: runs that route through the normal request path. POST gets the arguments as the JSON body, GET as the query string. The route's body is the tool text; 4xx/5xx setsisError.JSON is parsed and built with DuckDB's own
from_json/to_json.Test:
test/sql/quackapi_mcp.testdrives/mcpthroughquackapi_request. The fulltest/sqlsuite passes locally (38 cases, 3,247 assertions).make format-ciis clean.Found on the way, not changed here:
/openapi.jsonpublishes a declaredPARAM a INTEGERas"type": "string", and MCP mirrors it. That's a separate fix in the OpenAPI generator.🤖 Generated with Claude Code