File tree Expand file tree Collapse file tree
src/google/adk/tools/mcp_tool Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818import base64
1919import inspect
2020import logging
21+ import os
2122from typing import Any
2223from typing import Callable
2324from typing import Dict
@@ -169,6 +170,16 @@ def __init__(
169170 Raises:
170171 ValueError: If mcp_tool or mcp_session_manager is None.
171172 """
173+
174+ # --- BEGIN BOUND TOKEN PATCH ---
175+ # Set GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES to false
176+ # to disable bound token sharing. Tracking on
177+ # https://github.com/google/adk-python/issues/5361
178+ os .environ ["GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES" ] = (
179+ "false"
180+ )
181+ # --- END BOUND TOKEN PATCH ---
182+
172183 super ().__init__ (
173184 name = mcp_tool .name ,
174185 description = mcp_tool .description if mcp_tool .description else "" ,
Original file line number Diff line number Diff line change 1717import asyncio
1818import base64
1919import logging
20+ import os
2021import sys
2122from typing import Any
2223from typing import Awaitable
@@ -158,6 +159,15 @@ def __init__(
158159 sampling_capabilities: Optional capabilities for sampling.
159160 """
160161
162+ # --- BEGIN BOUND TOKEN PATCH ---
163+ # Set GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES to false
164+ # to disable bound token sharing. Tracking on
165+ # https://github.com/google/adk-python/issues/5361
166+ os .environ ["GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES" ] = (
167+ "false"
168+ )
169+ # --- END BOUND TOKEN PATCH ---
170+
161171 super ().__init__ (tool_filter = tool_filter , tool_name_prefix = tool_name_prefix )
162172
163173 self ._sampling_callback = sampling_callback
You can’t perform that action at this time.
0 commit comments