Include tool names and annotation hints in MCP approval metadata (#58161)

## What changed

Include `tool_name` in MCP tool approval elicitation metadata and forward available `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint` values under `tool_annotations`. Omit unspecified hints and the annotation title.

Reuse the stored tool approval metadata when available so annotation hints reach the approval request.

## Testing

Extend unit tests to cover tool names, annotation hints, and omission of unspecified hints. Update integration coverage to verify that the approval tool name matches the executed MCP call and that `readOnlyHint` is preserved.

GitOrigin-RevId: f082fe7fd87fde9f4895149e09210c7cb9d1e582
This commit is contained in:
Greg Brisebois
2026-10-29 19:34:46 +00:00
committed by copyberry
parent fa4ebe87af
commit 4bc746c94f
4 changed files with 107 additions and 32 deletions
@@ -35,6 +35,7 @@ pub const CONNECTOR_ID_KEY: &str = "connector_id";
pub const CONNECTOR_NAME_KEY: &str = "connector_name";
pub const CONNECTOR_DESCRIPTION_KEY: &str = "connector_description";
pub const TOOL_NAME_KEY: &str = "tool_name";
pub const TOOL_ANNOTATIONS_KEY: &str = "tool_annotations";
pub const TOOL_TITLE_KEY: &str = "tool_title";
pub const TOOL_DESCRIPTION_KEY: &str = "tool_description";
pub const TOOL_PARAMS_KEY: &str = "tool_params";