Skip to content

Conversation

@cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Aug 29, 2025

Follow up to #156, which broke .model_dump_json() of ContentToolRequest, which in turn breaks bookmarking of tool calls.

While here, I decided that it's not worth supporting from mcp.type import ToolAnnotations to support annotations, and instead maintain our own TypedDict.

@cpsievert cpsievert requested a review from Copilot August 29, 2025 13:43
Copy link
Contributor

Copilot AI left a 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 ToolInfo class containing only serializable tool metadata
  • Replaces MCP's ToolAnnotations with a custom TypedDict implementation
  • Updates all test code to use ToolInfo.from_tool() when creating ContentToolRequest objects

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.

@cpsievert cpsievert force-pushed the fix/serializable-tool-class-v2 branch from 3fda7c8 to 14e2968 Compare August 29, 2025 13:46
@cpsievert cpsievert force-pushed the fix/serializable-tool-class-v2 branch from 14e2968 to 4e4ae80 Compare August 29, 2025 13:47
@cpsievert cpsievert marked this pull request as ready for review August 29, 2025 14:04
@cpsievert cpsievert merged commit f383961 into main Aug 29, 2025
7 checks passed
@cpsievert cpsievert deleted the fix/serializable-tool-class-v2 branch September 3, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants