Repository navigation
Conversation
Port of genkit-ai/genkit#6903, adapted to this repo's Tool API. mcp_tool_to_action now sets the server's outputSchema as the tool's model_output_schema, so <client>:tool/* selectors send it to the model as get_active_tools() handles already did. mcp_tools_to_handles only existed to add that schema, so it is removed. metadata['mcp'] also keeps the tool's title and annotations, leaving out what the server did not send. Upstream-Commit: genkit-ai/genkit@6606da9 Upstream-PR: genkit-ai/genkit#6903
huangjeff5
reviewed
Dec 1, 2026
huangjeff5
left a comment
Collaborator
There was a problem hiding this comment.
The implementation and tests look good: mcp_tool_to_action sets model_output_schema and preserves title and annotations on metadata['mcp'] for both get_active_tools() and <client>:tool/*.
Verified locally in a temporary worktree:
uv run --no-sync pytest packages/genkit-mcp/tests: 263 passed on the PR head, and 269 passed when merged withmain(resolving theREADME.mdconflict in favor ofmain).ruff check,ruff format --check,pyright, andtypass onpackages/genkit-mcp.
Holding approval/auto-merge because:
packages/genkit-mcp/README.mdhas a merge conflict withmain(and maintainer edits are disabled on the branch).- The PR notes it should land after #90, which is still open.
Please rebase onto main (keeping the updated README structure) and let us know once #90 is resolved.
This branch has not been deployed
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.
Port of genkit-ai/genkit#6903, adapted to this repo's
ToolAPI.Why
An MCP server can declare an
outputSchema, atitleandannotationsfor a tool. Here, handles fromget_active_tools()already sent the output schema to the model, but<client>:tool/*selectors did not, and the title and annotations were dropped on both paths.Changes
mcp_tool_to_actionsets the server'soutputSchemaas the tool'smodel_output_schema, so both paths send it. Tools without one still send none.mcp_tools_to_handlesonly existed to add that schema to handles, so it is removed andget_active_tools()usesmcp_tools_to_actions.metadata['mcp']also holds the tool'stitleandannotations. Hints the server left out stay absent, and unknown keys are kept as sent. Neither is sent to the model.How this differs from upstream
metadata[ORIGINAL_OUTPUT_SCHEMA_KEY]directly. Here themodel_output_schemasetter writes the same key, and also onto thetool.v2wire action.tool.metadata['mcp'], because a localToolis itself the action (upstream:tool.action().metadata['mcp']).Should land after #90.