feat(mcp): expand the MCP server, describe and annotate its tools - #1123
Open
jmylchreest wants to merge 2 commits into
Open
feat(mcp): expand the MCP server, describe and annotate its tools#1123jmylchreest wants to merge 2 commits into
jmylchreest wants to merge 2 commits into
Conversation
The HTTP+SSE transport never worked. The stream emitted only ping events and never `event: message`, while /mcp/messages returned JSON-RPC replies in the POST body. Under the 2024-11-05 transport the client reads replies off the stream, so any conforming client hung after initialize. The generated session id was never stored or looked up either. Sessions are now tracked per worker, replies are delivered over the stream, and POSTs return 202. A session may only be written to by the user who opened it. The announced endpoint is relative so it stays correct behind a reverse proxy. Adds Streamable HTTP on POST /mcp, implemented statelessly so it works across multiple workers, with GET/DELETE answering 405 as the spec allows. protocolVersion is now negotiated against the versions actually supported rather than hardcoded to 2024-11-05, and notifications and JSON-RPC batches are handled properly. Verified against Claude Code over both transports.
Every tool was advertised as "KitchenOwl tool: <name>" with undescribed parameters, leaving the model to infer semantics from the name alone. Tools now carry a written description, a title, per-parameter descriptions, and readOnly/destructive/idempotent/openWorld annotations, so a client can tell reading from writing and prompt accordingly. list_recipes returned obj_to_full_dict for every recipe in the household, method body and nested household included, with no limit. It now returns summaries and every list tool takes limit/offset and reports total and has_more. Page size is clamped to 200. Tool failures are reported as isError results rather than JSON-RPC protocol errors, which is what the spec asks for and lets the model recover. Unexpected exceptions are logged and replaced with a generic message instead of returning str(e) to the caller.
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.
Builds on #1121. This is a cross-fork PR so I can't set that as the base, and the diff below includes it. The commit to review here is the second one,
feat(mcp): Describe and annotate tools, bound list responses.Every tool is advertised as
KitchenOwl tool: <name>with no parameter descriptions, so a model has to infer what things do from the name alone. Tools now carry a written description, a title, per-parameter descriptions, and readOnly/destructive/idempotent/openWorld annotations.list_recipesreturnedobj_to_full_dict()for every recipe in the household, method body and nested household included, with no limit. It now returns summaries, and every list tool takes limit/offset and reports total and has_more. Page size is capped at 200.Tool failures come back as
isErrorresults rather than JSON-RPC protocol errors, which is what the spec asks for and lets the model recover. Unexpected exceptions are logged and replaced with a generic message rather than returningstr(e).There is more behind this. Each link shows only that branch's own changes:
add_recipe_items_to_list, bulk add, categoriesRecipeHistory, so they never feed suggestionsHow would you like me to submit the subsequent PRs, if at all you'd like me to?