SIGN IN SIGN UP

Add prompt instructions for dynamic MCP tool discovery (#4577)

Adds a <dynamicToolDiscovery> section to the Anthropic tool search prompt that
tells the model to search for new tools after calling a tool that may have
enabled them on an MCP server via tools/list_changed. Also softens the 'do not
retry' instruction so the model doesn't prematurely give up when tools are
added dynamically mid-turn.

The tool-calling loop already refreshes available tools between iterations
(via getAvailableTools()), so dynamically added tools appear in the next
iteration's finalTools and pass the validToolNames filter. The prompt change
ensures the model continues to the next iteration rather than stopping.
B
Bhavya U committed
cbabced2bbd869093f70bf16444260f43a8d6d51
Parent: 4b07ec0
Committed by GitHub <noreply@github.com> on 3/20/2026, 10:38:17 PM