Fix: Preserve tool annotations in MCP protocol responses#29
Fix: Preserve tool annotations in MCP protocol responses#29MaestroError merged 7 commits intomainfrom
Conversation
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for MCI tool annotations in MCP servers. The implementation enables MCP servers to preserve and serve annotation metadata (title, readOnlyHint, destructiveHint, idempotentHint, openWorldHint) from MCI tool definitions, allowing MCP clients to make better decisions about tool usage.
- Adds
convert_annotations()method to transfer annotation metadata from MCI to MCP format - Updates
convert_to_mcp_tool()to include annotations in MCP Tool objects - Provides comprehensive test coverage including unit tests, feature tests, and manual tests
- Documents the annotation feature with examples in README.md
- Fixes spelling errors in README.md
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mci/core/tool_converter.py | Adds convert_annotations() method and updates convert_to_mcp_tool() to transfer annotations from MCI to MCP format |
| src/mci/core/mcp_server.py | Formatting update only - no functional change |
| tests/unit/core/test_tool_converter.py | Adds comprehensive unit tests for annotation conversion including full, partial, and missing annotations |
| tests/test_mcp_server_creation.py | Adds feature test verifying annotations are preserved through server creation workflow |
| testsManual/test_annotations_in_mcp.py | Adds manual test demonstrating end-to-end annotation transfer with visual output |
| testsManual/test_mcp_server_annotations.py | Adds detailed manual test for verifying annotation presence in MCP server responses |
| README.md | Documents annotation feature with examples and fixes spelling errors (authentification→authentication, orginize→organize, mantioned→mentioned) |
| mci.json | Adds "weather-tools" to toolsets array |
| } | ||
|
|
||
| # Create temporary schema file | ||
| import tempfile |
There was a problem hiding this comment.
The tempfile import should be moved to the top of the file with other imports (line 9-16) to follow Python's import organization conventions. Standard library imports should be grouped together at the top, not imported inline.
There was a problem hiding this comment.
Fixed in ba7b096. Moved tempfile import to top of file along with other standard library imports.
| return False | ||
| finally: | ||
| # Clean up temporary file | ||
| import pathlib |
There was a problem hiding this comment.
The pathlib import should be moved to the top of the file with other imports (line 9-16) instead of being imported inline. This follows Python's import organization conventions and improves code readability.
There was a problem hiding this comment.
Fixed in ba7b096. Moved pathlib import to top of file along with other standard library imports.
| schema_path = os.path.join(project_root, "mci/example_toolset.mci.json") | ||
|
|
There was a problem hiding this comment.
This assignment to 'schema_path' is unnecessary as it is redefined before this value is used.
| schema_path = os.path.join(project_root, "mci/example_toolset.mci.json") |
There was a problem hiding this comment.
Fixed in ba7b096. Removed the unnecessary schema_path assignment that was being overwritten before use.
MaestroError
left a comment
There was a problem hiding this comment.
@copilot Check review comments
| return False | ||
| finally: | ||
| # Clean up temporary file | ||
| import pathlib |
| } | ||
|
|
||
| # Create temporary schema file | ||
| import tempfile |
| schema_path = os.path.join(project_root, "mci/example_toolset.mci.json") | ||
|
|
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
✅ Task Complete: MCP Tool Annotations Support
All acceptance criteria have been met and the implementation is fully tested.
Implementation Summary
tool_converter.pyto transfer all annotations from MCI to MCPOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.