Add agencyHint to ToolAnnotations #1781
Draft
+12
−1
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.
This PR adds support for the new
agencyHintannotation to the Model Context Protocol Python SDK. TheagencyHintboolean field inToolAnnotationsallows tools to signal that they encapsulate an internal “agent loop” (plan–act–observe cycles, tool chaining, or autonomous retries). This helps clients handle agent-like tools appropriately and differentiates them from simple single-step tools.Motivation and Context
This change aligns the Python SDK with the latest MCP specification (SEP-1938) by adding the
agencyHintflag. Tools that encapsulate agent loops may behave differently from simple tools, so exposing this hint allows orchestrators and clients to make better decisions about tool invocation.How Has This Been Tested?
All existing tests have been run locally to ensure no regressions. The new field is optional and defaults to
false, so it should not affect existing behavior. No additional tests were required because it is a schema-level change.Breaking Changes
There are no breaking changes. The new field is optional and defaults to
false.Types of changes
Checklist
Additional context
N/A