-
Notifications
You must be signed in to change notification settings - Fork 19
fix: Make sure Tool information attached to ContentToolRequest is serializable #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ializable; require tool annotations to be a dictionary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a serialization issue with ContentToolRequest objects by replacing direct Tool instances with serializable ToolInfo objects, while also moving away from MCP's ToolAnnotations to maintain a custom TypedDict implementation.
- Creates a new
ToolInfoclass containing only serializable tool metadata - Replaces MCP's
ToolAnnotationswith a custom TypedDict implementation - Updates all test code to use
ToolInfo.from_tool()when creatingContentToolRequestobjects
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| chatlas/_content.py | Adds ToolInfo class and ToolAnnotations TypedDict for serializable tool metadata |
| chatlas/_tools.py | Updates to use custom ToolAnnotations and convert MCP annotations to dict format |
| chatlas/_chat.py | Modifies tool request handling to use ToolInfo instead of direct Tool references |
| chatlas/_typing_extensions.py | Changes Python version requirement for TypedDict imports |
| tests/test_content_tools.py | Adds serialization test and updates existing tests to use ToolInfo |
| tests/test_tools_enhanced.py | Updates all test cases to use ToolInfo.from_tool() pattern |
| tests/test_tool_from_mcp.py | Updates MCP tool annotation tests to use dict access |
| tests/conftest.py | Updates to use custom ToolAnnotations instead of MCP version |
| chatlas/init.py | Exports new ToolInfo and ToolAnnotations types |
| CHANGELOG.md | Documents breaking change and bug fix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
3fda7c8 to
14e2968
Compare
14e2968 to
4e4ae80
Compare
Follow up to #156, which broke
.model_dump_json()ofContentToolRequest, which in turn breaks bookmarking of tool calls.While here, I decided that it's not worth supporting
from mcp.type import ToolAnnotationsto support annotations, and instead maintain our own TypedDict.