Skip to content

feat: refactor the tool specifications #351

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

tzolov
Copy link
Contributor

@tzolov tzolov commented Jun 29, 2025

  • Deprecate AsyncToolSpecification in favor of AsyncToolCallSpecification
  • Deprecate SyncToolSpecification in favor of SyncToolCallSpecification
  • Tool handlers now receive CallToolRequest instead of raw arguments to enable access to additional metadata parameters like progressToken
  • Add toolCall() and toolCalls() builder methods alongside deprecated variants
  • Update addTool() methods to support new tool call specifications
  • Maintain backward compatibility through deprecation annotations
  • Add tests for new tool call functionality

Motivation and Context

This change allows tool handlers to process additional metadata parameters from the full CallToolRequest object, enabling features like progress tracking.

Related to #300

How Has This Been Tested?

Additional tests to AbstractMcpAsyncClientTests and AbstractMcpSyncClientTests

Breaking Changes

AsyncToolCallSpecification/SyncToolCallSpecification replace the deprecated AsyncToolSpecification/SyncToolSpecification.
The old specifications are maintained for backward compatibility during transition. Internally, the deprecated specifications are converted to the new format, but only arguments remain visible to CallToolRequest.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change but backward compatibility is provided
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

- Deprecate AsyncToolSpecification in favor of AsyncToolCallSpecification
- Deprecate SyncToolSpecification in favor of SyncToolCallSpecification
- Tool handlers now receive CallToolRequest instead of raw arguments to
  enable access to additional metadata parameters like progressToken
- Add toolCall() and toolCalls() builder methods alongside deprecated variants
- Update addTool() methods to support new tool call specifications
- Maintain backward compatibility through deprecation annotations
- Add tests for new tool call functionality

This change allows tool handlers to process additional metadata parameters
from the full CallToolRequest object, enabling features like progress tracking.

Signed-off-by: Christian Tzolov <[email protected]>
Copy link

@134130 134130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

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