ISSUE #240 | MCP tool annotation support in hayhooks#243
Open
Hrushi11 wants to merge 2 commits into
Open
Conversation
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.
[Issue #240] | Add MCP Tool Annotations support for pipeline tools
Problem
When Hayhooks exposes pipelines as MCP tools, the
Toolobjects are created with onlyname,description, andinputSchemanoannotations. MCP clients like Claude Desktop rely on these annotations to understand tool behavior. Without them, clients default to the most pessimistic settings:true(client thinks it might delete data)false(client thinks it modifies state)false(client thinks repeated calls have side effects)This leads to unnecessary confirmation prompts and sub-optimal tool selection in MCP clients.
Changes
mcp_utils.py:list_pipelines_as_toolsnow builds aToolAnnotationsobject from pipeline metadata and attaches it to eachTool. Sensible defaults are applied for typical query/RAG pipelines (readOnly=True,destructive=False,idempotent=True,openWorld=True, auto-generated title).base_pipeline_wrapper.py: AddedMCPToolHintsTypedDict and atool_hintsclass attribute onBasePipelineWrapper, so wrapper-based pipelines can declare hints directly in Python.deploy_utils.py: Propagatestool_hintsthrough the deploy path into registry metadata — both for wrapper-based pipelines (read from the wrapper attribute) and YAML pipelines (read frommetadata.tool_hintsin the YAML file, or overridable via deploy options).Usage
Python wrapper:
YAML pipeline:
All fields are optional — if
tool_hintsis omitted entirely, defaults are applied.Tests
test_pipeline_tool_hints_override_default_annotations— custom hints from wrappertest_deploy_pipeline_files_stores_tool_hints— hints persisted in registry metadatatest_deploy_yaml_pipeline_reads_tool_hints_from_metadata— hints from YAML metadata blocktest_list_pipelines_as_toolsand integration test