chore: auto format mcp tools

PiperOrigin-RevId: 764547299
This commit is contained in:
Xiang (Sean) Zhou 2025-05-28 21:14:09 -07:00 committed by Copybara-Service
parent 791ac9eb68
commit b70e74c450
3 changed files with 14 additions and 3 deletions

View File

@ -22,6 +22,7 @@ import sys
from typing import Any from typing import Any
from typing import Optional from typing import Optional
from typing import TextIO from typing import TextIO
from typing import Union
import anyio import anyio
from pydantic import BaseModel from pydantic import BaseModel
@ -65,6 +66,7 @@ class StreamableHTTPServerParams(BaseModel):
See MCP SSE Client documentation for more details. See MCP SSE Client documentation for more details.
https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/streamable_http.py https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/streamable_http.py
""" """
url: str url: str
headers: dict[str, Any] | None = None headers: dict[str, Any] | None = None
timeout: float = 5 timeout: float = 5
@ -139,7 +141,9 @@ class MCPSessionManager:
def __init__( def __init__(
self, self,
connection_params: StdioServerParameters | SseServerParams | StreamableHTTPServerParams, connection_params: Union[
StdioServerParameters, SseServerParams, StreamableHTTPServerParams
],
errlog: TextIO = sys.stderr, errlog: TextIO = sys.stderr,
): ):
"""Initializes the MCP session manager. """Initializes the MCP session manager.
@ -184,7 +188,9 @@ class MCPSessionManager:
url=self._connection_params.url, url=self._connection_params.url,
headers=self._connection_params.headers, headers=self._connection_params.headers,
timeout=timedelta(seconds=self._connection_params.timeout), timeout=timedelta(seconds=self._connection_params.timeout),
sse_read_timeout=timedelta(seconds=self._connection_params.sse_read_timeout), sse_read_timeout=timedelta(
seconds=self._connection_params.sse_read_timeout
),
terminate_on_close=self._connection_params.terminate_on_close, terminate_on_close=self._connection_params.terminate_on_close,
) )
else: else:

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import annotations
import logging import logging
from typing import Optional from typing import Optional

View File

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import annotations
import logging import logging
import sys import sys
from typing import List from typing import List
@ -83,7 +85,9 @@ class MCPToolset(BaseToolset):
def __init__( def __init__(
self, self,
*, *,
connection_params: StdioServerParameters | SseServerParams | StreamableHTTPServerParams, connection_params: (
StdioServerParameters | SseServerParams | StreamableHTTPServerParams
),
tool_filter: Optional[Union[ToolPredicate, List[str]]] = None, tool_filter: Optional[Union[ToolPredicate, List[str]]] = None,
errlog: TextIO = sys.stderr, errlog: TextIO = sys.stderr,
): ):