Skip to content

Commit 0e6868b

Browse files
MarkDaoustcopybara-github
authored andcommitted
chore: fix mcp doesn't work for agents
PiperOrigin-RevId: 917814855
1 parent ca97c58 commit 0e6868b

2 files changed

Lines changed: 7 additions & 61 deletions

File tree

google/genai/_interactions/types/agent.py

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,14 @@
1515

1616
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1717

18-
from typing import Dict, List, Union, Optional
18+
from typing import List, Union, Optional
1919
from typing_extensions import Literal, Annotated, TypeAlias
2020

2121
from .._utils import PropertyInfo
2222
from .._models import BaseModel
2323
from .environment import Environment
24-
from .allowed_tools import AllowedTools
25-
26-
__all__ = [
27-
"Agent",
28-
"BaseEnvironment",
29-
"Tool",
30-
"ToolCodeExecution",
31-
"ToolGoogleSearch",
32-
"ToolURLContext",
33-
"ToolMCPServer",
34-
]
24+
25+
__all__ = ["Agent", "BaseEnvironment", "Tool", "ToolCodeExecution", "ToolGoogleSearch", "ToolURLContext"]
3526

3627
BaseEnvironment: TypeAlias = Union[Environment, str]
3728

@@ -57,26 +48,8 @@ class ToolURLContext(BaseModel):
5748
type: Literal["url_context"]
5849

5950

60-
class ToolMCPServer(BaseModel):
61-
"""A MCPServer is a server that can be called by the model to perform actions."""
62-
63-
type: Literal["mcp_server"]
64-
65-
allowed_tools: Optional[List[AllowedTools]] = None
66-
"""The allowed tools."""
67-
68-
headers: Optional[Dict[str, str]] = None
69-
"""Optional: Fields for authentication headers, timeouts, etc., if needed."""
70-
71-
name: Optional[str] = None
72-
"""The name of the MCPServer."""
73-
74-
url: Optional[str] = None
75-
"""The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp" """
76-
77-
7851
Tool: TypeAlias = Annotated[
79-
Union[ToolCodeExecution, ToolGoogleSearch, ToolURLContext, ToolMCPServer], PropertyInfo(discriminator="type")
52+
Union[ToolCodeExecution, ToolGoogleSearch, ToolURLContext], PropertyInfo(discriminator="type")
8053
]
8154

8255

google/genai/_interactions/types/agent_create_params.py

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,12 @@
1717

1818
from __future__ import annotations
1919

20-
from typing import Dict, List, Union, Iterable
20+
from typing import List, Union, Iterable
2121
from typing_extensions import Literal, Required, TypeAlias, TypedDict
2222

2323
from .environment_param import EnvironmentParam
24-
from .allowed_tools_param import AllowedToolsParam
2524

26-
__all__ = [
27-
"AgentCreateParams",
28-
"BaseEnvironment",
29-
"Tool",
30-
"ToolCodeExecution",
31-
"ToolGoogleSearch",
32-
"ToolURLContext",
33-
"ToolMCPServer",
34-
]
25+
__all__ = ["AgentCreateParams", "BaseEnvironment", "Tool", "ToolCodeExecution", "ToolGoogleSearch", "ToolURLContext"]
3526

3627

3728
class AgentCreateParams(TypedDict, total=False):
@@ -80,22 +71,4 @@ class ToolURLContext(TypedDict, total=False):
8071
type: Required[Literal["url_context"]]
8172

8273

83-
class ToolMCPServer(TypedDict, total=False):
84-
"""A MCPServer is a server that can be called by the model to perform actions."""
85-
86-
type: Required[Literal["mcp_server"]]
87-
88-
allowed_tools: Iterable[AllowedToolsParam]
89-
"""The allowed tools."""
90-
91-
headers: Dict[str, str]
92-
"""Optional: Fields for authentication headers, timeouts, etc., if needed."""
93-
94-
name: str
95-
"""The name of the MCPServer."""
96-
97-
url: str
98-
"""The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp" """
99-
100-
101-
Tool: TypeAlias = Union[ToolCodeExecution, ToolGoogleSearch, ToolURLContext, ToolMCPServer]
74+
Tool: TypeAlias = Union[ToolCodeExecution, ToolGoogleSearch, ToolURLContext]

0 commit comments

Comments
 (0)