What happened?
When the sampling history contains a valid opaque tool-use ID, GoogleGenaiSamplingHandler derives the Gemini function name from that ID instead of matching it to the preceding ToolUseContent.name.
For example, a call with id="call_opaque_123" and name="lookup_customer" becomes a function call named lookup_customer, but its paired ToolResultContent(tool_use_id="call_opaque_123") becomes a FunctionResponse named call_opaque. Gemini requires FunctionResponse.name to identify the declared function. IDs generated in FastMCP's private {function_name}_{uuid8} format pass; valid IDs that do not follow that format expose the mismatch.
The MCP sampling contract carries the ID and function name separately and matches a result to a call by ID (SEP-1577). Could the handler resolve each result ID against its paired tool-use block when building the Gemini response? Sampling was deprecated in protocol version 2026-07-28; this affects users of the existing FastMCP handler.
Example Code
Version Information
- FastMCP main: `5baeacfe20eca735cb949564b4915f93a622b916`
- Python: 3.12.15
- OS: macOS 15.0.1 arm64
What happened?
When the sampling history contains a valid opaque tool-use ID,
GoogleGenaiSamplingHandlerderives the Gemini function name from that ID instead of matching it to the precedingToolUseContent.name.For example, a call with
id="call_opaque_123"andname="lookup_customer"becomes a function call namedlookup_customer, but its pairedToolResultContent(tool_use_id="call_opaque_123")becomes aFunctionResponsenamedcall_opaque. Gemini requiresFunctionResponse.nameto identify the declared function. IDs generated in FastMCP's private{function_name}_{uuid8}format pass; valid IDs that do not follow that format expose the mismatch.The MCP sampling contract carries the ID and function name separately and matches a result to a call by ID (SEP-1577). Could the handler resolve each result ID against its paired tool-use block when building the Gemini response? Sampling was deprecated in protocol version
2026-07-28; this affects users of the existing FastMCP handler.Example Code
Version Information