diff --git a/agent/llmagent/llmagent_test.go b/agent/llmagent/llmagent_test.go index 0a2577f9e..37acba073 100644 --- a/agent/llmagent/llmagent_test.go +++ b/agent/llmagent/llmagent_test.go @@ -36,7 +36,7 @@ import ( "google.golang.org/adk/tool/functiontool" ) -const modelName = "gemini-2.0-flash" +const modelName = "gemini-2.5-flash" //go:generate go test -httprecord=Test @@ -696,7 +696,13 @@ func TestInstructionProvider(t *testing.T) { genai.NewContentFromText("user input", genai.RoleUser), }, Config: &genai.GenerateContentConfig{ - SystemInstruction: genai.NewContentFromText("instruction custom_value test", genai.RoleUser), + SystemInstruction: &genai.Content{ + Parts: []*genai.Part{ + genai.NewPartFromText("instruction custom_value test"), + genai.NewPartFromText(`You are an agent. Your internal name is "test_agent".`), + }, + Role: genai.RoleUser, + }, }, }, }, @@ -723,7 +729,13 @@ func TestInstructionProvider(t *testing.T) { genai.NewContentFromText("user input", genai.RoleUser), }, Config: &genai.GenerateContentConfig{ - SystemInstruction: genai.NewContentFromText("instruction provider template {var} not evaluated", genai.RoleUser), + SystemInstruction: &genai.Content{ + Parts: []*genai.Part{ + genai.NewPartFromText("instruction provider template {var} not evaluated"), + genai.NewPartFromText(`You are an agent. Your internal name is "test_agent".`), + }, + Role: genai.RoleUser, + }, }, }, }, @@ -750,7 +762,13 @@ func TestInstructionProvider(t *testing.T) { genai.NewContentFromText("user input", genai.RoleUser), }, Config: &genai.GenerateContentConfig{ - SystemInstruction: genai.NewContentFromText("global instruction provider template {var} not evaluated", genai.RoleUser), + SystemInstruction: &genai.Content{ + Parts: []*genai.Part{ + genai.NewPartFromText("global instruction provider template {var} not evaluated"), + genai.NewPartFromText(`You are an agent. Your internal name is "test_agent".`), + }, + Role: genai.RoleUser, + }, }, }, }, @@ -783,6 +801,7 @@ func TestInstructionProvider(t *testing.T) { Parts: []*genai.Part{ genai.NewPartFromText("global instruction provider {var}"), genai.NewPartFromText("instruction provider {var}"), + genai.NewPartFromText(`You are an agent. Your internal name is "test_agent".`), }, Role: genai.RoleUser, }, diff --git a/agent/llmagent/testdata/TestFunctionTool.httprr b/agent/llmagent/testdata/TestFunctionTool.httprr index e6a55e63e..9c46c1b62 100644 --- a/agent/llmagent/testdata/TestFunctionTool.httprr +++ b/agent/llmagent/testdata/TestFunctionTool.httprr @@ -1,12 +1,12 @@ httprr trace v1 -824 1140 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +931 1140 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 592 +Content-Length: 699 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the sum of 1 + 2?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"computes the sum of two numbers","name":"sum","parametersJsonSchema":{"additionalProperties":false,"properties":{"a":{"type":"integer"},"b":{"type":"integer"}},"required":["a","b"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"sum":{"type":"integer"}},"required":["sum"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the sum of 1 + 2?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"math agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"computes the sum of two numbers","name":"sum","parametersJsonSchema":{"additionalProperties":false,"properties":{"a":{"type":"integer"},"b":{"type":"integer"}},"required":["a","b"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"sum":{"type":"integer"}},"required":["sum"],"type":"object"}}]}]}HTTP/2.0 200 OK Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 Date: Fri, 05 Sep 2025 16:15:32 GMT @@ -60,14 +60,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "pAy7aJbkIe2m1MkPgbz0iAo" } -987 1007 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +1094 1007 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 755 +Content-Length: 862 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the sum of 1 + 2?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"a":1,"b":2},"name":"sum"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"sum","response":{"sum":3}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"computes the sum of two numbers","name":"sum","parametersJsonSchema":{"additionalProperties":false,"properties":{"a":{"type":"integer"},"b":{"type":"integer"}},"required":["a","b"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"sum":{"type":"integer"}},"required":["sum"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the sum of 1 + 2?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"a":1,"b":2},"name":"sum"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"sum","response":{"sum":3}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"math agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"computes the sum of two numbers","name":"sum","parametersJsonSchema":{"additionalProperties":false,"properties":{"a":{"type":"integer"},"b":{"type":"integer"}},"required":["a","b"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"sum":{"type":"integer"}},"required":["sum"],"type":"object"}}]}]}HTTP/2.0 200 OK Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 Date: Fri, 05 Sep 2025 16:15:33 GMT diff --git a/agent/llmagent/testdata/TestLLMAgentStreamingModeSSE.httprr b/agent/llmagent/testdata/TestLLMAgentStreamingModeSSE.httprr index 8774e3af8..df6df5949 100644 --- a/agent/llmagent/testdata/TestLLMAgentStreamingModeSSE.httprr +++ b/agent/llmagent/testdata/TestLLMAgentStreamingModeSSE.httprr @@ -1,12 +1,12 @@ httprr trace v1 -537 8297 +656 8297 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 291 +Content-Length: 410 Content-Type: application/json -{"contents":[{"parts":[{"text":"What is the sum of the first 50 prime numbers?"}],"role":"user"}],"generationConfig":{"thinkingConfig":{"includeThoughts":true}},"systemInstruction":{"parts":[{"text":"Think deep. Always double check the answer before making the conclusion."}],"role":"user"}}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"What is the sum of the first 50 prime numbers?"}],"role":"user"}],"generationConfig":{"thinkingConfig":{"includeThoughts":true}},"systemInstruction":{"parts":[{"text":"Think deep. Always double check the answer before making the conclusion."},{"text":"You are an agent. Your internal name is \"calculator\". The description about you is \"calculating agent\"."}],"role":"user"}}HTTP/2.0 200 OK Connection: close Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Disposition: attachment diff --git a/agent/llmagent/testdata/TestLLMAgent_healthy_backend.httprr b/agent/llmagent/testdata/TestLLMAgent_healthy_backend.httprr index aaf7c63db..2496d2f05 100644 --- a/agent/llmagent/testdata/TestLLMAgent_healthy_backend.httprr +++ b/agent/llmagent/testdata/TestLLMAgent_healthy_backend.httprr @@ -1,12 +1,12 @@ httprr trace v1 -508 945 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +634 945 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 276 +Content-Length: 402 Content-Type: application/json -{"contents":[{"parts":[{"text":"Handle the requests as specified in the System Instruction."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"Answer as precisely as possible."},{"text":"Roll the dice and report only the result."}],"role":"user"}}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Handle the requests as specified in the System Instruction."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"Answer as precisely as possible."},{"text":"Roll the dice and report only the result."},{"text":"You are an agent. Your internal name is \"hello_world_agent\". The description about you is \"hello world agent\"."}],"role":"user"}}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Mon, 29 Sep 2025 08:03:49 GMT Server: scaffolding on HTTPServer2 diff --git a/agent/llmagent/testdata/TestToolCallback.httprr b/agent/llmagent/testdata/TestToolCallback.httprr index f0fc785df..22119de0a 100644 --- a/agent/llmagent/testdata/TestToolCallback.httprr +++ b/agent/llmagent/testdata/TestToolCallback.httprr @@ -1,12 +1,12 @@ httprr trace v1 -822 1070 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +931 1070 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 590 +Content-Length: 699 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:27 GMT Server: scaffolding on HTTPServer2 @@ -58,14 +58,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "hvX4aJWrKevWxN8Pqd_FgAI" } -1003 950 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +1112 950 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 771 +Content-Length: 880 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":"7"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":"7"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:28 GMT Server: scaffolding on HTTPServer2 @@ -112,14 +112,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "h_X4aPHaIqfKvdIP1b-IyQY" } -822 1070 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +931 1070 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 590 +Content-Length: 699 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:28 GMT Server: scaffolding on HTTPServer2 @@ -171,14 +171,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "iPX4aNzMFdTivdIPgMv46AU" } -1003 949 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +1112 949 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 771 +Content-Length: 880 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":"3"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":"3"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:29 GMT Server: scaffolding on HTTPServer2 @@ -225,14 +225,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "ifX4aM0FjZnE3w_Sk775AQ" } -822 1069 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +931 1069 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 590 +Content-Length: 699 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:30 GMT Server: scaffolding on HTTPServer2 @@ -284,14 +284,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "ifX4aJmHH4XmxN8PycikeA" } -1003 951 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +1112 951 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 771 +Content-Length: 880 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":"7"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":"7"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:31 GMT Server: scaffolding on HTTPServer2 @@ -338,14 +338,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "ivX4aLqwCLjUvdIPn6eOuQU" } -822 1069 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +931 1069 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 590 +Content-Length: 699 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:32 GMT Server: scaffolding on HTTPServer2 @@ -397,14 +397,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "i_X4aI2PENuFxN8PqvuKqAM" } -1003 949 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +1112 949 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 771 +Content-Length: 880 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":"3"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":"3"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:33 GMT Server: scaffolding on HTTPServer2 @@ -451,14 +451,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "jPX4aPqzJorLvdIP_rWq0Ak" } -822 1068 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +931 1068 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 590 +Content-Length: 699 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:34 GMT Server: scaffolding on HTTPServer2 @@ -510,14 +510,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "jfX4aLe4C_rDvdIP5oLnMQ" } -1003 950 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +1112 950 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 771 +Content-Length: 880 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":"7"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":"7"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:35 GMT Server: scaffolding on HTTPServer2 @@ -564,14 +564,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "jvX4aJr5E8ajvdIPlIuO4AE" } -822 1069 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +931 1069 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 590 +Content-Length: 699 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:37 GMT Server: scaffolding on HTTPServer2 @@ -623,14 +623,14 @@ X-Xss-Protection: 0 "modelVersion": "gemini-2.0-flash", "responseId": "j_X4aNHBA5Dzxs0P0ZOM8QY" } -1001 949 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +1110 949 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 769 +Content-Length: 878 Content-Type: application/json -{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":1}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Generate random number with 5 as a seed."}],"role":"user"},{"parts":[{"functionCall":{"args":{"seed":5},"name":"rand_number"}}],"role":"model"},{"parts":[{"functionResponse":{"name":"rand_number","response":{"number":1}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"output ONLY the result computed by the provided function"},{"text":"You are an agent. Your internal name is \"agent\". The description about you is \"random agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns random number","name":"rand_number","parametersJsonSchema":{"additionalProperties":false,"properties":{"seed":{"type":"integer"}},"required":["seed"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"number":{"type":"integer"}},"required":["number"],"type":"object"}}]}]}HTTP/2.0 200 OK Content-Type: application/json; charset=UTF-8 Date: Wed, 22 Oct 2025 15:17:37 GMT Server: scaffolding on HTTPServer2 diff --git a/agent/remoteagent/testdata/TestA2ARemoteAgentStreamingGeminiError.httprr b/agent/remoteagent/testdata/TestA2ARemoteAgentStreamingGeminiError.httprr index d6fcb3a18..635349f5f 100644 --- a/agent/remoteagent/testdata/TestA2ARemoteAgentStreamingGeminiError.httprr +++ b/agent/remoteagent/testdata/TestA2ARemoteAgentStreamingGeminiError.httprr @@ -1,18 +1,19 @@ httprr trace v1 -441 10557 +509 6123 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 195 +Content-Length: 263 Content-Type: application/json -{"contents":[{"parts":[{"text":"tell me about the capital of Poland"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a helpful assistant."}],"role":"user"}}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"tell me about the capital of Poland"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a helpful assistant."},{"text":"You are an agent. Your internal name is \"model-agent\"."}],"role":"user"}}HTTP/2.0 200 OK Connection: close +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Disposition: attachment Content-Type: text/event-stream -Date: Mon, 09 Feb 2026 10:12:23 GMT +Date: Fri, 20 Feb 2026 12:34:25 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=4853 +Server-Timing: gfet4t7; dur=1158 Vary: Origin Vary: X-Origin Vary: Referer @@ -20,39 +21,23 @@ X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 -data: {"candidates": [{"content": {"parts": [{"text": "The capital of Poland is **Warsaw (Warszawa in Polish)**, a city with an"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 19,"totalTokenCount": 969,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} +data: {"candidates": [{"content": {"parts": [{"text": "The capital of Poland is **Warsaw** (Polish: *Warszawa*).\n\nHere's some information about this fascinating city:\n\n1. **Location:** Situated"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 36,"totalTokenCount": 96,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 31},"modelVersion": "gemini-2.5-flash","responseId": "0FSYaY2oA8Wg1e8P3ZTdiAY"} -data: {"candidates": [{"content": {"parts": [{"text": " incredibly rich and often tragic history, known for its resilience and remarkable reconstruction after World War II.\n\nHere's a breakdown of what makes Warsaw unique and significant:\n\n1. **A Phoenix City:** Perhaps the most defining characteristic of Warsaw is"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 70,"totalTokenCount": 1020,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} +data: {"candidates": [{"content": {"parts": [{"text": " on the Vistula River in east-central Poland.\n2. **History & Resilience:** Warsaw has a truly remarkable history, perhaps best known for its near-total destruction during World War II, particularly during the Warsaw Uprising"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 84,"totalTokenCount": 144,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 31},"modelVersion": "gemini-2.5-flash","responseId": "0FSYaY2oA8Wg1e8P3ZTdiAY"} -data: {"candidates": [{"content": {"parts": [{"text": " its designation as a \"Phoenix City.\" During World War II, particularly after the 1944 Warsaw Uprising, the city was systematically razed by the Nazis, with an estimated 85-90% of its buildings,"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 119,"totalTokenCount": 1069,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} +data: {"candidates": [{"content": {"parts": [{"text": " in 1944. Despite this immense devastation, the city was meticulously rebuilt, largely thanks to the efforts of its citizens, who painstakingly recreated historical buildings using old plans and photographs. This earned it the nickname \"Phoenix City.\"\n3"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 133,"totalTokenCount": 193,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 31},"modelVersion": "gemini-2.5-flash","responseId": "0FSYaY2oA8Wg1e8P3ZTdiAY"} -data: {"candidates": [{"content": {"parts": [{"text": " including historical landmarks, completely destroyed. What stands today is largely a monumental effort of post-war reconstruction, meticulously rebuilt by its citizens.\n\n2. **Historical Significance:**\n * **Royal Capital:** Warsaw became the capital of"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 167,"totalTokenCount": 1117,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} +data: {"candidates": [{"content": {"parts": [{"text": ". **Old Town (Stare Miasto):** One of the most famous examples of this rebuilding effort is the Old Town, which was completely reconstructed and is now a UNESCO World Heritage Site. It features a charming market square, colorful"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 181,"totalTokenCount": 241,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 31},"modelVersion": "gemini-2.5-flash","responseId": "0FSYaY2oA8Wg1e8P3ZTdiAY"} -data: {"candidates": [{"content": {"parts": [{"text": " the Polish-Lithuanian Commonwealth in 1596 when King Sigismund III Vasa moved his court from Kraków.\n * **Partitions of Poland:** Over centuries, it endured foreign occupation and control during the partitions of Poland"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 217,"totalTokenCount": 1167,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} +data: {"candidates": [{"content": {"parts": [{"text": " townhouses, and the Royal Castle.\n4. **Culture & Arts:** Warsaw is a vibrant cultural hub. It boasts numerous theaters, museums (such as the Warsaw Uprising Museum and the POLIN Museum of the History of Polish"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 229,"totalTokenCount": 289,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 31},"modelVersion": "gemini-2.5-flash","responseId": "0FSYaY2oA8Wg1e8P3ZTdiAY"} -data: {"candidates": [{"content": {"parts": [{"text": " by Russia, Prussia, and Austria.\n * **Warsaw Uprising (1944):** This heroic but ultimately doomed 63-day uprising against the German occupation resulted in catastrophic destruction and immense loss of life,"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 266,"totalTokenCount": 1216,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} +data: {"candidates": [{"content": {"parts": [{"text": " Jews), art galleries, and music venues. It's also home to the Fryderyk Chopin Museum, celebrating Poland's most famous composer.\n5. **Architecture:** The city's architecture is a mix of old and"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 278,"totalTokenCount": 338,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 31},"modelVersion": "gemini-2.5-flash","responseId": "0FSYaY2oA8Wg1e8P3ZTdiAY"} -data: {"candidates": [{"content": {"parts": [{"text": " but it remains a powerful symbol of Polish defiance.\n * **Cold War Era:** After WWII, Warsaw became the capital of the Polish People's Republic under communist rule, a period that left its own architectural and social mark (e."}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 316,"totalTokenCount": 1266,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} +data: {"candidates": [{"content": {"parts": [{"text": " new. You'll find Gothic churches, neoclassical palaces, Soviet-era brutalism (like the Palace of Culture and Science, a gift from Stalin), and modern skyscrapers.\n6. **Economy & Education:** As the capital, Warsaw is"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 328,"totalTokenCount": 388,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 31},"modelVersion": "gemini-2.5-flash","responseId": "0FSYaY2oA8Wg1e8P3ZTdiAY"} -data: {"candidates": [{"content": {"parts": [{"text": "g., the Palace of Culture and Science).\n\n3. **Modern Warsaw:**\n * **Political and Economic Hub:** Today, Warsaw is Poland's political, economic, and cultural heart. It houses the President, Parliament ("}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 365,"totalTokenCount": 1315,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} +data: {"candidates": [{"content": {"parts": [{"text": " Poland's main economic, financial, and educational center. It hosts many universities, corporations, and government institutions.\n7. **Green Spaces:** Despite being a major metropolis, Warsaw has a surprising amount of green space, including parks like"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 377,"totalTokenCount": 437,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 31},"modelVersion": "gemini-2.5-flash","responseId": "0FSYaY2oA8Wg1e8P3ZTdiAY"} -data: {"candidates": [{"content": {"parts": [{"text": "Sejm and Senat), central government institutions, and numerous international companies.\n * **Cultural Center:** It's home to major universities, theaters, museums, art galleries, and concert halls. It has a vibrant music scene, and"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 415,"totalTokenCount": 1365,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} +data: {"candidates": [{"content": {"parts": [{"text": " Łazienki Park (with its beautiful palace and Chopin monument) and the expansive Kampinos National Park just outside the city.\n8. **Modern City:** Today, Warsaw is a bustling, modern European capital with a dynamic nightlife"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 425,"totalTokenCount": 485,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 31},"modelVersion": "gemini-2.5-flash","responseId": "0FSYaY2oA8Wg1e8P3ZTdiAY"} -data: {"candidates": [{"content": {"parts": [{"text": " is famously associated with composer Frédéric Chopin (whose heart is interred in the Holy Cross Church).\n * **Architectural Diversity:** The city's architecture is a fascinating blend of meticulously restored historic buildings (like the Old Town),"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 463,"totalTokenCount": 1413,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} - -data: {"candidates": [{"content": {"parts": [{"text": " Soviet-era structures, and gleaming modern skyscrapers.\n\n4. **Key Landmarks and Attractions:**\n * **Old Town (Stare Miasto):** A UNESCO World Heritage Site, this beautifully reconstructed area features the Market Square,"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 512,"totalTokenCount": 1462,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} - -data: {"candidates": [{"content": {"parts": [{"text": " Royal Castle, and St. John's Archcathedral. It's a testament to the post-war reconstruction efforts.\n * **Royal Castle:** The historic residence of Polish monarchs, also rebuilt from scratch.\n * "}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 561,"totalTokenCount": 1511,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} - -data: {"candidates": [{"content": {"parts": [{"text": "**Łazienki Park (Royal Baths Park):** A stunning 18th-century park with palaces, pavilions, and a famous monument to Frédéric Chopin.\n * **Palace of Culture and Science:** A towering"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 609,"totalTokenCount": 1559,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} - -data: {"candidates": [{"content": {"parts": [{"text": " \"gift\" from the Soviet Union, it's an iconic landmark, albeit one with mixed feelings for many Poles. It offers panoramic views from its observation deck.\n * **Warsaw Uprising Museum:** A powerful and moving museum dedicated"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 659,"totalTokenCount": 1609,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} - -data: {"candidates": [{"content": {"parts": [{"text": " to the 1944 uprising, providing crucial insight into the city's spirit and history.\n * **POLIN Museum of the History of Polish Jews:** An award-winning museum exploring the thousand-year history of"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 707,"totalTokenCount": 1657,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} - -data: {"candidates": [{"content": {"parts": [{"text": " Jews in Poland.\n * **Copernicus Science Centre:** A modern, interactive science museum popular with families.\n * **Vistula River Boulevards:** Lively areas along the river, especially popular in summer."}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 757,"totalTokenCount": 1707,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} - -data: {"candidates": [{"content": {"parts": [{"text": "\n\n5. **Green Spaces:** Despite its urban density, Warsaw is remarkably green, with numerous parks and gardens, making up a significant portion of the city's area.\n\nIn essence, Warsaw is a city that embodies resilience, rebirth"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 805,"totalTokenCount": 1755,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} - -data: {"candidates": [{"content": {"parts": [{"text": ", and a profound connection to its past while looking vibrantly towards the future. It's a fascinating destination for anyone interested in history, culture, and the spirit of human perseverance."}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 842,"totalTokenCount": 1792,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 935},"modelVersion": "gemini-2.5-flash","responseId": "A7OJaZywDdvNkdUPu5Dq6A0"} +data: {"candidates": [{"content": {"parts": [{"text": ", excellent restaurants, and a growing startup scene, all while preserving its deep historical roots.\n\nIn short, Warsaw is a city of immense historical significance, incredible resilience, and vibrant modernity, offering a rich experience for visitors."}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 470,"totalTokenCount": 530,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 31},"modelVersion": "gemini-2.5-flash","responseId": "0FSYaY2oA8Wg1e8P3ZTdiAY"} diff --git a/agent/remoteagent/testdata/TestA2ARemoteAgentStreamingGeminiSuccess.httprr b/agent/remoteagent/testdata/TestA2ARemoteAgentStreamingGeminiSuccess.httprr index 944e3b3bc..543985bef 100644 --- a/agent/remoteagent/testdata/TestA2ARemoteAgentStreamingGeminiSuccess.httprr +++ b/agent/remoteagent/testdata/TestA2ARemoteAgentStreamingGeminiSuccess.httprr @@ -1,18 +1,19 @@ httprr trace v1 -441 9453 +509 6457 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 195 +Content-Length: 263 Content-Type: application/json -{"contents":[{"parts":[{"text":"tell me about the capital of Poland"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a helpful assistant."}],"role":"user"}}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"tell me about the capital of Poland"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a helpful assistant."},{"text":"You are an agent. Your internal name is \"model-agent\"."}],"role":"user"}}HTTP/2.0 200 OK Connection: close +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Disposition: attachment Content-Type: text/event-stream -Date: Mon, 09 Feb 2026 10:12:15 GMT +Date: Fri, 20 Feb 2026 12:34:21 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=6010 +Server-Timing: gfet4t7; dur=1705 Vary: Origin Vary: X-Origin Vary: Referer @@ -20,35 +21,25 @@ X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 -data: {"candidates": [{"content": {"parts": [{"text": "The capital of Poland is **Warsaw (Warszawa in Polish)**. It's the largest city in Poland and a vibrant, dynamic metropolis with a profoundly"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 32,"totalTokenCount": 1117,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": "The capital of Poland is **Warsaw** (Polish: *Warszawa*).\n\nHere's a bit"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 23,"totalTokenCount": 243,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 191},"modelVersion": "gemini-2.5-flash","responseId": "zFSYaYTFC7uUvr0P2Ynj4AU"} -data: {"candidates": [{"content": {"parts": [{"text": " resilient history.\n\nHere's a breakdown of what makes Warsaw special:\n\n1. **Historical Resilience and Rebirth (The \"Phoenix City\"):**\n * Warsaw's history is perhaps its most defining characteristic, especially regarding"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 83,"totalTokenCount": 1168,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": " about this fascinating city:\n\n* **Location:** Situated in central Poland, on the Vistula River.\n* **Population & Size:** It is the largest city in Poland, both by population and area, and one of the largest cities"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 74,"totalTokenCount": 294,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 191},"modelVersion": "gemini-2.5-flash","responseId": "zFSYaYTFC7uUvr0P2Ynj4AU"} -data: {"candidates": [{"content": {"parts": [{"text": " World War II. The city suffered immense destruction during the war, particularly during the **Warsaw Ghetto Uprising (1943)** and the **Warsaw Uprising (1944)**, when it was systematically demolished by Nazi"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 133,"totalTokenCount": 1218,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": " in the European Union.\n* **History & Resilience:** Warsaw has a truly remarkable history, most notably its near-complete destruction during World War II, particularly during the Warsaw Uprising in 1944. Despite this immense devastation"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 123,"totalTokenCount": 343,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 191},"modelVersion": "gemini-2.5-flash","responseId": "zFSYaYTFC7uUvr0P2Ynj4AU"} -data: {"candidates": [{"content": {"parts": [{"text": " Germany. An estimated 85-90% of its buildings, including the historic Old Town, were reduced to rubble.\n * Remarkably, after the war, the city embarked on an extraordinary reconstruction effort. The **"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 181,"totalTokenCount": 1266,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": ", the city was meticulously rebuilt by its people, often using original plans and salvaged materials. This incredible feat of reconstruction earned its **Old Town** a place on the **UNESCO World Heritage List** as an outstanding example of the reconstruction of a historic center"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 173,"totalTokenCount": 393,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 191},"modelVersion": "gemini-2.5-flash","responseId": "zFSYaYTFC7uUvr0P2Ynj4AU"} -data: {"candidates": [{"content": {"parts": [{"text": "Old Town** was meticulously rebuilt to its pre-war appearance, using historical paintings and plans. This incredible feat led to its designation as a **UNESCO World Heritage Site**, not just for its beauty, but as a unique testament to human resilience"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 229,"totalTokenCount": 1314,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": " after almost total destruction.\n* **Political & Economic Hub:** Today, Warsaw is Poland's political, economic, and cultural heart. It's home to the Polish Parliament, President, and numerous international companies.\n* "}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 220,"totalTokenCount": 440,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 191},"modelVersion": "gemini-2.5-flash","responseId": "zFSYaYTFC7uUvr0P2Ynj4AU"} -data: {"candidates": [{"content": {"parts": [{"text": " and dedication to preserving cultural heritage.\n\n2. **Cultural Hub:**\n * **Music:** Warsaw has strong ties to classical music, most notably being the birthplace of **Frédéric Chopin**. You'll find numerous Chopin-"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 277,"totalTokenCount": 1362,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": "**Cultural & Tourist Attractions:**\n * **Old Town:** A must-see, with its charming Market Square, St. John's Archcathedral, and the Royal Castle.\n * **Royal Castle:** The"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 268,"totalTokenCount": 488,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 191},"modelVersion": "gemini-2.5-flash","responseId": "zFSYaYTFC7uUvr0P2Ynj4AU"} -data: {"candidates": [{"content": {"parts": [{"text": "related sites, including the Chopin Museum, monuments in Łazienki Park, and regular concerts.\n * **Museums:** The city boasts world-class museums:\n * **Warsaw Uprising Museum:** A powerful"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 326,"totalTokenCount": 1411,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": " former residence of Polish monarchs.\n * **Łazienki Park (Royal Baths Park):** A beautiful park with palaces, pavilions, and a famous monument to Frédéric Chopin.\n * **Palace of Culture and"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 316,"totalTokenCount": 536,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 191},"modelVersion": "gemini-2.5-flash","responseId": "zFSYaYTFC7uUvr0P2Ynj4AU"} -data: {"candidates": [{"content": {"parts": [{"text": " and moving tribute to the 1944 uprising.\n * **POLIN Museum of the History of Polish Jews:** An award-winning museum detailing 1,000 years of Jewish life in Poland.\n * **"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 377,"totalTokenCount": 1462,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": " Science:** A towering Stalinist-era skyscraper, offering panoramic views from its observation deck.\n * **Warsaw Uprising Museum:** A powerful and moving museum dedicated to the 1944 uprising.\n * **POL"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 366,"totalTokenCount": 586,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 191},"modelVersion": "gemini-2.5-flash","responseId": "zFSYaYTFC7uUvr0P2Ynj4AU"} -data: {"candidates": [{"content": {"parts": [{"text": "Copernicus Science Centre:** One of Europe's largest science centers.\n * **Royal Castle:** Reconstructed after WWII, it houses impressive collections and tells the story of Polish monarchy.\n * **Performing Arts:** Numerous"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 426,"totalTokenCount": 1511,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": "IN Museum of the History of Polish Jews:** An award-winning museum exploring the rich history of Jews in Poland.\n* **Modernity & Green Spaces:** While rich in history, Warsaw is also a modern, bustling metropolis with a growing skyline"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 416,"totalTokenCount": 636,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 191},"modelVersion": "gemini-2.5-flash","responseId": "zFSYaYTFC7uUvr0P2Ynj4AU"} -data: {"candidates": [{"content": {"parts": [{"text": " theaters, opera houses, and music venues offer a rich cultural scene.\n\n3. **Key Landmarks and Attractions:**\n * **Old Town Market Square & Royal Castle:** The heart of the meticulously reconstructed historic district, bustling with cafes"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 476,"totalTokenCount": 1561,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": ", excellent public transport, and numerous parks and green areas.\n* **Vibe:** It offers a compelling blend of historical charm, vibrant contemporary culture, and a palpable sense of resilience and progress.\n\nIt's a city that truly"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 465,"totalTokenCount": 685,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 191},"modelVersion": "gemini-2.5-flash","responseId": "zFSYaYTFC7uUvr0P2Ynj4AU"} -data: {"candidates": [{"content": {"parts": [{"text": " and street performers.\n * **Royal Route:** A historic thoroughfare connecting the Royal Castle with other royal residences, lined with churches, palaces, and statues.\n * **Łazienki Park (Royal Baths Park"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 524,"totalTokenCount": 1609,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} - -data: {"candidates": [{"content": {"parts": [{"text": "):** A beautiful park with palaces, an amphitheater, and the famous Chopin monument. Peacocks roam freely!\n * **Palace of Culture and Science:** A controversial but iconic landmark, a \"gift\" from the"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 572,"totalTokenCount": 1657,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} - -data: {"candidates": [{"content": {"parts": [{"text": " Soviet Union. It offers panoramic views from its observation deck and houses theaters, museums, and offices.\n * **Warsaw Barbican:** A defensive gateway and part of the medieval city walls.\n * **Vistula River Bou"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 623,"totalTokenCount": 1708,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} - -data: {"candidates": [{"content": {"parts": [{"text": "levards:** Popular for walks, cycling, and outdoor recreation.\n\n4. **Modern Metropolis:**\n * Warsaw is not just history; it's a rapidly developing economic, political, and financial center. It has"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 671,"totalTokenCount": 1756,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} - -data: {"candidates": [{"content": {"parts": [{"text": " a modern skyline, a thriving business sector, and a vibrant nightlife.\n * It's the seat of the Polish government, parliament, and president.\n * The city is well-connected with an efficient public transport system,"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 721,"totalTokenCount": 1806,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} - -data: {"candidates": [{"content": {"parts": [{"text": " including a growing metro network.\n\nIn essence, Warsaw is a city of contrasts – ancient history woven with modern architecture, a solemn past celebrated with a vibrant present, and a testament to the enduring spirit of its people."}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 15,"candidatesTokenCount": 765,"totalTokenCount": 1850,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 15}],"thoughtsTokenCount": 1070},"modelVersion": "gemini-2.5-flash","responseId": "-bKJaazaNrDq7M8Pz9SS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": " embodies the spirit of rebirth and stands as a testament to human determination."}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 29,"candidatesTokenCount": 480,"totalTokenCount": 700,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 29}],"thoughtsTokenCount": 191},"modelVersion": "gemini-2.5-flash","responseId": "zFSYaYTFC7uUvr0P2Ynj4AU"} diff --git a/agent/remoteagent/testdata/TestA2ASingleHopFinalResponse_llm_mid-response_error.httprr b/agent/remoteagent/testdata/TestA2ASingleHopFinalResponse_llm_mid-response_error.httprr index 52e84e482..0188b2ae3 100644 --- a/agent/remoteagent/testdata/TestA2ASingleHopFinalResponse_llm_mid-response_error.httprr +++ b/agent/remoteagent/testdata/TestA2ASingleHopFinalResponse_llm_mid-response_error.httprr @@ -1,18 +1,19 @@ httprr trace v1 -439 1788 +507 1910 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 193 +Content-Length: 261 Content-Type: application/json -{"contents":[{"parts":[{"text":"Tell me about the current weather"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a helpful assistant."}],"role":"user"}}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Tell me about the current weather"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a helpful assistant."},{"text":"You are an agent. Your internal name is \"model-agent\"."}],"role":"user"}}HTTP/2.0 200 OK Connection: close +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Disposition: attachment Content-Type: text/event-stream -Date: Mon, 09 Feb 2026 10:12:09 GMT +Date: Fri, 20 Feb 2026 12:34:19 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=2694 +Server-Timing: gfet4t7; dur=1180 Vary: Origin Vary: X-Origin Vary: Referer @@ -20,9 +21,9 @@ X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 -data: {"candidates": [{"content": {"parts": [{"text": "I can definitely help you with that!\n\nHowever, to"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 14,"candidatesTokenCount": 12,"totalTokenCount": 518,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 14}],"thoughtsTokenCount": 492},"modelVersion": "gemini-2.5-flash","responseId": "9rKJaZbZMOa9kdUP57jlwAI"} +data: {"candidates": [{"content": {"parts": [{"text": "I cannot provide you with the current weather in real-time. As an AI, I don't"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 28,"candidatesTokenCount": 21,"totalTokenCount": 95,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 28}],"thoughtsTokenCount": 46},"modelVersion": "gemini-2.5-flash","responseId": "ylSYadPpJ4KA1e8Pp_-CiAo"} -data: {"candidates": [{"content": {"parts": [{"text": " give you the most accurate current weather, I need to know your **location**.\n\nPlease tell me:\n\n* **Your city and state/country**\n* **A zip code or postal code**\n\nOnce I have that,"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 14,"candidatesTokenCount": 61,"totalTokenCount": 567,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 14}],"thoughtsTokenCount": 492},"modelVersion": "gemini-2.5-flash","responseId": "9rKJaZbZMOa9kdUP57jlwAI"} +data: {"candidates": [{"content": {"parts": [{"text": " have access to live data or your current location.\n\nTo get the current weather, please check a reliable weather source like:\n\n* A weather app on your phone\n* A weather website (e.g., AccuWeather, The Weather"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 28,"candidatesTokenCount": 72,"totalTokenCount": 146,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 28}],"thoughtsTokenCount": 46},"modelVersion": "gemini-2.5-flash","responseId": "ylSYadPpJ4KA1e8Pp_-CiAo"} -data: {"candidates": [{"content": {"parts": [{"text": " I can look up the current temperature, conditions (sunny, cloudy, rainy), humidity, wind speed, and even a short-term forecast for you!"}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 14,"candidatesTokenCount": 92,"totalTokenCount": 598,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 14}],"thoughtsTokenCount": 492},"modelVersion": "gemini-2.5-flash","responseId": "9rKJaZbZMOa9kdUP57jlwAI"} +data: {"candidates": [{"content": {"parts": [{"text": " Channel, Google Weather)\n* Your local news or smart speaker\n\nYou'll likely need to provide your city or zip code for the most accurate information!"}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 28,"candidatesTokenCount": 105,"totalTokenCount": 179,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 28}],"thoughtsTokenCount": 46},"modelVersion": "gemini-2.5-flash","responseId": "ylSYadPpJ4KA1e8Pp_-CiAo"} diff --git a/agent/remoteagent/testdata/TestA2ASingleHopFinalResponse_llm_mid-response_error_response.httprr b/agent/remoteagent/testdata/TestA2ASingleHopFinalResponse_llm_mid-response_error_response.httprr index 8a5d3b95d..23a55cd16 100644 --- a/agent/remoteagent/testdata/TestA2ASingleHopFinalResponse_llm_mid-response_error_response.httprr +++ b/agent/remoteagent/testdata/TestA2ASingleHopFinalResponse_llm_mid-response_error_response.httprr @@ -1,18 +1,19 @@ httprr trace v1 -439 1799 +507 1897 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 193 +Content-Length: 261 Content-Type: application/json -{"contents":[{"parts":[{"text":"Tell me about the current weather"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a helpful assistant."}],"role":"user"}}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Tell me about the current weather"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a helpful assistant."},{"text":"You are an agent. Your internal name is \"model-agent\"."}],"role":"user"}}HTTP/2.0 200 OK Connection: close +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Disposition: attachment Content-Type: text/event-stream -Date: Mon, 09 Feb 2026 10:12:06 GMT +Date: Fri, 20 Feb 2026 12:34:18 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=4090 +Server-Timing: gfet4t7; dur=1227 Vary: Origin Vary: X-Origin Vary: Referer @@ -20,9 +21,9 @@ X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 -data: {"candidates": [{"content": {"parts": [{"text": "I'd love to tell you about"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 14,"candidatesTokenCount": 8,"totalTokenCount": 779,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 14}],"thoughtsTokenCount": 757},"modelVersion": "gemini-2.5-flash","responseId": "8rKJabi_HrDq7M8PvtSS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": "I'm sorry, but I cannot tell you about the current weather. As an AI, I don't have access"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 28,"candidatesTokenCount": 25,"totalTokenCount": 92,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 28}],"thoughtsTokenCount": 39},"modelVersion": "gemini-2.5-flash","responseId": "yFSYaYHNPJPH1e8P6vyhqQY"} -data: {"candidates": [{"content": {"parts": [{"text": " the current weather!\n\nHowever, as an AI, I don't know your specific location or have access to real-time data from where you are.\n\n**To give you an accurate update, please tell me:**\n\n* **Your"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 14,"candidatesTokenCount": 58,"totalTokenCount": 829,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 14}],"thoughtsTokenCount": 757},"modelVersion": "gemini-2.5-flash","responseId": "8rKJabi_HrDq7M8PvtSS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": " to real-time information or your current location.\n\nTo get the current weather, you can:\n* **Check a weather app** on your phone (e.g., Apple Weather, Google Weather, AccuWeather, The Weather Channel"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 28,"candidatesTokenCount": 75,"totalTokenCount": 142,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 28}],"thoughtsTokenCount": 39},"modelVersion": "gemini-2.5-flash","responseId": "yFSYaYHNPJPH1e8P6vyhqQY"} -data: {"candidates": [{"content": {"parts": [{"text": " city and state/country**\n* **(Or a zip/postal code)**\n\nOnce I have that, I can look up the current temperature, conditions, and even a short forecast for you!"}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 14,"candidatesTokenCount": 99,"totalTokenCount": 870,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 14}],"thoughtsTokenCount": 757},"modelVersion": "gemini-2.5-flash","responseId": "8rKJabi_HrDq7M8PvtSS6QE"} +data: {"candidates": [{"content": {"parts": [{"text": ")\n* **Use a search engine** like Google or Bing and type \"weather near me\" or \"weather in [your city]\"\n* **Look out your window!**"}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 28,"candidatesTokenCount": 114,"totalTokenCount": 181,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 28}],"thoughtsTokenCount": 39},"modelVersion": "gemini-2.5-flash","responseId": "yFSYaYHNPJPH1e8P6vyhqQY"} diff --git a/internal/llminternal/helpers_test.go b/internal/llminternal/helpers_test.go new file mode 100644 index 000000000..61d772d20 --- /dev/null +++ b/internal/llminternal/helpers_test.go @@ -0,0 +1,31 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package llminternal + +import ( + "google.golang.org/adk/agent" +) + +// mockLLMAgent satisfies both agent.Agent (via embedding) and llminternal.Agent (via internal() implementation) +type mockLLMAgent struct { + agent.Agent + s *State +} + +var _ Agent = (*mockLLMAgent)(nil) + +func (m *mockLLMAgent) internal() *State { + return m.s +} diff --git a/internal/llminternal/identity_request_processor.go b/internal/llminternal/identity_request_processor.go new file mode 100644 index 000000000..af978b45d --- /dev/null +++ b/internal/llminternal/identity_request_processor.go @@ -0,0 +1,44 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package llminternal + +import ( + "fmt" + "iter" + "strings" + + "google.golang.org/adk/agent" + "google.golang.org/adk/internal/utils" + "google.golang.org/adk/model" + "google.golang.org/adk/session" +) + +// identityRequestProcessor gives the agent identity from the framework. +func identityRequestProcessor(ctx agent.InvocationContext, req *model.LLMRequest, f *Flow) iter.Seq2[*session.Event, error] { + return func(yield func(*session.Event, error) bool) { + llmAgent := asLLMAgent(ctx.Agent()) + if llmAgent == nil { + return // do nothing. + } + + parts := []string{fmt.Sprintf("You are an agent. Your internal name is %q.", ctx.Agent().Name())} + if description := ctx.Agent().Description(); description != "" { + parts = append(parts, fmt.Sprintf("The description about you is %q.", description)) + } + si := strings.Join(parts, " ") + + utils.AppendInstructions(req, si) + } +} diff --git a/internal/llminternal/identity_request_processor_test.go b/internal/llminternal/identity_request_processor_test.go new file mode 100644 index 000000000..e660026f6 --- /dev/null +++ b/internal/llminternal/identity_request_processor_test.go @@ -0,0 +1,159 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package llminternal + +import ( + "strings" + "testing" + + "google.golang.org/genai" + + "google.golang.org/adk/agent" + icontext "google.golang.org/adk/internal/context" + "google.golang.org/adk/internal/utils" + "google.golang.org/adk/model" +) + +func TestIdentityRequestProcessor(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + agent agent.Agent + existingSI *genai.Content + wantContains []string + wantNotContain []string + wantNoSI bool + }{ + { + name: "InjectsNameOnly", + agent: &mockLLMAgent{ + Agent: utils.Must(agent.New(agent.Config{Name: "test_agent"})), + s: &State{}, + }, + wantContains: []string{ + "You are an agent.", + "Your internal name is \"test_agent\".", + }, + wantNotContain: []string{ + "The description about you is", + }, + }, + { + name: "InjectsNameAndDescription", + agent: &mockLLMAgent{ + Agent: utils.Must(agent.New(agent.Config{ + Name: "helper_agent", + Description: "A helpful assistant that answers questions", + })), + s: &State{}, + }, + wantContains: []string{ + "You are an agent.", + "Your internal name is \"helper_agent\".", + "The description about you is \"A helpful assistant that answers questions\".", + }, + }, + { + name: "NoOpForNonLLMAgent", + agent: utils.Must(agent.New(agent.Config{Name: "plain_agent"})), + wantNoSI: true, + }, + { + name: "EmptyDescription", + agent: &mockLLMAgent{ + Agent: utils.Must(agent.New(agent.Config{ + Name: "empty_desc_agent", + Description: "", + })), + s: &State{}, + }, + wantContains: []string{ + "You are an agent.", + "Your internal name is \"empty_desc_agent\".", + }, + wantNotContain: []string{ + "The description about you is", + }, + }, + { + name: "AppendsToExistingInstructions", + agent: &mockLLMAgent{ + Agent: utils.Must(agent.New(agent.Config{Name: "append_agent"})), + s: &State{}, + }, + existingSI: genai.NewContentFromText("Be concise.", genai.RoleUser), + wantContains: []string{ + "Be concise.", + "You are an agent.", + "Your internal name is \"append_agent\".", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + + req := &model.LLMRequest{} + if tt.existingSI != nil { + req.Config = &genai.GenerateContentConfig{ + SystemInstruction: tt.existingSI, + } + } + + ctx := icontext.NewInvocationContext(t.Context(), icontext.InvocationContextParams{ + Agent: tt.agent, + }) + + iter := identityRequestProcessor(ctx, req, &Flow{}) + + var eventCount int + for _, err := range iter { + if err != nil { + t.Fatalf("identityRequestProcessor() unexpected error: %v", err) + } + eventCount++ + } + + if eventCount > 0 { + t.Errorf("identityRequestProcessor() yielded %d events, want 0", eventCount) + } + + if tt.wantNoSI { + if req.Config != nil && req.Config.SystemInstruction != nil { + t.Errorf("identityRequestProcessor() set SystemInstruction on non-LLM agent, got: %v", req.Config.SystemInstruction) + } + return + } + + if req.Config == nil || req.Config.SystemInstruction == nil { + t.Fatal("identityRequestProcessor() did not set SystemInstruction") + } + + si := strings.Join(utils.TextParts(req.Config.SystemInstruction), " ") + for _, want := range tt.wantContains { + if !strings.Contains(si, want) { + t.Errorf("SystemInstruction does not contain %q\ngot: %q", want, si) + } + } + for _, notWant := range tt.wantNotContain { + if strings.Contains(si, notWant) { + t.Errorf("SystemInstruction unexpectedly contains %q\ngot: %q", notWant, si) + } + } + }) + } +} diff --git a/internal/llminternal/other_processors.go b/internal/llminternal/other_processors.go index c7fcfb0f9..8980b899c 100644 --- a/internal/llminternal/other_processors.go +++ b/internal/llminternal/other_processors.go @@ -22,11 +22,6 @@ import ( "google.golang.org/adk/session" ) -func identityRequestProcessor(ctx agent.InvocationContext, req *model.LLMRequest, f *Flow) iter.Seq2[*session.Event, error] { - // TODO: implement (adk-python src/google/adk/flows/llm_flows/identity.py) - return func(yield func(*session.Event, error) bool) {} -} - func nlPlanningRequestProcessor(ctx agent.InvocationContext, req *model.LLMRequest, f *Flow) iter.Seq2[*session.Event, error] { // TODO: implement (adk-python src/google/adk/flows/llm_flows/_nl_plnning.py) return func(yield func(*session.Event, error) bool) {} diff --git a/internal/llminternal/outputschema_processor_test.go b/internal/llminternal/outputschema_processor_test.go index a4f4b38fc..6d0d8c29c 100644 --- a/internal/llminternal/outputschema_processor_test.go +++ b/internal/llminternal/outputschema_processor_test.go @@ -59,16 +59,6 @@ func (m *mockLLM) GetGoogleLLMVariant() genai.Backend { return genai.BackendGeminiAPI } -// mockLLMAgent satisfies both agent.Agent (via embedding) and llminternal.Agent (via internal() implementation) -type mockLLMAgent struct { - agent.Agent - s *State -} - -func (m *mockLLMAgent) internal() *State { - return m.s -} - func TestOutputSchemaRequestProcessor(t *testing.T) { schema := &genai.Schema{ Type: genai.TypeObject, @@ -85,7 +75,7 @@ func TestOutputSchemaRequestProcessor(t *testing.T) { mockAgent := &mockLLMAgent{ Agent: baseAgent, s: &State{ - Model: &mockLLM{name: "gemini-1.5-flash"}, + Model: &mockLLM{name: "gemini-2.5-flash"}, OutputSchema: schema, Tools: []tool.Tool{&mockTool{name: "other_tool"}}, }, @@ -125,7 +115,7 @@ func TestOutputSchemaRequestProcessor(t *testing.T) { mockAgent := &mockLLMAgent{ Agent: baseAgent, s: &State{ - Model: &mockLLM{name: "gemini-1.5-flash"}, + Model: &mockLLM{name: "gemini-2.5-flash"}, OutputSchema: schema, Tools: nil, // No tools -> optimization skips processor }, @@ -151,7 +141,7 @@ func TestOutputSchemaRequestProcessor(t *testing.T) { mockAgent := &mockLLMAgent{ Agent: baseAgent, s: &State{ - Model: &mockLLM{name: "gemini-1.5-flash"}, + Model: &mockLLM{name: "gemini-2.5-flash"}, OutputSchema: nil, Tools: []tool.Tool{&mockTool{name: "other_tool"}}, }, @@ -173,9 +163,9 @@ func TestOutputSchemaRequestProcessor(t *testing.T) { }) t.Run("NoOpWhenNativeSupportAvailable", func(t *testing.T) { - // Native support = Vertex AI + Gemini 2.0+ + // Native support = Vertex AI + Gemini 2.5+ llm := &mockLLM{ - name: "gemini-2.0-flash", + name: "gemini-2.5-flash", variant: func() *genai.Backend { x := genai.BackendVertexAI; return &x }(), } diff --git a/internal/utils/utils.go b/internal/utils/utils.go index c8820dec3..384cdd9ea 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -131,6 +131,7 @@ func Must[T agent.Agent](a T, err error) T { return a } +// AppendInstructions appends instructions to the [genai.GenerateContentConfig.SystemInstruction] system instruction. func AppendInstructions(r *model.LLMRequest, instructions ...string) { if len(instructions) == 0 { return diff --git a/model/gemini/gemini_test.go b/model/gemini/gemini_test.go index feaac3c2e..6640c41b1 100644 --- a/model/gemini/gemini_test.go +++ b/model/gemini/gemini_test.go @@ -43,7 +43,7 @@ func TestModel_Generate(t *testing.T) { }{ { name: "ok", - modelName: "gemini-2.0-flash", + modelName: "gemini-2.5-flash", req: &model.LLMRequest{ Contents: genai.Text("What is the capital of France? One word."), Config: &genai.GenerateContentConfig{ @@ -51,13 +51,14 @@ func TestModel_Generate(t *testing.T) { }, }, want: &model.LLMResponse{ - Content: genai.NewContentFromText("Paris\n", genai.RoleModel), + Content: genai.NewContentFromText("Paris", genai.RoleModel), UsageMetadata: &genai.GenerateContentResponseUsageMetadata{ - CandidatesTokenCount: 2, - CandidatesTokensDetails: []*genai.ModalityTokenCount{{Modality: "TEXT", TokenCount: 2}}, - PromptTokenCount: 10, - PromptTokensDetails: []*genai.ModalityTokenCount{{Modality: "TEXT", TokenCount: 10}}, - TotalTokenCount: 12, + CandidatesTokenCount: 1, + CandidatesTokensDetails: nil, + PromptTokenCount: 11, + PromptTokensDetails: []*genai.ModalityTokenCount{{Modality: "TEXT", TokenCount: 11}}, + ThoughtsTokenCount: 34, + TotalTokenCount: 46, }, FinishReason: "STOP", }, @@ -95,14 +96,14 @@ func TestModel_GenerateStream(t *testing.T) { }{ { name: "ok", - modelName: "gemini-2.0-flash", + modelName: "gemini-2.5-flash", req: &model.LLMRequest{ Contents: genai.Text("What is the capital of France? One word."), Config: &genai.GenerateContentConfig{ Temperature: new(float32), }, }, - want: "Paris\n", + want: "Paris", }, } for _, tt := range tests { @@ -168,7 +169,7 @@ func TestModel_TrackingHeaders(t *testing.T) { APIKey: apiKey, } - geminiModel, err := NewModel(t.Context(), "gemini-2.0-flash", cfg) + geminiModel, err := NewModel(t.Context(), "gemini-2.5-flash", cfg) if err != nil { t.Fatal(err) } diff --git a/model/gemini/testdata/TestModel_GenerateStream_ok.httprr b/model/gemini/testdata/TestModel_GenerateStream_ok.httprr index 8ef6c1f90..a2ff2107d 100644 --- a/model/gemini/testdata/TestModel_GenerateStream_ok.httprr +++ b/model/gemini/testdata/TestModel_GenerateStream_ok.httprr @@ -1,6 +1,6 @@ httprr trace v1 -375 1028 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:streamGenerateContent?alt=sse HTTP/1.1 +375 769 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 Content-Length: 129 @@ -8,11 +8,12 @@ Content-Type: application/json {"contents":[{"parts":[{"text":"What is the capital of France? One word."}],"role":"user"}],"generationConfig":{"temperature":0}}HTTP/2.0 200 OK Connection: close +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Disposition: attachment Content-Type: text/event-stream -Date: Mon, 18 Aug 2025 13:55:15 GMT +Date: Fri, 20 Feb 2026 12:38:32 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=327 +Server-Timing: gfet4t7; dur=786 Vary: Origin Vary: X-Origin Vary: Referer @@ -20,7 +21,5 @@ X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 -data: {"candidates": [{"content": {"parts": [{"text": "Paris"}],"role": "model"}}],"usageMetadata": {"promptTokenCount": 11,"totalTokenCount": 11,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 11}]},"modelVersion": "gemini-2.0-flash","responseId": "wzCjaPa4As7shMIP2Mei0AI"} - -data: {"candidates": [{"content": {"parts": [{"text": "\n"}],"role": "model"},"finishReason": "STOP"}],"usageMetadata": {"promptTokenCount": 10,"candidatesTokenCount": 2,"totalTokenCount": 12,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 10}],"candidatesTokensDetails": [{"modality": "TEXT","tokenCount": 2}]},"modelVersion": "gemini-2.0-flash","responseId": "wzCjaPa4As7shMIP2Mei0AI"} +data: {"candidates": [{"content": {"parts": [{"text": "Paris"}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 11,"candidatesTokenCount": 1,"totalTokenCount": 45,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 11}],"thoughtsTokenCount": 33},"modelVersion": "gemini-2.5-flash","responseId": "yFWYabnBB8Wg1e8P3ZTdiAY"} diff --git a/model/gemini/testdata/TestModel_Generate_ok.httprr b/model/gemini/testdata/TestModel_Generate_ok.httprr index eebb4ba95..18fdff6cd 100644 --- a/model/gemini/testdata/TestModel_Generate_ok.httprr +++ b/model/gemini/testdata/TestModel_Generate_ok.httprr @@ -1,16 +1,17 @@ httprr trace v1 -361 954 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +361 904 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 Content-Length: 129 Content-Type: application/json {"contents":[{"parts":[{"text":"What is the capital of France? One word."}],"role":"user"}],"generationConfig":{"temperature":0}}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Mon, 18 Aug 2025 13:55:14 GMT +Date: Fri, 20 Feb 2026 12:38:32 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=394 +Server-Timing: gfet4t7; dur=1173 Vary: Origin Vary: X-Origin Vary: Referer @@ -24,32 +25,27 @@ X-Xss-Protection: 0 "content": { "parts": [ { - "text": "Paris\n" + "text": "Paris" } ], "role": "model" }, "finishReason": "STOP", - "avgLogprobs": -0.00055273278849199414 + "index": 0 } ], "usageMetadata": { - "promptTokenCount": 10, - "candidatesTokenCount": 2, - "totalTokenCount": 12, + "promptTokenCount": 11, + "candidatesTokenCount": 1, + "totalTokenCount": 46, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 10 + "tokenCount": 11 } ], - "candidatesTokensDetails": [ - { - "modality": "TEXT", - "tokenCount": 2 - } - ] + "thoughtsTokenCount": 34 }, - "modelVersion": "gemini-2.0-flash", - "responseId": "wjCjaI3AI7mokdUPn8Gf2Ac" + "modelVersion": "gemini-2.5-flash", + "responseId": "xlWYafXAOKSf1e8PpcODiAg" } diff --git a/model/gemini/testdata/TestModel_TrackingHeaders_verifies_headers_are_set.httprr b/model/gemini/testdata/TestModel_TrackingHeaders_verifies_headers_are_set.httprr index 24d066e16..20855d0b2 100644 --- a/model/gemini/testdata/TestModel_TrackingHeaders_verifies_headers_are_set.httprr +++ b/model/gemini/testdata/TestModel_TrackingHeaders_verifies_headers_are_set.httprr @@ -1,16 +1,17 @@ httprr trace v1 -309 994 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +309 930 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 Content-Length: 78 Content-Type: application/json {"contents":[{"parts":[{"text":"ping"}],"role":"user"}],"generationConfig":{}}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Thu, 06 Nov 2025 11:23:18 GMT +Date: Fri, 20 Feb 2026 12:38:35 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=585 +Server-Timing: gfet4t7; dur=2945 Vary: Origin Vary: X-Origin Vary: Referer @@ -24,32 +25,27 @@ X-Xss-Protection: 0 "content": { "parts": [ { - "text": "Pong! \n\nIs there anything I can help you with?\n" + "text": "Pong! How can I help you today?" } ], "role": "model" }, "finishReason": "STOP", - "avgLogprobs": -0.35232135227748324 + "index": 0 } ], "usageMetadata": { - "promptTokenCount": 1, - "candidatesTokenCount": 14, - "totalTokenCount": 15, + "promptTokenCount": 2, + "candidatesTokenCount": 9, + "totalTokenCount": 469, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 1 + "tokenCount": 2 } ], - "candidatesTokensDetails": [ - { - "modality": "TEXT", - "tokenCount": 14 - } - ] + "thoughtsTokenCount": 458 }, - "modelVersion": "gemini-2.0-flash", - "responseId": "JYUMaciaHZ7hnsEP9amb6Qg" + "modelVersion": "gemini-2.5-flash", + "responseId": "yFWYaYucO4a4vr0PqICv0Aw" } diff --git a/plugin/functioncallmodifier/integration_test.go b/plugin/functioncallmodifier/integration_test.go index 4532bd87a..21ba004cd 100644 --- a/plugin/functioncallmodifier/integration_test.go +++ b/plugin/functioncallmodifier/integration_test.go @@ -35,7 +35,7 @@ import ( "google.golang.org/adk/tool/functiontool" ) -//go:generate go test -httprecord=testdata/.*\.httprr +//go:generate go test -v -httprecord=testdata/.*\.httprr func TestPluginCallbackIntegration(t *testing.T) { functionTool, err := functiontool.New(functiontool.Config{ @@ -74,7 +74,7 @@ func TestPluginCallbackIntegration(t *testing.T) { name: "transfer to agent tool", tools: func(a agent.Agent) []tool.Tool { return []tool.Tool{} }, wantSkillStateValue: "add", - wantRationaleStateValue: "The user is asking to add two numbers, and the calculator agent has an add skill.", + wantRationaleStateValue: "The user is asking to add two numbers, and the calculator agent has an add skill to perform this operation.", shouldHaveSkillState: true, shouldHaveRationaleState: true, }, diff --git a/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_agent_tool_default_schema.httprr b/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_agent_tool_default_schema.httprr index ac73198ee..1d4764c9b 100644 --- a/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_agent_tool_default_schema.httprr +++ b/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_agent_tool_default_schema.httprr @@ -1,16 +1,17 @@ httprr trace v1 -989 1704 +1109 1743 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 757 +Content-Length: 877 Content-Type: application/json -{"contents":[{"parts":[{"text":"Can you add 2 and 2?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a transfer agent. You can transfer to other agents using your tools."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"This tool can now optionally accept skill_id and rationale parameters to guide skill-based orchestration. calculator agent\n Skills: add, subtract, multiply, divide","name":"calculator","parameters":{"properties":{"rationale":{"description":"The reasoning behind selecting this agent and skill.","type":"STRING"},"request":{"type":"STRING"},"skill_id":{"description":"The specific skill to be utilized by the agent.","type":"STRING"}},"required":["request"],"type":"OBJECT"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Can you add 2 and 2?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a transfer agent. You can transfer to other agents using your tools."},{"text":"You are an agent. Your internal name is \"transfer_agent\". The description about you is \"transfer agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"This tool can now optionally accept skill_id and rationale parameters to guide skill-based orchestration. calculator agent\n Skills: add, subtract, multiply, divide","name":"calculator","parameters":{"properties":{"rationale":{"description":"The reasoning behind selecting this agent and skill.","type":"STRING"},"request":{"type":"STRING"},"skill_id":{"description":"The specific skill to be utilized by the agent.","type":"STRING"}},"required":["request"],"type":"OBJECT"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Thu, 05 Feb 2026 13:47:59 GMT +Date: Fri, 20 Feb 2026 12:51:28 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=895 +Server-Timing: gfet4t7; dur=1829 Vary: Origin Vary: X-Origin Vary: Referer @@ -27,12 +28,12 @@ X-Xss-Protection: 0 "functionCall": { "name": "calculator", "args": { - "request": "2+2", "skill_id": "add", - "rationale": "The user is asking to add two numbers, and the calculator tool with the add skill can perform this operation." + "rationale": "The user is asking to add two numbers, and the calculator tool with the add skill can perform this operation.", + "request": "2 + 2" } }, - "thoughtSignature": "CtECAb4+9vvPBKTo7gXMQg5en/JH6fJLjWHx6/D5sd96TOEWqP8RiCvGGwRasFqOmGm0xTWSAqI+tx9aGMxMuuP4rZ+O430zG99M81TbPjvF1xsPafDSo5hLPXSOjs6OldjyC248Qweta/NxEJHcRWbTxX/RxGgCS8l2kC8qejYJ3vBarKXm7RCh1kk1E01gkQ/I66ClY5eWam3Vzv5AhFB4gbMtw1hPvVtEOuIu2WTpjvTXRKwAADn8kLoYWtTpfwnRpoaAzd7moM098MDVjtiWQ8hOuJXP9/Ryc9Lj3RLPYvLUkLkEpm91l+88Mi8OhNwyTESgOpEYJcFqO4YVD62jImlEguO59Zq1EzquGc9gxbIAohw573pRQbRy/XH/eCozLPh3f2riFtLgB4I3KX79TtVdRAgzxePexxasx/xtbhQLnYlHts8EwZufw2juZFDuOw==" + "thoughtSignature": "CsICAb4+9vt9/1L8xVx5XEypruXBMQq91+7+GBLGcwKMWCtvAu6hM5Z4i5GvJBwtX8ySyc8rIlvB7DSOcyC213aJPiftSL+a7uzcah7u3rVFo61dVDHlP0bWTFhfSytHbavUt6H3ojfXxgriMXWbXIpIKaBq15kYAwzTk9sIjg2uPjeHB256gAZnibTqt9ltEWG7r4Un0mBfspbsQaHAb1wt+uIoqrWYU+v9ogI+UKSgPYy2oZs6Li07t3E2KpFOY2gGEkmMVvmgTGwwQ2+KwK9XgKfNYbj+twqTH6a4YfCHjRpdpERYy67axHodRX+IXiPhPGurknNz9O2vULnU2DnIv1LCR7v6HcbF46Mra6JVYJTCNJz2Z44QMBxlBZY4vbV+1jTAhx3lY9rONTtyxdUMt8n8b2d0f69sW6xTGRG6GI8fkA==" } ], "role": "model" @@ -43,34 +44,35 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 141, - "candidatesTokenCount": 48, - "totalTokenCount": 267, + "promptTokenCount": 164, + "candidatesTokenCount": 49, + "totalTokenCount": 285, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 141 + "tokenCount": 164 } ], - "thoughtsTokenCount": 78 + "thoughtsTokenCount": 72 }, "modelVersion": "gemini-2.5-flash", - "responseId": "jp-Eaf3SOdnknsEPlcuTkQ0" + "responseId": "z1iYaZPaArLZ2roPsKvdOQ" } -435 708 +598 785 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 189 +Content-Length: 352 Content-Type: application/json -{"contents":[{"parts":[{"text":"2+2"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a calculator agent. You can calculate numbers."}],"role":"user"}}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"2 + 2"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a calculator agent. You can calculate numbers."},{"text":"You are an agent. Your internal name is \"calculator\". The description about you is \"calculator agent\\n Skills: add, subtract, multiply, divide\"."}],"role":"user"}}HTTP/2.0 200 OK Connection: close +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Disposition: attachment Content-Type: text/event-stream -Date: Thu, 05 Feb 2026 13:47:59 GMT +Date: Fri, 20 Feb 2026 12:51:30 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=419 +Server-Timing: gfet4t7; dur=1182 Vary: Origin Vary: X-Origin Vary: Referer @@ -78,20 +80,21 @@ X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 -data: {"candidates": [{"content": {"parts": [{"text": "4"}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 16,"candidatesTokenCount": 1,"totalTokenCount": 50,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 16}],"thoughtsTokenCount": 33},"modelVersion": "gemini-2.5-flash","responseId": "j5-EaaO7De-qkdUP7KSl8A4"} +data: {"candidates": [{"content": {"parts": [{"text": "calculator.add(2, 2)"}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 49,"candidatesTokenCount": 9,"totalTokenCount": 99,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 49}],"thoughtsTokenCount": 41},"modelVersion": "gemini-2.5-flash","responseId": "0FiYabrDO5H-2roP9_2W2Q0"} -1654 832 +1775 1352 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 1421 +Content-Length: 1542 Content-Type: application/json -{"contents":[{"parts":[{"text":"Can you add 2 and 2?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"request":"2+2"},"name":"calculator"},"thoughtSignature":"CtECAb4+9vvPBKTo7gXMQg5en/JH6fJLjWHx6/D5sd96TOEWqP8RiCvGGwRasFqOmGm0xTWSAqI+tx9aGMxMuuP4rZ+O430zG99M81TbPjvF1xsPafDSo5hLPXSOjs6OldjyC248Qweta/NxEJHcRWbTxX/RxGgCS8l2kC8qejYJ3vBarKXm7RCh1kk1E01gkQ/I66ClY5eWam3Vzv5AhFB4gbMtw1hPvVtEOuIu2WTpjvTXRKwAADn8kLoYWtTpfwnRpoaAzd7moM098MDVjtiWQ8hOuJXP9/Ryc9Lj3RLPYvLUkLkEpm91l+88Mi8OhNwyTESgOpEYJcFqO4YVD62jImlEguO59Zq1EzquGc9gxbIAohw573pRQbRy/XH/eCozLPh3f2riFtLgB4I3KX79TtVdRAgzxePexxasx/xtbhQLnYlHts8EwZufw2juZFDuOw=="}],"role":"model"},{"parts":[{"functionResponse":{"name":"calculator","response":{"result":"4"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a transfer agent. You can transfer to other agents using your tools."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"This tool can now optionally accept skill_id and rationale parameters to guide skill-based orchestration. calculator agent\n Skills: add, subtract, multiply, divide","name":"calculator","parameters":{"properties":{"rationale":{"description":"The reasoning behind selecting this agent and skill.","type":"STRING"},"request":{"type":"STRING"},"skill_id":{"description":"The specific skill to be utilized by the agent.","type":"STRING"}},"required":["request"],"type":"OBJECT"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Can you add 2 and 2?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"request":"2 + 2"},"name":"calculator"},"thoughtSignature":"CsICAb4+9vt9/1L8xVx5XEypruXBMQq91+7+GBLGcwKMWCtvAu6hM5Z4i5GvJBwtX8ySyc8rIlvB7DSOcyC213aJPiftSL+a7uzcah7u3rVFo61dVDHlP0bWTFhfSytHbavUt6H3ojfXxgriMXWbXIpIKaBq15kYAwzTk9sIjg2uPjeHB256gAZnibTqt9ltEWG7r4Un0mBfspbsQaHAb1wt+uIoqrWYU+v9ogI+UKSgPYy2oZs6Li07t3E2KpFOY2gGEkmMVvmgTGwwQ2+KwK9XgKfNYbj+twqTH6a4YfCHjRpdpERYy67axHodRX+IXiPhPGurknNz9O2vULnU2DnIv1LCR7v6HcbF46Mra6JVYJTCNJz2Z44QMBxlBZY4vbV+1jTAhx3lY9rONTtyxdUMt8n8b2d0f69sW6xTGRG6GI8fkA=="}],"role":"model"},{"parts":[{"functionResponse":{"name":"calculator","response":{"result":"calculator.add(2, 2)"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a transfer agent. You can transfer to other agents using your tools."},{"text":"You are an agent. Your internal name is \"transfer_agent\". The description about you is \"transfer agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"This tool can now optionally accept skill_id and rationale parameters to guide skill-based orchestration. calculator agent\n Skills: add, subtract, multiply, divide","name":"calculator","parameters":{"properties":{"rationale":{"description":"The reasoning behind selecting this agent and skill.","type":"STRING"},"request":{"type":"STRING"},"skill_id":{"description":"The specific skill to be utilized by the agent.","type":"STRING"}},"required":["request"],"type":"OBJECT"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Thu, 05 Feb 2026 13:48:00 GMT +Date: Fri, 20 Feb 2026 12:51:31 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=579 +Server-Timing: gfet4t7; dur=1582 Vary: Origin Vary: X-Origin Vary: Referer @@ -105,7 +108,8 @@ X-Xss-Protection: 0 "content": { "parts": [ { - "text": "The answer is 4.\n" + "text": "2 + 2 = 4.", + "thoughtSignature": "CqsCAb4+9vvS8nnHtdgLkkrI6NN79dQZn96idZjhvpGjIaj5VVNNNyphjhLpRYg2jMEDMmpAJSjfviZhXvsXhCj6IRCkFAp8yQQrzo5roVOoNzhXQa9uly0aKjcQ29R+iAhElRo61oZILmplH4Ugx67nYTu3YjwykEOsZglEgBxfM0gH+HlETbJCzzLlVHaAWm1ONFhtRDNVNLCH/TWygDb41kpdODOhC2sBDVQwvMCdi44GV71zU6Q8N5S2S62d51tFBw04DzuZ3O04dsgiHtwBh/rePO4Mxjw6L006nh+kPaoUxMf8MqE5un0WSUZJTcYEyw1RpJK7Prfm0DJXZvw3ldUjlpnHB9wQXEa9m+c8FLjqwKWI1isqT5oMEjfWqwZsgW00+Be4qe8H+VI=" } ], "role": "model" @@ -115,16 +119,17 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 169, - "candidatesTokenCount": 6, - "totalTokenCount": 175, + "promptTokenCount": 201, + "candidatesTokenCount": 8, + "totalTokenCount": 280, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 169 + "tokenCount": 201 } - ] + ], + "thoughtsTokenCount": 71 }, "modelVersion": "gemini-2.5-flash", - "responseId": "j5-EaeimO-D6nsEP4_2KkAw" + "responseId": "0liYafLTC-ad0-kPrfidgAs" } diff --git a/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_no_relevant_tools.httprr b/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_no_relevant_tools.httprr index 3daf02ee2..a8c3fd9b4 100644 --- a/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_no_relevant_tools.httprr +++ b/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_no_relevant_tools.httprr @@ -1,16 +1,17 @@ httprr trace v1 -687 1123 +807 1204 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 455 +Content-Length: 575 Content-Type: application/json -{"contents":[{"parts":[{"text":"Can you add 2 and 2?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a transfer agent. You can transfer to other agents using your tools."}],"role":"user"},"tools":[{"functionDeclarations":[{"name":"other_tool","parametersJsonSchema":{"additionalProperties":false,"properties":{"Num":{"type":"integer"}},"required":["Num"],"type":"object"},"responseJsonSchema":{"type":"string"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Can you add 2 and 2?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a transfer agent. You can transfer to other agents using your tools."},{"text":"You are an agent. Your internal name is \"transfer_agent\". The description about you is \"transfer agent\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"name":"other_tool","parametersJsonSchema":{"additionalProperties":false,"properties":{"Num":{"type":"integer"}},"required":["Num"],"type":"object"},"responseJsonSchema":{"type":"string"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Thu, 05 Feb 2026 13:47:58 GMT +Date: Fri, 20 Feb 2026 12:51:26 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=566 +Server-Timing: gfet4t7; dur=979 Vary: Origin Vary: X-Origin Vary: Referer @@ -24,8 +25,8 @@ X-Xss-Protection: 0 "content": { "parts": [ { - "text": "2 + 2 = 4.", - "thoughtSignature": "Cq0BAb4+9vuqU735JXQTTJt8AzBNS1iKepi4iTBTFKLC3fvvFkNdDSWN/6bIGBAXgREnt6ZG/wxD3YhcN8jqYc52WjQ5TjLGqTLxz2hC+WMnfRBwIzWStGjerEnwcDQ+W160gNboakSZPFuG+tRSbASMHD9a59oiwSGPbC+FTPIzzFazgB69YsdprBXX8x+XkMHN7MqvmdDNRbjDhSKXU/SAgVs+rYXP3r9tOXCMbDg=" + "text": "2 + 2 = 4", + "thoughtSignature": "CsABAb4+9vsHtz4/zYGRDzidP5GJdcesiSPqwWjPC0rDQ7VZg69k6UmQv3JJ5Mld2R1gO04+zJ8vChL05E5gDzDvvG8EB+uMmvKRkDZv150TFvSb9PY0/Q3KWzTqWv2Z/1LDEHrlYT10X/DBkBXTBupUPj7TgmNcbRoXVhA6AeryvqDIjN0YjSVBpBXA388SCHQ40cpY4oze0i0CE5dNADkH7O5e3Vw8UYkK05Tvic6SpST+snU4xmLb3Q27+atX8HSV" } ], "role": "model" @@ -35,17 +36,17 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 59, - "candidatesTokenCount": 8, - "totalTokenCount": 99, + "promptTokenCount": 82, + "candidatesTokenCount": 7, + "totalTokenCount": 125, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 59 + "tokenCount": 82 } ], - "thoughtsTokenCount": 32 + "thoughtsTokenCount": 36 }, "modelVersion": "gemini-2.5-flash", - "responseId": "jp-Ead7aA5r97M8Pwe_VoQ8" + "responseId": "zViYadvqOd6M2roPsP3UyAs" } diff --git a/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_transfer_to_agent_tool.httprr b/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_transfer_to_agent_tool.httprr index 083c6a563..528ca6dc4 100644 --- a/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_transfer_to_agent_tool.httprr +++ b/plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_transfer_to_agent_tool.httprr @@ -1,16 +1,17 @@ httprr trace v1 -1668 1717 +1788 1869 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 1435 +Content-Length: 1555 Content-Type: application/json -{"contents":[{"parts":[{"text":"Can you add 2 and 2?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a transfer agent. You can transfer to other agents using your tools."},{"text":"You have a list of other agents to transfer to:\n\nAgent name: calculator\nAgent description: calculator agent\n Skills: add, subtract, multiply, divide\n\nIf you are the best to answer the question according to your description, you\ncan answer it.\nIf another agent is better for answering the question according to its\ndescription, call 'transfer_to_agent' function to transfer the\nquestion to that agent. When transfering, do not generate any text other than\nthe function call.\n\n"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"This tool can now optionally accept skill_id and rationale parameters to guide skill-based orchestration. Transfer the question to another agent.\nThis tool hands off control to another agent when it's more suitable to answer the user's question according to the agent's description.","name":"transfer_to_agent","parameters":{"properties":{"agent_name":{"description":"the agent name to transfer to","type":"string"},"rationale":{"description":"The reasoning behind selecting this agent and skill.","type":"STRING"},"skill_id":{"description":"The specific skill to be utilized by the agent.","type":"STRING"}},"required":["agent_name"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Can you add 2 and 2?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a transfer agent. You can transfer to other agents using your tools."},{"text":"You are an agent. Your internal name is \"transfer_agent\". The description about you is \"transfer agent\"."},{"text":"You have a list of other agents to transfer to:\n\nAgent name: calculator\nAgent description: calculator agent\n Skills: add, subtract, multiply, divide\n\nIf you are the best to answer the question according to your description, you\ncan answer it.\nIf another agent is better for answering the question according to its\ndescription, call 'transfer_to_agent' function to transfer the\nquestion to that agent. When transfering, do not generate any text other than\nthe function call.\n\n"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"This tool can now optionally accept skill_id and rationale parameters to guide skill-based orchestration. Transfer the question to another agent.\nThis tool hands off control to another agent when it's more suitable to answer the user's question according to the agent's description.","name":"transfer_to_agent","parameters":{"properties":{"agent_name":{"description":"the agent name to transfer to","type":"string"},"rationale":{"description":"The reasoning behind selecting this agent and skill.","type":"STRING"},"skill_id":{"description":"The specific skill to be utilized by the agent.","type":"STRING"}},"required":["agent_name"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Thu, 05 Feb 2026 13:48:00 GMT +Date: Fri, 20 Feb 2026 12:51:33 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=839 +Server-Timing: gfet4t7; dur=1488 Vary: Origin Vary: X-Origin Vary: Referer @@ -27,12 +28,12 @@ X-Xss-Protection: 0 "functionCall": { "name": "transfer_to_agent", "args": { + "skill_id": "add", "agent_name": "calculator", - "rationale": "The user is asking to add two numbers, and the calculator agent has an add skill.", - "skill_id": "add" + "rationale": "The user is asking to add two numbers, and the calculator agent has an add skill to perform this operation." } }, - "thoughtSignature": "CuMCAb4+9vu8IPgsfrcbwycFpBsa+RpONEo/uaabWHy+1If7w9YUgZwEXPf5Nfghx8W4xmY5ZfwJX5mnGUTwoQ/RU65t1PwVaUaQQOvwFAaFjRH3rYL0uujMvE4eLr8gpJVQD0vGlN2Ry3Y53Shmi5/dbTVh7K1ursnMeNETp7IXGui8lz1MRGpliPEPc8h/4F6jVITzRN/mjt2NtDa5ctM8tTptOw7jqGGHl3DLWQT5m4lxtMUQfNk1qZSgHA0dPtBiwCk49ZG3VmiTfT4KkqT9NlhwaRk5sqvN/cjfqpiiU/ZDLTSV2RonqWo5Ukw2Uv/WRsZMSLTtS8skLLcERJX+PGXjYazU46hgS7Y/3DE7F9jfQbWQqyuafOCjymIPBSAXlL4qLtQpF0FteMFG1eBNAqUlR1uYc8zU4hHCAxp0Des/dD0o6lNFM6oG6Sx7MP682yG4/1PcG/Qm9iN218N0rvQvWw==" + "thoughtSignature": "CpcDAb4+9vvUbRRMF8bpdeOnQohIbjk0+cRhgwLusB1j/2UsBQT6EQo9xk3c80EUKw3NF6pYPtdQR7bwrAaqJ2eOV3AG6wCkRQIpSR2cQkod/oydmM/+SR2v+p0ESj2DZ3B3Y30H1yRoArelXtoeqQTijrvdzxc/HEWjWp8pUHseuChvbXj5rDC334yLXUtWP3e0nUd/N+F5X02n6OTDiwNSEkNoLR5jMvWkZPOUmZSoCNKl7lx2LRcEGyXn1uyyDMXPZsw0xdB4trnbSe1Z1leCE2PcwM+lmdwRVKOfNG4dqnGu31oS1LLScMG4/RYxlRir1NyoxonSpwTHI1TKYDSJvwX8zfCaBI6RXH46gCfSHjJkSsCvEdAnHp1sEEaJEstJ6XDHBDy0831cbYM8EJIsM2JSmgtmxFcNZlskkVXiQg8g+hta/Kkpv04dWPC8Na8QMtWNbJv9HxjgaxqV6M87nuqNuqbvZ2OZaqqyRZ7d5FLxGxNcaXhR686NFDHwW6jo1tOWhim8vWYsOCiel57lMis/1/UAUyo=" } ], "role": "model" @@ -43,32 +44,33 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 284, - "candidatesTokenCount": 47, - "totalTokenCount": 403, + "promptTokenCount": 307, + "candidatesTokenCount": 51, + "totalTokenCount": 442, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 284 + "tokenCount": 307 } ], - "thoughtsTokenCount": 72 + "thoughtsTokenCount": 84 }, "modelVersion": "gemini-2.5-flash", - "responseId": "kJ-EafrSMoP3kdUP67LRgQ0" + "responseId": "01iYaZfoL77A0-kP3Pyv2Q0" } -2124 1412 +2285 1415 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 1891 +Content-Length: 2052 Content-Type: application/json -{"contents":[{"parts":[{"text":"Can you add 2 and 2?"}],"role":"user"},{"parts":[{"text":"For context:"},{"text":"[transfer_agent] called tool \"transfer_to_agent\" with parameters: {\"agent_name\":\"calculator\"}"}],"role":"user"},{"parts":[{"text":"For context:"},{"text":"[transfer_agent] \"transfer_to_agent\" tool returned result: {}"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a calculator agent. You can calculate numbers."},{"text":"You have a list of other agents to transfer to:\n\nAgent name: transfer_agent\nAgent description: transfer agent\n\nIf you are the best to answer the question according to your description, you\ncan answer it.\nIf another agent is better for answering the question according to its\ndescription, call 'transfer_to_agent' function to transfer the\nquestion to that agent. When transfering, do not generate any text other than\nthe function call.\n\nYour parent agent is transfer_agent. If neither the other agents nor\nyou are best for answering the question according to the descriptions, transfer\nto your parent agent. If you don't have parent agent, try answer by yourself.\n\n"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"This tool can now optionally accept skill_id and rationale parameters to guide skill-based orchestration. Transfer the question to another agent.\nThis tool hands off control to another agent when it's more suitable to answer the user's question according to the agent's description.","name":"transfer_to_agent","parameters":{"properties":{"agent_name":{"description":"the agent name to transfer to","type":"string"},"rationale":{"description":"The reasoning behind selecting this agent and skill.","type":"STRING"},"skill_id":{"description":"The specific skill to be utilized by the agent.","type":"STRING"}},"required":["agent_name"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"Can you add 2 and 2?"}],"role":"user"},{"parts":[{"text":"For context:"},{"text":"[transfer_agent] called tool \"transfer_to_agent\" with parameters: {\"agent_name\":\"calculator\"}"}],"role":"user"},{"parts":[{"text":"For context:"},{"text":"[transfer_agent] \"transfer_to_agent\" tool returned result: {}"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"You are a calculator agent. You can calculate numbers."},{"text":"You are an agent. Your internal name is \"calculator\". The description about you is \"calculator agent\\n Skills: add, subtract, multiply, divide\"."},{"text":"You have a list of other agents to transfer to:\n\nAgent name: transfer_agent\nAgent description: transfer agent\n\nIf you are the best to answer the question according to your description, you\ncan answer it.\nIf another agent is better for answering the question according to its\ndescription, call 'transfer_to_agent' function to transfer the\nquestion to that agent. When transfering, do not generate any text other than\nthe function call.\n\nYour parent agent is transfer_agent. If neither the other agents nor\nyou are best for answering the question according to the descriptions, transfer\nto your parent agent. If you don't have parent agent, try answer by yourself.\n\n"}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"This tool can now optionally accept skill_id and rationale parameters to guide skill-based orchestration. Transfer the question to another agent.\nThis tool hands off control to another agent when it's more suitable to answer the user's question according to the agent's description.","name":"transfer_to_agent","parameters":{"properties":{"agent_name":{"description":"the agent name to transfer to","type":"string"},"rationale":{"description":"The reasoning behind selecting this agent and skill.","type":"STRING"},"skill_id":{"description":"The specific skill to be utilized by the agent.","type":"STRING"}},"required":["agent_name"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Thu, 05 Feb 2026 13:48:01 GMT +Date: Fri, 20 Feb 2026 12:51:34 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=629 +Server-Timing: gfet4t7; dur=1174 Vary: Origin Vary: X-Origin Vary: Referer @@ -82,8 +84,8 @@ X-Xss-Protection: 0 "content": { "parts": [ { - "text": "4", - "thoughtSignature": "CooDAb4+9vtrmTnomgEWRQXy2B5xiSC+CgfTDCCV4vMKlkP6RpOwY3RCcwR8Jlo1JoyI2J3ziZ3avZUUmDq3HcOJVXTo1Hq82CznKniB2lbCSUHmk42pBiX/NfUWC5L05RgZ4egXZ1m993CPD0oUBC0IXABWJzema0an/cDeGuPoz9dYGGs9ReeLFF+pRGqB7hfgnpQhq1TMjwUnatDV2UYVhnxiIVWQ/6JtwSlRG6GDPrNeRvHQT4sZ8lGL4Vw/gglInnuNKV6K1ExX1OztZhM00kAvzCcQ5/eATEKHnPtHT1Mi4AsaAxGTv9EstAVGJCW9r/hVEjoYU/hey9RsS6N2QbMUG42aPu4jyiO1FvvnYN3Sg0GLs6JDGg0GUnGKZg/uw8Nh4aqaB1zJbxJD+DwqeyhrYlA2UsNk6GvgV9sQxzIGzqy+mobgu88EEsp/ESnPYcYgBq9JVTxCldsMR6ONjY2i0jmFK9KmwpaTgtZH0mUzvPVamZ04Bm1E6LCsM205Yr5/DKM8O7ZUaA==" + "text": "2 + 2 = 4", + "thoughtSignature": "CtsCAb4+9vvcjc239ncEbGfSBdZtUQD1CxjY79vrkchgBCKQRBiyWybbFGM9vzbKbItRQemDPnQ0RxD5lUL9sqLVvdMsJ4QMgXqsvoPtiB4D5MhoFJQAjrI4f7R5nhavOFTK+5GSCjSkAtAVdDqWKICKPIVL0otQ0P2XaV1BtLGuNjtPI64rn7iPM7Jow0FBAvrqSUkDHSM6qTc8AKbAymB2+4lBg8Xs1jdcP5VvOV89P+qdViho8W2KNMn9zoO5MH19onY4Ca8VE3rBZGIHhbdohgQybLhE2Ek3f3DW7kYwl1jkYjxwzk0HXocJcw8cuzy9oBYDNfB8r0DQ8qsuGyZ66VLtXiYuozegqGEbTICOTrN3Ud8yDofTeIyRnWZR4wTjwlZ91WCaiXmhgD0OmQ0MocK06orOnthr8rTNXXmg+/C847xRxy/9lJFrGzelkPgI2Fls1amYfDxABMk=" } ], "role": "model" @@ -93,17 +95,17 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 369, - "candidatesTokenCount": 1, - "totalTokenCount": 439, + "promptTokenCount": 401, + "candidatesTokenCount": 7, + "totalTokenCount": 479, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 369 + "tokenCount": 401 } ], - "thoughtsTokenCount": 69 + "thoughtsTokenCount": 71 }, "modelVersion": "gemini-2.5-flash", - "responseId": "kZ-EafG7HNeqkdUP0K-uKQ" + "responseId": "1ViYadLQEpDo2roP-vaZ2Ao" } diff --git a/tool/functiontool/function_test.go b/tool/functiontool/function_test.go index 1758eb987..570b726ab 100644 --- a/tool/functiontool/function_test.go +++ b/tool/functiontool/function_test.go @@ -69,12 +69,12 @@ func createToolContext(t *testing.T) tool.Context { return toolinternal.NewToolContext(invCtx, "", &session.EventActions{}, nil) } -//go:generate go test -httprecord=.* +//go:generate go test -v -httprecord=.* func TestFunctionTool_Simple(t *testing.T) { ctx := t.Context() // TODO: this model creation code was copied from model/genai_test.go. Refactor so both tests can share. - modelName := "gemini-2.0-flash" + modelName := "gemini-2.5-flash" replayTrace := filepath.Join("testdata", t.Name()+".httprr") cfg := testutil.NewGeminiTestClientConfig(t, replayTrace) m, err := gemini.NewModel(ctx, modelName, cfg) diff --git a/tool/functiontool/testdata/TestFunctionTool_Simple.httprr b/tool/functiontool/testdata/TestFunctionTool_Simple.httprr index 26bf62209..7372af32b 100644 --- a/tool/functiontool/testdata/TestFunctionTool_Simple.httprr +++ b/tool/functiontool/testdata/TestFunctionTool_Simple.httprr @@ -1,6 +1,6 @@ httprr trace v1 -800 1141 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +800 1845 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 Content-Length: 568 @@ -9,9 +9,9 @@ Content-Type: application/json {"contents":[{"parts":[{"text":"Report the current weather of the capital city of U.K."}],"role":"user"}],"generationConfig":{},"tools":[{"functionDeclarations":[{"description":"Retrieves the current weather report for a specified city.","name":"get_weather_report","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"report":{"type":"string"},"status":{"type":"string"}},"required":["report","status"],"type":"object"}}]}]}HTTP/2.0 200 OK Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 05 Sep 2025 15:40:35 GMT +Date: Fri, 20 Feb 2026 12:55:06 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=606 +Server-Timing: gfet4t7; dur=1723 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,37 +30,34 @@ X-Xss-Protection: 0 "args": { "city": "London" } - } + }, + "thoughtSignature": "CpAEAb4+9vsutluzr9rWOQfH9dS0XV653cFDpSb/TRzRVzLknyGU1eF725i0tt9tq4t6LkEatm9ZtMbBhY0pm/IAYSwCmqDf5AnI2wsTqpgpFXuU/3EEFWGp+4wWaBqcjEZeRmPW7I4lNZEQ9Y80p8/7OIeJ7FVr14WQnqmb8wJK8H8WPo2idly7T9+J5Ybqh+fdJDAm4iIFSPvhGYnkUjmYyVzzNFLTTMgEVY+PuFQvAog1xvl/+YWl89bwJbYbaP637rbraYQSiEDhlJ/+Ki0uKyOeKt56PaIA+89bDteD1D4AK9exmtW7wjg06lPkw3g5dT5JtIl+lstayFemzZxTd3+0rW2F0FGDH4vQ1Fe6M/qNAUpdtU9rM9VR//ROw1dLT8yVDHQVKF6eDLKJBzPTmS6yYpUUurV8Vjz7wf8OY1UsNxRCeKTYUJKq9mEGkvUoOxqT+WA5EWtUiVvGv6dVVU2xtxs43p/paEMx2vWK8jAG3ol8Z++4eml7QmAFvSkv5S/kD/RWali/Spu+UfZsMJLUP/0sQP8JCxzmjBuD4GUG1v0yiXNb5I2bVOp0NOOcpNd2Y1TMfAdf7o3HjNdn1GyVffiWJ7xdct0gE0Y7XtWwU9vsevdvlsvTTshG9zOW6R9uvp51Q24HeRhrrTq/bQCO7wjC3PkUtXQNKM+OYsWjOSMjfKH3S9Ddhb9Cdppz" } ], "role": "model" }, "finishReason": "STOP", - "avgLogprobs": -0.0025846857045378003 + "index": 0, + "finishMessage": "Model generated function call(s)." } ], "usageMetadata": { - "promptTokenCount": 29, - "candidatesTokenCount": 7, - "totalTokenCount": 36, + "promptTokenCount": 113, + "candidatesTokenCount": 17, + "totalTokenCount": 265, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 29 + "tokenCount": 113 } ], - "candidatesTokensDetails": [ - { - "modality": "TEXT", - "tokenCount": 7 - } - ] + "thoughtsTokenCount": 135 }, - "modelVersion": "gemini-2.0-flash", - "responseId": "cwS7aOClBfqY1MkPqtmw0QI" + "modelVersion": "gemini-2.5-flash", + "responseId": "qFmYaY79GbLZ2roPsKvdOQ" } -778 1140 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +778 1708 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 Content-Length: 546 @@ -69,9 +66,9 @@ Content-Type: application/json {"contents":[{"parts":[{"text":"How is the weather of Paris now?"}],"role":"user"}],"generationConfig":{},"tools":[{"functionDeclarations":[{"description":"Retrieves the current weather report for a specified city.","name":"get_weather_report","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"report":{"type":"string"},"status":{"type":"string"}},"required":["report","status"],"type":"object"}}]}]}HTTP/2.0 200 OK Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 05 Sep 2025 15:40:36 GMT +Date: Fri, 20 Feb 2026 12:55:07 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=559 +Server-Timing: gfet4t7; dur=1339 Vary: Origin Vary: X-Origin Vary: Referer @@ -90,37 +87,34 @@ X-Xss-Protection: 0 "args": { "city": "Paris" } - } + }, + "thoughtSignature": "CqoDAb4+9vuYMHffdQJYJ6ErebPblkYklb38rf+UMkmKXgFs3mcKDEdvtupR5PEFt5aUhNftTB0sDsBCLCNPB+V+bReLxEuCk7wEUbya/mosSi9cj92Ql1Lpg2PNYDqyElSg/YYGa0SX7b+y4IF6s/H/PhNxS2Z7CfS/iaaau9MJkRcMH+RQeMdu+GGRJ9hT9wgPMUMuJlMPYNL7vVrW8RzCdoHUb73QxHk/NnxpbScpRg7Bi7blNPjOXh07xHzJvcUWfIRXWVvGNdUSHbQGzhGtZYBcWXWIm6HnkHlgpdyi13rDBrd36j5TIcrNe7zKC3I/uuTF0y8M0TwC6API4sTYJThXKqBXNeHra20W6gi2lzyW8fAtA9353e97hdtPJheV9X97zF3BsWKpj8uSKmc8o8EzXfu/TiJWIhw5yJBwpfv6FDscBn16CbeO8q0lPdSf+aQ2DBo9908PUHDCEheuRFClL6KyKmp53O43fyfWKotgqB0CD2t65zkdxWtiL8p9R1mmjNAGMNdtVxm89RvOrNU00QD8rdhRL2FeYFiHFVb2svTAdleNI+Ko" } ], "role": "model" }, "finishReason": "STOP", - "avgLogprobs": 3.2837269827723503e-06 + "index": 0, + "finishMessage": "Model generated function call(s)." } ], "usageMetadata": { - "promptTokenCount": 24, - "candidatesTokenCount": 7, - "totalTokenCount": 31, + "promptTokenCount": 108, + "candidatesTokenCount": 17, + "totalTokenCount": 218, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 24 + "tokenCount": 108 } ], - "candidatesTokensDetails": [ - { - "modality": "TEXT", - "tokenCount": 7 - } - ] + "thoughtsTokenCount": 93 }, - "modelVersion": "gemini-2.0-flash", - "responseId": "cwS7aPn6Jpak1MkP6NnioQI" + "modelVersion": "gemini-2.5-flash", + "responseId": "qlmYaZ3RDoa20-kPlJHKuQo" } -791 1143 -POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent HTTP/1.1 +791 1587 +POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 Content-Length: 559 @@ -129,9 +123,9 @@ Content-Type: application/json {"contents":[{"parts":[{"text":"Tell me about the current weather in New York"}],"role":"user"}],"generationConfig":{},"tools":[{"functionDeclarations":[{"description":"Retrieves the current weather report for a specified city.","name":"get_weather_report","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"report":{"type":"string"},"status":{"type":"string"}},"required":["report","status"],"type":"object"}}]}]}HTTP/2.0 200 OK Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 05 Sep 2025 15:40:36 GMT +Date: Fri, 20 Feb 2026 12:55:08 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=598 +Server-Timing: gfet4t7; dur=1413 Vary: Origin Vary: X-Origin Vary: Referer @@ -150,32 +144,29 @@ X-Xss-Protection: 0 "args": { "city": "New York" } - } + }, + "thoughtSignature": "CswCAb4+9vuQNOI+nK2hM31s/rM7fYTq5LKORz+pMG1NjQDg0FamFaOnnLxXjT/Ut0fA/JjHyaBHd6xKy+swUeH6YZ7Ez0timODCf2vUHV/5jCEEtkAsbKFVfrtO1Jw43dmOgy+nJ1DnDVzWfPe4Wy7HYfyDCXqIjrtbWTo5yG6nmT15xx0YChT0SpForS5liyLbjMbIVP1WhVknZLoRBeQoXWBFeb8Trb6vYi5TYLU5G4rzWKn2Ogu0GDcg62000nWPC8Ifk6A8fjqbCjr49esecCny+gkfET1bagIQG21kpoQijUM869r0rx5BDokkXeXfYfG+dMpAmO2YnyW2s7ldzF6bppzg+Ka7hGhdfL+7xJ24y4JrKwnCmnDnq+SUjPUiG8/toObyN0l+VVpHRK7R1H81ZXox69ifcn3YEDo5Zzp7+JfsjX+8MsJBktk=" } ], "role": "model" }, "finishReason": "STOP", - "avgLogprobs": 1.9547005649656057e-06 + "index": 0, + "finishMessage": "Model generated function call(s)." } ], "usageMetadata": { - "promptTokenCount": 25, - "candidatesTokenCount": 8, - "totalTokenCount": 33, + "promptTokenCount": 109, + "candidatesTokenCount": 18, + "totalTokenCount": 202, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 25 + "tokenCount": 109 } ], - "candidatesTokensDetails": [ - { - "modality": "TEXT", - "tokenCount": 8 - } - ] + "thoughtsTokenCount": 75 }, - "modelVersion": "gemini-2.0-flash", - "responseId": "dAS7aNavC9Kd1MkPoYKfyAk" + "modelVersion": "gemini-2.5-flash", + "responseId": "q1mYadDQI96M2roPsP3UyAs" } diff --git a/tool/mcptoolset/set_test.go b/tool/mcptoolset/set_test.go index 0b4c1cffd..8d920ce65 100644 --- a/tool/mcptoolset/set_test.go +++ b/tool/mcptoolset/set_test.go @@ -59,7 +59,7 @@ func weatherFunc(ctx context.Context, req *mcp.CallToolRequest, input Input) (*m const modelName = "gemini-2.5-flash" -//go:generate go test -httprecord=.* +//go:generate go test -v -httprecord=.* func TestMCPToolSet(t *testing.T) { const ( @@ -478,7 +478,7 @@ func TestMCPToolSetConfirmation(t *testing.T) { genai.NewContentFromFunctionResponse(toolName, map[string]any{ "error": errors.New("error tool \"get_weather\" call is rejected"), }, "user"), - genai.NewContentFromText("I am sorry, I cannot get the weather in Lisbon.", "model"), + genai.NewContentFromText("I am sorry, I cannot provide the weather in Lisbon.", "model"), }, }, { @@ -508,7 +508,7 @@ func TestMCPToolSetConfirmation(t *testing.T) { genai.NewContentFromFunctionResponse(toolName, map[string]any{ "output": map[string]any{"weather_summary": string(`Today in "Lisbon" is sunny`)}, }, "user"), - genai.NewContentFromText(`Today in "Lisbon" is sunny`, "model"), + genai.NewContentFromText(`Today in "Lisbon" is sunny.`, "model"), }, }, { @@ -608,7 +608,7 @@ func TestMCPToolSetConfirmation(t *testing.T) { genai.NewContentFromFunctionResponse(toolName, map[string]any{ "error": errors.New("error tool \"get_weather\" call is rejected"), }, "user"), - genai.NewContentFromText("I am sorry, I cannot get the weather in Lisbon for you. The tool is not working at the moment.", "model"), + genai.NewContentFromText("I'm sorry, I cannot get the weather information in Lisbon.", "model"), }, }, } diff --git a/tool/mcptoolset/testdata/TestMCPToolSet.httprr b/tool/mcptoolset/testdata/TestMCPToolSet.httprr index 7a4eaabc3..413479f26 100644 --- a/tool/mcptoolset/testdata/TestMCPToolSet.httprr +++ b/tool/mcptoolset/testdata/TestMCPToolSet.httprr @@ -1,16 +1,17 @@ httprr trace v1 -925 1429 +1098 1546 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 693 +Content-Length: 866 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in london?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in london?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Thu, 23 Oct 2025 13:45:01 GMT +Date: Fri, 20 Feb 2026 12:56:14 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=1273 +Server-Timing: gfet4t7; dur=1270 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,7 +31,7 @@ X-Xss-Protection: 0 "city": "london" } }, - "thoughtSignature": "CoYCAdHtim+7tAw+8pgcT98Na65mMWz6GkAC+uDoDGZRqvZtJBrKNcSvzI+KrY4so7zf1IXya/z9eeGl7DrDFCVtQnPTtqOQoSRPcdDpmGEgoyGSkZ3veE2XkZsPks6doze1WkY5Rslq7exboTr3ekGrGNSBlb+tSWCm43DSNAjy8XrmVBet8wYz2idSH/RrruWm2kGcLZFOYMawA3Zzq/MbzwpDOUNENUuH5sk0E5pwrRjVm5rFFyN+VYk1+PkgjHklVgQgIZ98N5XIjic8U39bvFv0HT3MferfkY4+bfBUNZHE/rvaizSP4ozzKRpCXjXH9FyZkckYoTWetCNdH2qh/Qd22Cjr5A==" + "thoughtSignature": "CrMCAb4+9vuce4oTOEPks/2X+NFpXgSDyPxhQUmXmzpKAw86/84KbNZBzUTJejHE8L5ImxjVyuB8/bUx5uyMEn0/Yj3bQgWTcP40VNZ2dT6GAeI9FSw96+UR68QknSFJkz5iL46OLh60qIBNpNYQFtmmp7W9QsW9K17yMLF8Hwa/MKYAy1uyFiSdsfay0fVBSFNdfnHbbQZX5dTx2AtVn16vm1yDJvmDalv4U3c4g0CpukbXbhMrbLef7N/YPO95t9K39hczrHGVOTJAdulO6JhN4rrMj7u6wkt6IZGJWH5MwplC/7vM3q8NFR/XTSlK065zwlwLq1RMyaCEXmDkOWm0C4WS1klJiX1KQzxo+yO1J1JoOQoSi4nBp0RURFqC0hpmazBbuCkvr28QDNlU6C3aWLCR9A==" } ], "role": "model" @@ -41,32 +42,33 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 113, + "promptTokenCount": 148, "candidatesTokenCount": 15, - "totalTokenCount": 186, + "totalTokenCount": 230, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 113 + "tokenCount": 148 } ], - "thoughtsTokenCount": 58 + "thoughtsTokenCount": 67 }, "modelVersion": "gemini-2.5-flash", - "responseId": "XTH6aIb6G73WvdIPsMqa4QM" + "responseId": "7VmYacXjEYuw0-kPsdLw6Ao" } -1539 842 +1772 900 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 1306 +Content-Length: 1539 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in london?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"london"},"name":"get_weather"},"thoughtSignature":"CoYCAdHtim+7tAw+8pgcT98Na65mMWz6GkAC+uDoDGZRqvZtJBrKNcSvzI+KrY4so7zf1IXya/z9eeGl7DrDFCVtQnPTtqOQoSRPcdDpmGEgoyGSkZ3veE2XkZsPks6doze1WkY5Rslq7exboTr3ekGrGNSBlb+tSWCm43DSNAjy8XrmVBet8wYz2idSH/RrruWm2kGcLZFOYMawA3Zzq/MbzwpDOUNENUuH5sk0E5pwrRjVm5rFFyN+VYk1+PkgjHklVgQgIZ98N5XIjic8U39bvFv0HT3MferfkY4+bfBUNZHE/rvaizSP4ozzKRpCXjXH9FyZkckYoTWetCNdH2qh/Qd22Cjr5A=="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"london\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in london?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"london"},"name":"get_weather"},"thoughtSignature":"CrMCAb4+9vuce4oTOEPks/2X+NFpXgSDyPxhQUmXmzpKAw86/84KbNZBzUTJejHE8L5ImxjVyuB8/bUx5uyMEn0/Yj3bQgWTcP40VNZ2dT6GAeI9FSw96+UR68QknSFJkz5iL46OLh60qIBNpNYQFtmmp7W9QsW9K17yMLF8Hwa/MKYAy1uyFiSdsfay0fVBSFNdfnHbbQZX5dTx2AtVn16vm1yDJvmDalv4U3c4g0CpukbXbhMrbLef7N/YPO95t9K39hczrHGVOTJAdulO6JhN4rrMj7u6wkt6IZGJWH5MwplC/7vM3q8NFR/XTSlK065zwlwLq1RMyaCEXmDkOWm0C4WS1klJiX1KQzxo+yO1J1JoOQoSi4nBp0RURFqC0hpmazBbuCkvr28QDNlU6C3aWLCR9A=="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"london\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Thu, 23 Oct 2025 13:45:01 GMT +Date: Fri, 20 Feb 2026 12:56:15 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=318 +Server-Timing: gfet4t7; dur=1080 Vary: Origin Vary: X-Origin Vary: Referer @@ -90,16 +92,16 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 155, + "promptTokenCount": 190, "candidatesTokenCount": 7, - "totalTokenCount": 162, + "totalTokenCount": 197, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 155 + "tokenCount": 190 } ] }, "modelVersion": "gemini-2.5-flash", - "responseId": "XTH6aLT7LqTIvdIPpsaE4AE" + "responseId": "7lmYafykI7n-2roPqsGG4Q0" } diff --git a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Not_Required.httprr b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Not_Required.httprr index a26d428b6..319279591 100644 --- a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Not_Required.httprr +++ b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Not_Required.httprr @@ -1,16 +1,17 @@ httprr trace v1 -924 1435 +1097 1485 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 692 +Content-Length: 865 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Porto?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Porto?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:21 GMT +Date: Fri, 20 Feb 2026 12:56:24 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=865 +Server-Timing: gfet4t7; dur=1012 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,7 +31,7 @@ X-Xss-Protection: 0 "city": "Porto" } }, - "thoughtSignature": "CowCAXLI2nyLoxhCGquNldpcT0kOANmW7oh3i4/yAujVF9ulf+KtYLxRqzlWfk6sDxj/N5GgUL2xCjZ7k5kkljgVEY21UR+zEJDkjLqoY68B4sZsC/IS75IDdiP2mWu5ZeBZhOqky/ty+wlWxAW74URfzrbmAuz8l4ggKAZn4JBv+I++2DFizATurldaYGSHb4dGrp9ytg2ewOyT8TN/kOjChhGS7XVRiTqPtpNGXzweZ8FZxO2PlmA2C2DFFyl9e+XQZi9xUQ4+MSXKjvuwx+SkTk0XKaejHdQPdQEiJQOY2T1/RqaI3T4VdCRjMI2M18OCUFyVN2sCqTSZsurixZRj4gKkyzeEpSpnhN/bHw==" + "thoughtSignature": "CocCAb4+9vsFK1KCRbA4p26n2/1Rn7JQY3U1Dn3VgamP4OJQrKwkfof0T6HOjl8Q2Lu3Fn4OKZsPnvr23VaKjS0VggKqnC3n/Wchu0fIhzxJLnpeFYHOuH4Mo7a116O2FSTW2gozhgPs6reSb6TqQiyv9Gft9HvEorgqeTgbx/4yVVIRPWgEPmMstlWlX/VsCneQvk43DKe03wHpfKBuVfIO2w/a+l4jU1W3MLf/nagM9nOGol5WmM7+xi/1daH/IpyKjeDk5bQv5N5Ez3DbV86eensH2gmUSJqAI3/Zg3y5qKJxj9rhBdBtfEwtOlwyczz7XPKAsazg0rWE1IWZr1a9rvIu/KwTKRY=" } ], "role": "model" @@ -41,32 +42,33 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 113, + "promptTokenCount": 148, "candidatesTokenCount": 16, - "totalTokenCount": 191, + "totalTokenCount": 223, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 113 + "tokenCount": 148 } ], - "thoughtsTokenCount": 62 + "thoughtsTokenCount": 59 }, "modelVersion": "gemini-2.5-flash", - "responseId": "ra58aYaTKOWWxN8PgI_1sQE" + "responseId": "91mYaYqILPKh0-kP-MrI8Qo" } -1544 842 +1709 898 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 1311 +Content-Length: 1476 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Porto?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Porto"},"name":"get_weather"},"thoughtSignature":"CowCAXLI2nyLoxhCGquNldpcT0kOANmW7oh3i4/yAujVF9ulf+KtYLxRqzlWfk6sDxj/N5GgUL2xCjZ7k5kkljgVEY21UR+zEJDkjLqoY68B4sZsC/IS75IDdiP2mWu5ZeBZhOqky/ty+wlWxAW74URfzrbmAuz8l4ggKAZn4JBv+I++2DFizATurldaYGSHb4dGrp9ytg2ewOyT8TN/kOjChhGS7XVRiTqPtpNGXzweZ8FZxO2PlmA2C2DFFyl9e+XQZi9xUQ4+MSXKjvuwx+SkTk0XKaejHdQPdQEiJQOY2T1/RqaI3T4VdCRjMI2M18OCUFyVN2sCqTSZsurixZRj4gKkyzeEpSpnhN/bHw=="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"Porto\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Porto?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Porto"},"name":"get_weather"},"thoughtSignature":"CocCAb4+9vsFK1KCRbA4p26n2/1Rn7JQY3U1Dn3VgamP4OJQrKwkfof0T6HOjl8Q2Lu3Fn4OKZsPnvr23VaKjS0VggKqnC3n/Wchu0fIhzxJLnpeFYHOuH4Mo7a116O2FSTW2gozhgPs6reSb6TqQiyv9Gft9HvEorgqeTgbx/4yVVIRPWgEPmMstlWlX/VsCneQvk43DKe03wHpfKBuVfIO2w/a+l4jU1W3MLf/nagM9nOGol5WmM7+xi/1daH/IpyKjeDk5bQv5N5Ez3DbV86eensH2gmUSJqAI3/Zg3y5qKJxj9rhBdBtfEwtOlwyczz7XPKAsazg0rWE1IWZr1a9rvIu/KwTKRY="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"Porto\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:23 GMT +Date: Fri, 20 Feb 2026 12:56:25 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=1798 +Server-Timing: gfet4t7; dur=647 Vary: Origin Vary: X-Origin Vary: Referer @@ -90,16 +92,16 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 157, + "promptTokenCount": 192, "candidatesTokenCount": 8, - "totalTokenCount": 165, + "totalTokenCount": 200, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 157 + "tokenCount": 192 } ] }, "modelVersion": "gemini-2.5-flash", - "responseId": "r658aeTKGvbYvdIPz4TXkQQ" + "responseId": "-FmYaZTKLL-o2roP0dvT8QE" } diff --git a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Not_Required_For_This_Tool.httprr b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Not_Required_For_This_Tool.httprr index 608390a7f..f68aa4020 100644 --- a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Not_Required_For_This_Tool.httprr +++ b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Not_Required_For_This_Tool.httprr @@ -1,16 +1,17 @@ httprr trace v1 -925 1504 +1098 1578 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 693 +Content-Length: 866 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Mon, 02 Feb 2026 10:57:39 GMT +Date: Fri, 20 Feb 2026 12:56:26 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=751 +Server-Timing: gfet4t7; dur=1250 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,7 +31,7 @@ X-Xss-Protection: 0 "city": "Lisbon" } }, - "thoughtSignature": "Cr8CAXLI2nxFPhwLfOJmwCEHKirKcQRlWdJyDV7ZPbq2pp4sY2AOX1ZWWZPp2fhpy9pJEDR+6YnmDWF4LQM9AWRrIMfElU3l37mxg+iJfmGvHudfFiNe2ukKCv3yIDlhlysCKEaI9OOe4Ebjww8PYKd0pa3QD/zHATD1dNSL/9GZ3E98CP8yhEM4LA0M6+cqxlkr3lItz3VtxZRhTuV8OMsBUTJc//K/zIHW20YFyb43A47sMMgrpiNm16nymKZfR7rKizs1PqS0WEj7Zqbg3tgRH/WuhMPVa2lgjKULzAFiTO4ZIAmR7R9YrbCcrZ/OLjRALrzGddiJ1EcAs9fSwmVolUwP3mYLIKiVKG3UwjOXwTUbc0+FzPAQs+ezC81RlaYbRCSIipcxo7W7lFyArKqiVAH0U6+j4gfWxBZSZTlzMg==" + "thoughtSignature": "CswCAb4+9vtZPqj9RhnmJggCQnod2feT5d6hYmqb/bClUq9U/naifAs7nYJ4Q9uPRIiXDPlAQnuPy8lOUuBycLhB5WG05DRWDtMiAmC7pmsG2BCWeV7FdUYmfCPMko18N0YjJL2rLXFATWmcMmBCqSZp+lYypvRIFHIZegaFAEqGNC0tX9mMuO3QUc0GRLGJkjlnC/4DV+a0lFI9xw0kbJO2OiIsLiQn5UZ5tlAXraPQ9Y4W4tSUTuy8f8Asz3auve2Mpo2k7qwZmhDltfphSN1i2fB2VwUCK6H2cfWjnhqhmDBa45TBcTg6P+ASc0YGwh5Un4AhHCd1X8SUx5DuyjN4o/jAC3HPST4PKEPsZffd16yWJTvARc5A5Ao3b+URRbh5HOjGMhXu6S5oL0PQfsOlqLUZhUu3YUY7xLQXvCULzaJ6zwmzROYTndBrDY4=" } ], "role": "model" @@ -41,32 +42,33 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 113, + "promptTokenCount": 148, "candidatesTokenCount": 16, - "totalTokenCount": 202, + "totalTokenCount": 240, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 113 + "tokenCount": 148 } ], - "thoughtsTokenCount": 73 + "thoughtsTokenCount": 76 }, "modelVersion": "gemini-2.5-flash", - "responseId": "I4OAaardJPfnnsEPw5DjoQ8" + "responseId": "-VmYaZ6jF4H_2roPx7u1qA4" } -1615 842 +1804 901 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 1382 +Content-Length: 1571 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"Cr8CAXLI2nxFPhwLfOJmwCEHKirKcQRlWdJyDV7ZPbq2pp4sY2AOX1ZWWZPp2fhpy9pJEDR+6YnmDWF4LQM9AWRrIMfElU3l37mxg+iJfmGvHudfFiNe2ukKCv3yIDlhlysCKEaI9OOe4Ebjww8PYKd0pa3QD/zHATD1dNSL/9GZ3E98CP8yhEM4LA0M6+cqxlkr3lItz3VtxZRhTuV8OMsBUTJc//K/zIHW20YFyb43A47sMMgrpiNm16nymKZfR7rKizs1PqS0WEj7Zqbg3tgRH/WuhMPVa2lgjKULzAFiTO4ZIAmR7R9YrbCcrZ/OLjRALrzGddiJ1EcAs9fSwmVolUwP3mYLIKiVKG3UwjOXwTUbc0+FzPAQs+ezC81RlaYbRCSIipcxo7W7lFyArKqiVAH0U6+j4gfWxBZSZTlzMg=="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"Lisbon\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"CswCAb4+9vtZPqj9RhnmJggCQnod2feT5d6hYmqb/bClUq9U/naifAs7nYJ4Q9uPRIiXDPlAQnuPy8lOUuBycLhB5WG05DRWDtMiAmC7pmsG2BCWeV7FdUYmfCPMko18N0YjJL2rLXFATWmcMmBCqSZp+lYypvRIFHIZegaFAEqGNC0tX9mMuO3QUc0GRLGJkjlnC/4DV+a0lFI9xw0kbJO2OiIsLiQn5UZ5tlAXraPQ9Y4W4tSUTuy8f8Asz3auve2Mpo2k7qwZmhDltfphSN1i2fB2VwUCK6H2cfWjnhqhmDBa45TBcTg6P+ASc0YGwh5Un4AhHCd1X8SUx5DuyjN4o/jAC3HPST4PKEPsZffd16yWJTvARc5A5Ao3b+URRbh5HOjGMhXu6S5oL0PQfsOlqLUZhUu3YUY7xLQXvCULzaJ6zwmzROYTndBrDY4="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"Lisbon\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Mon, 02 Feb 2026 10:57:39 GMT +Date: Fri, 20 Feb 2026 12:56:27 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=323 +Server-Timing: gfet4t7; dur=1115 Vary: Origin Vary: X-Origin Vary: Referer @@ -80,7 +82,7 @@ X-Xss-Protection: 0 "content": { "parts": [ { - "text": "Today in \"Lisbon\" is sunny" + "text": "Today in \"Lisbon\" is sunny." } ], "role": "model" @@ -90,16 +92,16 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 157, - "candidatesTokenCount": 8, - "totalTokenCount": 165, + "promptTokenCount": 192, + "candidatesTokenCount": 9, + "totalTokenCount": 201, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 157 + "tokenCount": 192 } ] }, "modelVersion": "gemini-2.5-flash", - "responseId": "I4OAafboN_jrkdUP3Zi60QY" + "responseId": "-lmYadDqK4-t2roP3Zb_kAE" } diff --git a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required.httprr b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required.httprr index b0f3c4830..b351185ad 100644 --- a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required.httprr +++ b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required.httprr @@ -1,16 +1,17 @@ httprr trace v1 -925 1436 +1098 1534 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 693 +Content-Length: 866 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:24 GMT +Date: Fri, 20 Feb 2026 12:56:30 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=614 +Server-Timing: gfet4t7; dur=1150 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,7 +31,7 @@ X-Xss-Protection: 0 "city": "Lisbon" } }, - "thoughtSignature": "Co0CAXLI2nydhQg0+Sj21WV3+ZOzEauaMFfD5HDt8jFDIUbUY+MypvNGkvF7ZujSc4BYzYnoZ7b1Dk5mBkKC2+do0Lp078APnaFIGvgRlYXi1bzC1fioNRNqUHWY/C7litJzDw5SWIfkLSsaannzWA/y0dWoSxYTVe7x6kcJvz5F76KhhGSCBdxfryuIYYoVV5h5jHcv9l+7EvtrhOVswC2NfKZmgV3sgVOUZmJLSj/a0LHkA1zmGXDW8J4eMKwXQSBixsH1XKhi1mhUkWPuzDewu4lBxDeiZPb/KfS8K05OAJVFYquXx31/OzKdZeBZ91PDptIEg1zKBHaQ9TEaPcyLs+wYKTgL4ITwnfwvac8=" + "thoughtSignature": "CqsCAb4+9vtBoie/TSoZ5MSfbBgIHOhKqidRLqXU+qV3p7q45XjmWWTNdX0liTKGWtSsK5qmq22tbHaEwLKA+U8cc6tjDbyEq0ClBpiZS/Qh4L2A7afxCJfFPld8Y+2Utya6njN5y4HtTyO9hmiMHPqq8t9/2VPc9xdCfL3eAOURnp5rtQsf9/NbYCgO/7T1ncMnVuhH5B/c2E9aCPZFAsiL6dFP9cZUfgbL0fsfptMKIT5hXBDP19ZxcRqTtMpiLByRJyT9+xXZPwMvY0+fR01Z0hHFbRzHQ1Kd3DtMWRa9Oc/PzeiydWsfYi6yjymz4c97mxFcDumE6kjvxR54oTfpiV6Lj8QOU4w+cei035r3FehRmCmbKOH9y7ZUAa+lqBPzyMilxWQ/qDsqK/c=" } ], "role": "model" @@ -41,17 +42,17 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 113, + "promptTokenCount": 148, "candidatesTokenCount": 16, - "totalTokenCount": 189, + "totalTokenCount": 233, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 113 + "tokenCount": 148 } ], - "thoughtsTokenCount": 60 + "thoughtsTokenCount": 69 }, "modelVersion": "gemini-2.5-flash", - "responseId": "sK58abWOBIzXvdIPopangQg" + "responseId": "_VmYaZWbEaW90-kPns_-2Ao" } diff --git a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_For_This_Tool.httprr b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_For_This_Tool.httprr index a380b83e9..d88cb8922 100644 --- a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_For_This_Tool.httprr +++ b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_For_This_Tool.httprr @@ -1,16 +1,17 @@ httprr trace v1 -925 1448 +1098 1534 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 693 +Content-Length: 866 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Mon, 02 Feb 2026 10:57:40 GMT +Date: Fri, 20 Feb 2026 12:56:29 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=701 +Server-Timing: gfet4t7; dur=1268 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,7 +31,7 @@ X-Xss-Protection: 0 "city": "Lisbon" } }, - "thoughtSignature": "CpUCAXLI2nykGxz8Yn/ramVuzZjxOMd8Odfz5CsF9FbOdrFvxgEwAR591yZmjyVvpbEromc9h0b8/aotXFJIiv1/99qtKNUc4UgkAQK1xuC88miernpJoMiqbkuzHE0Lgs/SQignI0Od9kR3MocAsN6mtGW28mrJT70tZsXOHbM6xknhk/x3ZhFxcDPjHgGSspdQ8ldgAayWjr2FYibSX71SkhmpwflEAO4SXGZq9JXx32AL5RpVTwvtT39p9Cq+tAP/3SLOfCMXESZy0NXq5r1OfU+4SqX+49YiqLko17IAiteo9MqdT8RzAX0MSOisdJ9HJ5Blm71Nj/FPi1Pdt77crJeijqBmol1vVeqPm6nVUENnpmlORA==" + "thoughtSignature": "CqsCAb4+9vvht/TlYYdkAyD7WDHhZSwAfHn6T25K6GlQjEem0aqn0ZUGP5RYaxVw5lQNwspYuZiR2JIpe33Qbm/7erh9KDNwf1k6Zl7O2QyfaehG9h2jJL45LPsvUbxPrUZeMqrtl1g319t3N3pHJnd0MmXV8+8r6qgZG0HacgbaseQQqpkuVaJqpqxA7gROYvBswYHq6NtUWbsES7pggSNwNr1XIvyceUutvwGDDdvx+X+kKYqxyxrWbljARKS/jt/Xm4NGCpm+z6XL21/W2trXpaJFao/UB/m35T+4xOBJ1FSkwlaet3zhN1fr8rlxStoMo1PjujWQJN0Xh+jRRsd/NETjroKzye/IeuFN101hXdUkAdylSBPfznA7ft5h2kkaLxhaDzJTAUng7ZE=" } ], "role": "model" @@ -41,17 +42,17 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 113, + "promptTokenCount": 148, "candidatesTokenCount": 16, - "totalTokenCount": 191, + "totalTokenCount": 233, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 113 + "tokenCount": 148 } ], - "thoughtsTokenCount": 62 + "thoughtsTokenCount": 69 }, "modelVersion": "gemini-2.5-flash", - "responseId": "JIOAaeXyJcKknsEPzdaT6A8" + "responseId": "-1mYacuVPObJ0-kPo67s-Qs" } diff --git a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_and_is_confirmed.httprr b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_and_is_confirmed.httprr index da9f9ccec..2a5df06d7 100644 --- a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_and_is_confirmed.httprr +++ b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_and_is_confirmed.httprr @@ -1,16 +1,17 @@ httprr trace v1 -925 1436 +1098 1442 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 693 +Content-Length: 866 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:24 GMT +Date: Fri, 20 Feb 2026 12:56:31 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=609 +Server-Timing: gfet4t7; dur=1081 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,7 +31,7 @@ X-Xss-Protection: 0 "city": "Lisbon" } }, - "thoughtSignature": "Co0CAXLI2nwNpz14KARCRwxrprYL438vUGi5noXwpsoyKBwKy/QBGPGeX3Ffxz3mfz2pRr9kal9zazfOLM/KKmBmtMCZe9DzT3MQogWEaqBh/Dqk13mCgGzkYyYyRxuByCgHGDDrVhdncGIZnXvPPdw6kj5QluQckzbQ9bs4Zg8sZ48FBJLSGr4Mv+0orpRz9au9lFMHP2jWqnxBdtPxn0dFrBUeEYN6nrqjCIGHyF218d2byOHj0iKPe0HvudqFjsKNPpxQFFWOkVSfeexXUZBqzDsfa9nr4Ld66j9IEYVYU+Hs9NrQ3Xxg1bq+ssaOY6L5X8Ni+Ek59PmWcXMCsm6NqZmEq5xoLrkE+zeSQvc=" + "thoughtSignature": "CuUBAb4+9vsSF8z3gvcvCDqtz2L3wNY4x3Fqt8WN/4ijA7TQjkg0cuvMtEoj1Tu96RlRt/mjM8Bh8gRlkshp1Z4n31DFC12TUi4zS8AwpIcAKmGqdzM5aXMZnXwGdEZiCbpvC9kHWfHADIAHUJqvWbEMvuxXSatlriLUezT/zoB2/VEp6YtLrMYD/9J/xeIebfUtit+pj/y+F1SAI/OnqCkXnc7yASvmqvacvk+HF4c+xz/nvdwV3tkiQa6s8hRv8zVkWiSlWCbEjHlBHQnWVHNCXm0dtyTxyeGzzyFbWOJ1PXmz62MAog==" } ], "role": "model" @@ -41,32 +42,33 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 113, + "promptTokenCount": 148, "candidatesTokenCount": 16, - "totalTokenCount": 189, + "totalTokenCount": 212, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 113 + "tokenCount": 148 } ], - "thoughtsTokenCount": 60 + "thoughtsTokenCount": 48 }, "modelVersion": "gemini-2.5-flash", - "responseId": "sK58aYXUK4TVvdIPu-2TsAw" + "responseId": "_lmYad3zHcGu2roPisf1iAs" } -1547 842 +1668 899 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 1314 +Content-Length: 1435 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"Co0CAXLI2nwNpz14KARCRwxrprYL438vUGi5noXwpsoyKBwKy/QBGPGeX3Ffxz3mfz2pRr9kal9zazfOLM/KKmBmtMCZe9DzT3MQogWEaqBh/Dqk13mCgGzkYyYyRxuByCgHGDDrVhdncGIZnXvPPdw6kj5QluQckzbQ9bs4Zg8sZ48FBJLSGr4Mv+0orpRz9au9lFMHP2jWqnxBdtPxn0dFrBUeEYN6nrqjCIGHyF218d2byOHj0iKPe0HvudqFjsKNPpxQFFWOkVSfeexXUZBqzDsfa9nr4Ld66j9IEYVYU+Hs9NrQ3Xxg1bq+ssaOY6L5X8Ni+Ek59PmWcXMCsm6NqZmEq5xoLrkE+zeSQvc="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"Lisbon\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"CuUBAb4+9vsSF8z3gvcvCDqtz2L3wNY4x3Fqt8WN/4ijA7TQjkg0cuvMtEoj1Tu96RlRt/mjM8Bh8gRlkshp1Z4n31DFC12TUi4zS8AwpIcAKmGqdzM5aXMZnXwGdEZiCbpvC9kHWfHADIAHUJqvWbEMvuxXSatlriLUezT/zoB2/VEp6YtLrMYD/9J/xeIebfUtit+pj/y+F1SAI/OnqCkXnc7yASvmqvacvk+HF4c+xz/nvdwV3tkiQa6s8hRv8zVkWiSlWCbEjHlBHQnWVHNCXm0dtyTxyeGzzyFbWOJ1PXmz62MAog=="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"Lisbon\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:25 GMT +Date: Fri, 20 Feb 2026 12:56:32 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=305 +Server-Timing: gfet4t7; dur=801 Vary: Origin Vary: X-Origin Vary: Referer @@ -90,16 +92,16 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 157, + "promptTokenCount": 192, "candidatesTokenCount": 8, - "totalTokenCount": 165, + "totalTokenCount": 200, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 157 + "tokenCount": 192 } ] }, "modelVersion": "gemini-2.5-flash", - "responseId": "sa58aZCEAaCX28oP-Y2Q-AE" + "responseId": "_1mYaZP8JsDh2roP3ISwuAo" } diff --git a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_and_is_rejected.httprr b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_and_is_rejected.httprr index 13b090d55..536df29f2 100644 --- a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_and_is_rejected.httprr +++ b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_and_is_rejected.httprr @@ -1,16 +1,17 @@ httprr trace v1 -925 1480 +1098 1493 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 693 +Content-Length: 866 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:25 GMT +Date: Fri, 20 Feb 2026 12:56:33 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=667 +Server-Timing: gfet4t7; dur=922 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,7 +31,7 @@ X-Xss-Protection: 0 "city": "Lisbon" } }, - "thoughtSignature": "Cq4CAXLI2nzZZkSa7UfXLMC1LOaVkDTpYCwO3IJiH9QMsxE0zYKq4jm/nVyoqLOVO0tcobFPpLQKghkluPPUfebOjsqsBUV2V1O8LlNNHf8LxvPy3EBF0VwHW7lIOusQwGthOSy8lVLK7SfeFhsKWnWrq+NDz9+6Z45AUCntmfzYBvSslCRGW0QiF03Nmjlv+LXpDsQ9rRarVGG+ekO8SB1cgm26Q5e6u6xyvVvExASr/0TtXWXDRGVJX63+ykq+ARpXavtQydB1Jj1i802944Kryo+KWsvFrHgPxEywYYt1JJ0cEa7swE+OyV9Mz7i5mcBpqP/XqmKifvc22jgtzhFgziBJ0/nwlsmNirGkmanJ/jywfZh/GK2MVOu9xjafPWQeV6TvoaHsdRUnNRiL5TQ=" + "thoughtSignature": "Co4CAb4+9vstzkUt8dhRbp8UgJaLuV1Vz1YOp2znrRtunUBmLqLoYxmXO3hMfqtln4WrA4sjNTbB1JpSF7O3PirGX7/5fxdOM8IxFk2vkiDNilKQ5jo5BFjXVUXMCz8tdHvND2NHjLLERZibvI49OWoIrCU6/7hGQL+5zjZCy6cbKKx1brrp6OLUKPm5m225/nSs+LVMzrAHaK/kT82JgyNR4M+/EBWEHtGA07gYyI2VWRzmWbZiZUvkshm5co7j/utF9dgO6yXefyC8Tk7dSk29rAXzbmAurw/P0WhdUN5zQH2xBiDwD7c7Y4sAZTPFbDF/uIJgSzIH1rev/bLLzQiXLIwpcDy7CaHh5mgA0KDo" } ], "role": "model" @@ -41,32 +42,33 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 113, + "promptTokenCount": 148, "candidatesTokenCount": 16, - "totalTokenCount": 197, + "totalTokenCount": 226, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 113 + "tokenCount": 148 } ], - "thoughtsTokenCount": 68 + "thoughtsTokenCount": 62 }, "modelVersion": "gemini-2.5-flash", - "responseId": "sa58afLUKcWlxN8Psq-A8Ao" + "responseId": "AFqYabayHNSx0-kPkLvXwAo" } -1585 1435 +1714 1317 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 1352 +Content-Length: 1481 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"Cq4CAXLI2nzZZkSa7UfXLMC1LOaVkDTpYCwO3IJiH9QMsxE0zYKq4jm/nVyoqLOVO0tcobFPpLQKghkluPPUfebOjsqsBUV2V1O8LlNNHf8LxvPy3EBF0VwHW7lIOusQwGthOSy8lVLK7SfeFhsKWnWrq+NDz9+6Z45AUCntmfzYBvSslCRGW0QiF03Nmjlv+LXpDsQ9rRarVGG+ekO8SB1cgm26Q5e6u6xyvVvExASr/0TtXWXDRGVJX63+ykq+ARpXavtQydB1Jj1i802944Kryo+KWsvFrHgPxEywYYt1JJ0cEa7swE+OyV9Mz7i5mcBpqP/XqmKifvc22jgtzhFgziBJ0/nwlsmNirGkmanJ/jywfZh/GK2MVOu9xjafPWQeV6TvoaHsdRUnNRiL5TQ="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"error":"error tool \"get_weather\" call is rejected"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"Co4CAb4+9vstzkUt8dhRbp8UgJaLuV1Vz1YOp2znrRtunUBmLqLoYxmXO3hMfqtln4WrA4sjNTbB1JpSF7O3PirGX7/5fxdOM8IxFk2vkiDNilKQ5jo5BFjXVUXMCz8tdHvND2NHjLLERZibvI49OWoIrCU6/7hGQL+5zjZCy6cbKKx1brrp6OLUKPm5m225/nSs+LVMzrAHaK/kT82JgyNR4M+/EBWEHtGA07gYyI2VWRzmWbZiZUvkshm5co7j/utF9dgO6yXefyC8Tk7dSk29rAXzbmAurw/P0WhdUN5zQH2xBiDwD7c7Y4sAZTPFbDF/uIJgSzIH1rev/bLLzQiXLIwpcDy7CaHh5mgA0KDo"}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"error":"error tool \"get_weather\" call is rejected"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:26 GMT +Date: Fri, 20 Feb 2026 12:56:34 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=709 +Server-Timing: gfet4t7; dur=1025 Vary: Origin Vary: X-Origin Vary: Referer @@ -80,8 +82,8 @@ X-Xss-Protection: 0 "content": { "parts": [ { - "text": "I am sorry, I cannot get the weather in Lisbon for you. The tool is not working at the moment.", - "thoughtSignature": "CtQCAXLI2nyr3WoW4x3UYg8SSYULZ8b1WMJqqMZMoW4U10EpKwFo4qKNJryyPXGNqdqxm5y1jCYTzVxf0VNHNmqd+ZsSEyo3eygly5CYFDzWTSbmZB5TKmww2zJnRblRtwCCDl9HaadbfxO3vD7jg8L9r81EEcDqcLvsbGdlqrD6fkwGO3qmJaewqX5uyQzBAweYIXPd4QASTInt3Q6VDMz3uwaSOxtM/duut2EsepdUFOBV4BRD+rOBhDLlCcgf4z0Dzjx63qwfA5RKmzIH21k+n9CamcxGWttyniA6oxMCRRoZvHxRUQbPDIuAmIvgNvYdhOKPTdzwdkN44YWOysUe6/MciJjlNMBeHEGP3dsCJ70EPz//6OsmIt89TrmQkdaJh/+A+ekWtvzRIJvJHKA/KHbSA7sDkMSGdMxjNfM9Bqt1+Lrr+w+8syHmVE6Ass05pdUiZw==" + "text": "I'm sorry, I cannot get the weather information in Lisbon.", + "thoughtSignature": "Cu0BAb4+9vsb0UvVKhPCFgl+pk3ZL1pwKP2DDuy3FAvFJUJwHwo8SGoQt09MRK97eJz2aeF/SHTgFpH3KgddDJ4WSRws93+l8vFSm9uSopfCTAm5lPHmzctameaLpheajIDRiN3pEyAcuh4jNDGNp4NCpIh/8jJTnT2/8Skxgska7Vpgt6XOI0ZC6Hy7xId3bJvUwoAF1DkXHPazkCSt8Q4wDEfc7qdjp/9f0iHPeTquSOdCfh15AmpL62gGUjjkI4GdrbrTGdRHayLbgKlms3ABZPVsGUSpT4KWyIiGSVVRr/hF2X2eR3wrsXgojBS8" } ], "role": "model" @@ -91,17 +93,17 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 153, - "candidatesTokenCount": 23, - "totalTokenCount": 237, + "promptTokenCount": 188, + "candidatesTokenCount": 14, + "totalTokenCount": 243, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 153 + "tokenCount": 188 } ], - "thoughtsTokenCount": 61 + "thoughtsTokenCount": 41 }, "modelVersion": "gemini-2.5-flash", - "responseId": "sq58afTDGN7mxs0PztzBmQ4" + "responseId": "AVqYaeCkG7uw0-kP9LbBuAo" } diff --git a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required.httprr b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required.httprr index ffb1c7b62..b058675c8 100644 --- a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required.httprr +++ b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required.httprr @@ -1,16 +1,17 @@ httprr trace v1 -925 1424 +1098 1493 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 693 +Content-Length: 866 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:18 GMT +Date: Fri, 20 Feb 2026 12:56:18 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=610 +Server-Timing: gfet4t7; dur=991 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,7 +31,7 @@ X-Xss-Protection: 0 "city": "Lisbon" } }, - "thoughtSignature": "CoMCAXLI2nyLnjjZnSRJtbyYL2Zf11JqTWjrXZ4ncDgvk8IHmd+YSKjHfwoQLwXjdQ2f7hAiVeB0f0ZYYyl3sqoqlomwHTva2GlA9KoqUgXorG29jD0C0YAWJ5AwC9S4IxdqCaR9oKTfisNv2ApYqymg2WgZOx8IPP2SNZJhxi8ejiug29BEgC8hsKJM7ZOYtba7nDpgv2uAqF77sgsx5G8pnmmFLaZcJWs7KZNY/LHLveLTaAOb2xu+3EeSyTKBrtkIsdF6Iq16BMlzco4Uj7O9srRDoOASPEW9k1pTYsA5E12unP22SqqOmsoksb9AnOi6Zl01BTf6c40rfMYjubmGkXfO1w==" + "thoughtSignature": "Co4CAb4+9vvNbXI7I9hHclP5VDd8ZdWXUvH2c4Z4g8K/kBOVlCLJdWWYDiRehokvj8VwUuUtCIR04Xn2xOLl4eXxgNVxKfVxAYuQGNlg9BetuEcoFI5oYcjn25XUHbM1hthJEJyKWQl/2dkzJiR8PCy7SK8BW60OhGABC6ytU9+DSjT/NvfotDWyHE9c7aw9PG5L6ssVVHFZwauk0Tk33Vjd5iPssdQ9+6spoC0X0DLojBWsC+oQ03t2QtaNORrthcplW/t8aE6SVhyNhc6r0u24a0Y0zRtk7OhG3Yeh8rwEZL9vz3vXeoZX52dKDfu1ArufXT8CgSlX8DCPgDIqZg8Y5CDOHg13Wm466ndp99Dm" } ], "role": "model" @@ -41,17 +42,17 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 113, + "promptTokenCount": 148, "candidatesTokenCount": 16, - "totalTokenCount": 187, + "totalTokenCount": 226, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 113 + "tokenCount": 148 } ], - "thoughtsTokenCount": 58 + "thoughtsTokenCount": 62 }, "modelVersion": "gemini-2.5-flash", - "responseId": "qq58adq2E8Ttxs0Py437kAI" + "responseId": "8VmYaZmCNZ7U2roP_dOf0Ao" } diff --git a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required_and_is_confirmed.httprr b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required_and_is_confirmed.httprr index 4a0a41111..fecc81cb3 100644 --- a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required_and_is_confirmed.httprr +++ b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required_and_is_confirmed.httprr @@ -1,16 +1,17 @@ httprr trace v1 -925 1436 +1098 1453 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 693 +Content-Length: 866 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:19 GMT +Date: Fri, 20 Feb 2026 12:56:19 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=668 +Server-Timing: gfet4t7; dur=1046 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,7 +31,7 @@ X-Xss-Protection: 0 "city": "Lisbon" } }, - "thoughtSignature": "Co0CAXLI2nzbsOMEzlhx/xwHBMSsdSUwHM39N8fr7ZXGy5/3pnk3GLB26ozTNK4is8pVNsyqc9Hwr97UnKZu/MqHOrfz2JSdyMerEdd3P5fVF0yC1cHKAQsUqUm2SWxQH7y4yW1XdrpycadgXF+SmNg3L1hMkIbzbJCuEwH8WIFOAHXrF2ZPk61epieMhlIjE5iZeObolNoL6AmNHb1nPNhB5u1xVOULore4Iq3RsHGlHK7jYPFZSiQ8qJGZgfM6t+p/AUD3YKIszXta46dzrjq85LgtrcKcF61Ham9YWqmOldphtn0g7doJ5Zt6D0mEUYyq4J9FuGSkNJ0iknOF7UBeugsB2ywsd2uI8lByDOI=" + "thoughtSignature": "Cu4BAb4+9vv2HXNbJD+vP2rzHSEKODt+1RrWFVvCE8FR0Iyc2bKC988kiYvC3n9LN/7RBs8n0NJ3J2HRen6jIDRn97p4wdtzjJwVHBs7x84bplh7DtireX5j3PuLyK1VOgj8WyU4jRvpAi6JbkjWCp9qjzvm9IFd0l8LDPGUZdPQbx+NicTkExEg02nHORDMCjt3AkpIaEXDx03wXDm7DWDho5eCGLxO2qciuu+JSX/4UyhLN1H/1SNfq9VzIfy2Mw++TNt5FcHmzaSJ8AyGQXdETo9aJogg/QnLfbhT0ajlEbZiX90bMoyOfSjE64FZ6Q==" } ], "role": "model" @@ -41,32 +42,33 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 113, + "promptTokenCount": 148, "candidatesTokenCount": 16, - "totalTokenCount": 188, + "totalTokenCount": 214, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 113 + "tokenCount": 148 } ], - "thoughtsTokenCount": 59 + "thoughtsTokenCount": 50 }, "modelVersion": "gemini-2.5-flash", - "responseId": "qq58aZHcO_qW28oPhbqh0QM" + "responseId": "8lmYadyVNaLHrfcPw6qvMA" } -1547 842 +1680 898 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 1314 +Content-Length: 1447 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"Co0CAXLI2nzbsOMEzlhx/xwHBMSsdSUwHM39N8fr7ZXGy5/3pnk3GLB26ozTNK4is8pVNsyqc9Hwr97UnKZu/MqHOrfz2JSdyMerEdd3P5fVF0yC1cHKAQsUqUm2SWxQH7y4yW1XdrpycadgXF+SmNg3L1hMkIbzbJCuEwH8WIFOAHXrF2ZPk61epieMhlIjE5iZeObolNoL6AmNHb1nPNhB5u1xVOULore4Iq3RsHGlHK7jYPFZSiQ8qJGZgfM6t+p/AUD3YKIszXta46dzrjq85LgtrcKcF61Ham9YWqmOldphtn0g7doJ5Zt6D0mEUYyq4J9FuGSkNJ0iknOF7UBeugsB2ywsd2uI8lByDOI="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"Lisbon\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"Cu4BAb4+9vv2HXNbJD+vP2rzHSEKODt+1RrWFVvCE8FR0Iyc2bKC988kiYvC3n9LN/7RBs8n0NJ3J2HRen6jIDRn97p4wdtzjJwVHBs7x84bplh7DtireX5j3PuLyK1VOgj8WyU4jRvpAi6JbkjWCp9qjzvm9IFd0l8LDPGUZdPQbx+NicTkExEg02nHORDMCjt3AkpIaEXDx03wXDm7DWDho5eCGLxO2qciuu+JSX/4UyhLN1H/1SNfq9VzIfy2Mw++TNt5FcHmzaSJ8AyGQXdETo9aJogg/QnLfbhT0ajlEbZiX90bMoyOfSjE64FZ6Q=="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"Lisbon\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:19 GMT +Date: Fri, 20 Feb 2026 12:56:20 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=350 +Server-Timing: gfet4t7; dur=973 Vary: Origin Vary: X-Origin Vary: Referer @@ -90,16 +92,16 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 157, + "promptTokenCount": 192, "candidatesTokenCount": 8, - "totalTokenCount": 165, + "totalTokenCount": 200, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 157 + "tokenCount": 192 } ] }, "modelVersion": "gemini-2.5-flash", - "responseId": "q658adeuFPap28oPwPqxwAE" + "responseId": "9FmYaeskp-jaug_4gqGZDQ" } diff --git a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required_and_is_rejected.httprr b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required_and_is_rejected.httprr index 78c2b1749..3b0debe92 100644 --- a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required_and_is_rejected.httprr +++ b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required_and_is_rejected.httprr @@ -1,16 +1,17 @@ httprr trace v1 -925 1471 +1098 1498 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 693 +Content-Length: 866 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:20 GMT +Date: Fri, 20 Feb 2026 12:56:22 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=669 +Server-Timing: gfet4t7; dur=1146 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,7 +31,7 @@ X-Xss-Protection: 0 "city": "Lisbon" } }, - "thoughtSignature": "CqkCAXLI2nzzErpTSSdR9YByf9QfeQSqeMiwJPi6PvUgjum9hK2EugFQmpc6HP57AE+AGKAk6r9V2BJynJb7ilwUmgzOpiQTyQvxZjzco31w4tDsyC/yIW2O6O80ZVsdQv7feeQFlZW/EhlrbpuiORiGhj28JXm2IZILOE9Zhcqv+OSHS9EUi2Quz4RKHIffCmDcVYvDu9w3EsOf3ANjyfIYTOEFd/3aLRcHzcv9xzI/BfBdmM6aZ23USv8XRGLbjFeohJv6C1a/Z1HQPLVxKyhlOnJDuIJSWq9Cl0uPJ2/h4OrMhswXHr/x1mTtGQ9RGaVyd7mQH2Q3K1Y8EeZKYsQVY+qoC2+loA1tmu+30ViJofP2EgeYVOjcIRhdZngo8NTtFWfGLr9x4pTZ" + "thoughtSignature": "Co8CAb4+9vtJ3FPgMAJsra+D8rPYE5ivdOIrJkniBj6zKugMhAG7GJandOqSmtgh0NcWS2jOGENxuafNWlcIVGr4RbbCvWf3hiUsKZyWK7HijgqMmMgEWKaxBBtvkITyxhnaKF9e5Leee/RJLhK9VQg3xrvq4/LE/QAYxy38gP6AORtPQFyFMXSaxqX4rStFiInjT4eAI5KopWm45MDeYrlFAfbgMaONjkHjpULKVMzHy3wnP/EqPZiEoWlpolXm/G+7U9nBdGS+Vt3wJgnNFDpMHvpKOhuCR+9dM6D9ZH5I/x6+0jz43bx3WkxJuvQVUDfxUypwJt6R786C0oGgXUqY/Q/ai0TprSB0ik+4KnkQwQ==" } ], "role": "model" @@ -41,32 +42,33 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 113, + "promptTokenCount": 148, "candidatesTokenCount": 16, - "totalTokenCount": 195, + "totalTokenCount": 226, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 113 + "tokenCount": 148 } ], - "thoughtsTokenCount": 66 + "thoughtsTokenCount": 62 }, "modelVersion": "gemini-2.5-flash", - "responseId": "rK58aYpMvNjE3w_TgvCIBQ" + "responseId": "9FmYaZfhPKqk2roPnJLziAI" } -1577 1379 +1718 1310 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 1344 +Content-Length: 1485 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"CqkCAXLI2nzzErpTSSdR9YByf9QfeQSqeMiwJPi6PvUgjum9hK2EugFQmpc6HP57AE+AGKAk6r9V2BJynJb7ilwUmgzOpiQTyQvxZjzco31w4tDsyC/yIW2O6O80ZVsdQv7feeQFlZW/EhlrbpuiORiGhj28JXm2IZILOE9Zhcqv+OSHS9EUi2Quz4RKHIffCmDcVYvDu9w3EsOf3ANjyfIYTOEFd/3aLRcHzcv9xzI/BfBdmM6aZ23USv8XRGLbjFeohJv6C1a/Z1HQPLVxKyhlOnJDuIJSWq9Cl0uPJ2/h4OrMhswXHr/x1mTtGQ9RGaVyd7mQH2Q3K1Y8EeZKYsQVY+qoC2+loA1tmu+30ViJofP2EgeYVOjcIRhdZngo8NTtFWfGLr9x4pTZ"}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"error":"error tool \"get_weather\" call is rejected"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"Co8CAb4+9vtJ3FPgMAJsra+D8rPYE5ivdOIrJkniBj6zKugMhAG7GJandOqSmtgh0NcWS2jOGENxuafNWlcIVGr4RbbCvWf3hiUsKZyWK7HijgqMmMgEWKaxBBtvkITyxhnaKF9e5Leee/RJLhK9VQg3xrvq4/LE/QAYxy38gP6AORtPQFyFMXSaxqX4rStFiInjT4eAI5KopWm45MDeYrlFAfbgMaONjkHjpULKVMzHy3wnP/EqPZiEoWlpolXm/G+7U9nBdGS+Vt3wJgnNFDpMHvpKOhuCR+9dM6D9ZH5I/x6+0jz43bx3WkxJuvQVUDfxUypwJt6R786C0oGgXUqY/Q/ai0TprSB0ik+4KnkQwQ=="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"error":"error tool \"get_weather\" call is rejected"}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:20 GMT +Date: Fri, 20 Feb 2026 12:56:23 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=763 +Server-Timing: gfet4t7; dur=1309 Vary: Origin Vary: X-Origin Vary: Referer @@ -80,8 +82,8 @@ X-Xss-Protection: 0 "content": { "parts": [ { - "text": "I am sorry, I cannot get the weather in Lisbon.", - "thoughtSignature": "Cs8CAXLI2nwTanQJI+Xgadyz0eVvNPp7VArACzb8//1hTw2T9TNrBB9I0UKq1yfcIXHlIPlUZnWu383h3TIFyDITyvnwBy3N63Ri3D4pfOb4KX5XQgWtLK5kxss14nRJNvpdo5QnHq3hZCm7RAuxnh+zBtzW4/t7tTpjCfPh8AQnonIqjn5ElWbav64cq6tjzeX78v/HH8cK79/YVdtM3MZ0slH4uO2cLl1I3VqEblr1qDoGGEM/L8PqqI3+JSGh6wmaDQSIyJyf+fm4+u6zcjaBN+2AkrdG1B1aS4JA3nofwdylv2RmGfDYDCW77g+75IwgZtCGaL5dNuZRuS4zqs3leT3cjOqAF5A3htZHzDrRrgIYn/UqFy/7baY47+At3D0KeMHpNNx0deHMm5VqN75u0e9KlZdwoAo1LBl3lb1Jm3wvj0zchMJhoCP0aCkrmC0=" + "text": "I am sorry, I cannot provide the weather in Lisbon.", + "thoughtSignature": "CusBAb4+9vux+QLTdFecW3PR+vJ/72ko8TN6G7+tyPM4e6rII4dGIRDLEld7KqpfpVd8LAfUp5wvG4SMsfz9ISlIk+Gf9WyLuqaq1mRJf9Vt2jrKJ4dNcX06sAsm8lyqPcVnSlw2naGyCGxFsurda7zg1pPpNU/x9YrYUY7oxVyoTzbCZnd6BOSZYx/utZi97dNPTmqcgW6pON3WI+yt8+U73XaWOEVbSqHQIjPDQu088fShWg53yMf9pwLPGy04YErMs3A8bpJdhDXdC/xItIMBH5DHXEcr7luqNjUqJMcEjCwY6LveWeu+XI62HQ==" } ], "role": "model" @@ -91,17 +93,17 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 153, + "promptTokenCount": 188, "candidatesTokenCount": 12, - "totalTokenCount": 234, + "totalTokenCount": 241, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 153 + "tokenCount": 188 } ], - "thoughtsTokenCount": 69 + "thoughtsTokenCount": 41 }, "modelVersion": "gemini-2.5-flash", - "responseId": "rK58afuwL-TZvdIPzdOtWA" + "responseId": "9lmYacCPD96M2roPsP3UyAs" } diff --git a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_No_Confirmation_Required.httprr b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_No_Confirmation_Required.httprr index d1af42e07..bb180a865 100644 --- a/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_No_Confirmation_Required.httprr +++ b/tool/mcptoolset/testdata/TestMCPToolSetConfirmation_No_Confirmation_Required.httprr @@ -1,16 +1,17 @@ httprr trace v1 -925 1436 +1098 1526 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 693 +Content-Length: 866 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:17 GMT +Date: Fri, 20 Feb 2026 12:56:16 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=765 +Server-Timing: gfet4t7; dur=1340 Vary: Origin Vary: X-Origin Vary: Referer @@ -30,7 +31,7 @@ X-Xss-Protection: 0 "city": "Lisbon" } }, - "thoughtSignature": "Co0CAXLI2nyGeEKZFTcjgqv6kpn7pfv1o85d7Uh3fzkt1rlJzd75434YdJE2nTbRdyGbTuHtijCXfhfI/bSXAlEw6uAq56iAeJcD3+Uap74oTk/+Dw22EaLPTd9rSLHQRRDeNp+2fvOSakoN4VFQVudHo2oGap10cQa3VYX8bqRE6j3FkZIKEMfWDblfEqv4697rpxGsGL6xNrmtOxdNl3gCbllKvPxyoLM2W4TbSnE0r8yEBMwSe4b8HURWLNkGapMobY+C/4Dsj7eyD9Douti+47+Jvz2aFVe8yN2HWe3+6Q7ijV3aXJbHCd1Oyvz59clpVc0vj+RzzWsloF1szqMG+B2W+JyZGKmH2Mq0ISE=" + "thoughtSignature": "CqYCAb4+9vvg0xYklUpPXM1D5hj482VFGfbStj6CtOlZO/Y65COFxYpza/GtIsq5RyYDAjOa2LC56eOH4zSXSqvx0l6akcxZme4+eWDz6kCNSg6irsLDB4wIcXvwPTc2wj3z638QBbsNiE6Ctwb3mK3k67CmyC9APudffEJ0hzojd24Lzv09lHREoR4W1LTAoRY+4hWFe6nVFAzReLg64J7T6KZKo5aXCdsSILnkHBykiNKiUelKawwjJsa73Nb8o19ugSFEFazXAxRw2FLIpZ22DsR13wChaU3DzTJ5DS9ofLLCUTEmIsCqVNjxHICKIBf+h5asmwa1grI6Le7A0KhP6E2xeH6qxRPLYh5Ys55eh5bQKMgVJXT2byEZHmjp/DEzvDS68A4R" } ], "role": "model" @@ -41,32 +42,33 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 113, + "promptTokenCount": 148, "candidatesTokenCount": 16, - "totalTokenCount": 189, + "totalTokenCount": 231, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 113 + "tokenCount": 148 } ], - "thoughtsTokenCount": 60 + "thoughtsTokenCount": 67 }, "modelVersion": "gemini-2.5-flash", - "responseId": "qa58ad6NEq7ZvdIPrMiSgAg" + "responseId": "71mYadjcKvi10-kP25zduAo" } -1547 842 +1752 899 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent HTTP/1.1 Host: generativelanguage.googleapis.com User-Agent: Go-http-client/1.1 -Content-Length: 1314 +Content-Length: 1519 Content-Type: application/json -{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"Co0CAXLI2nyGeEKZFTcjgqv6kpn7pfv1o85d7Uh3fzkt1rlJzd75434YdJE2nTbRdyGbTuHtijCXfhfI/bSXAlEw6uAq56iAeJcD3+Uap74oTk/+Dw22EaLPTd9rSLHQRRDeNp+2fvOSakoN4VFQVudHo2oGap10cQa3VYX8bqRE6j3FkZIKEMfWDblfEqv4697rpxGsGL6xNrmtOxdNl3gCbllKvPxyoLM2W4TbSnE0r8yEBMwSe4b8HURWLNkGapMobY+C/4Dsj7eyD9Douti+47+Jvz2aFVe8yN2HWe3+6Q7ijV3aXJbHCd1Oyvz59clpVc0vj+RzzWsloF1szqMG+B2W+JyZGKmH2Mq0ISE="}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"Lisbon\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +{"contents":[{"parts":[{"text":"what is the weather in Lisbon?"}],"role":"user"},{"parts":[{"functionCall":{"args":{"city":"Lisbon"},"name":"get_weather"},"thoughtSignature":"CqYCAb4+9vvg0xYklUpPXM1D5hj482VFGfbStj6CtOlZO/Y65COFxYpza/GtIsq5RyYDAjOa2LC56eOH4zSXSqvx0l6akcxZme4+eWDz6kCNSg6irsLDB4wIcXvwPTc2wj3z638QBbsNiE6Ctwb3mK3k67CmyC9APudffEJ0hzojd24Lzv09lHREoR4W1LTAoRY+4hWFe6nVFAzReLg64J7T6KZKo5aXCdsSILnkHBykiNKiUelKawwjJsa73Nb8o19ugSFEFazXAxRw2FLIpZ22DsR13wChaU3DzTJ5DS9ofLLCUTEmIsCqVNjxHICKIBf+h5asmwa1grI6Le7A0KhP6E2xeH6qxRPLYh5Ys55eh5bQKMgVJXT2byEZHmjp/DEzvDS68A4R"}],"role":"model"},{"parts":[{"functionResponse":{"name":"get_weather","response":{"output":{"weather_summary":"Today in \"Lisbon\" is sunny"}}}}],"role":"user"}],"generationConfig":{},"systemInstruction":{"parts":[{"text":"I can answer your questions about the time and weather in a city."},{"text":"You are an agent. Your internal name is \"weather_time_agent\". The description about you is \"Agent to answer questions about the time and weather in a city.\"."}],"role":"user"},"tools":[{"functionDeclarations":[{"description":"returns weather in the given city","name":"get_weather","parametersJsonSchema":{"additionalProperties":false,"properties":{"city":{"description":"city name","type":"string"}},"required":["city"],"type":"object"},"responseJsonSchema":{"additionalProperties":false,"properties":{"weather_summary":{"description":"weather summary in the given city","type":"string"}},"required":["weather_summary"],"type":"object"}}]}]}HTTP/2.0 200 OK +Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-Type: application/json; charset=UTF-8 -Date: Fri, 30 Jan 2026 13:14:17 GMT +Date: Fri, 20 Feb 2026 12:56:17 GMT Server: scaffolding on HTTPServer2 -Server-Timing: gfet4t7; dur=404 +Server-Timing: gfet4t7; dur=771 Vary: Origin Vary: X-Origin Vary: Referer @@ -90,16 +92,16 @@ X-Xss-Protection: 0 } ], "usageMetadata": { - "promptTokenCount": 157, + "promptTokenCount": 192, "candidatesTokenCount": 8, - "totalTokenCount": 165, + "totalTokenCount": 200, "promptTokensDetails": [ { "modality": "TEXT", - "tokenCount": 157 + "tokenCount": 192 } ] }, "modelVersion": "gemini-2.5-flash", - "responseId": "qa58acCFKtDVxs0PwueN-AQ" + "responseId": "8VmYaYWHBOad0-kPrfidgAs" }