Drop Content and args parameter in ClientSessionGroup.call_tool (#1866)
This commit is contained in:
parent
c251e728f4
commit
024d7597fd
2 changed files with 36 additions and 31 deletions
|
|
@ -12,12 +12,12 @@ import logging
|
|||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from types import TracebackType
|
||||
from typing import Any, TypeAlias, overload
|
||||
from typing import Any, TypeAlias
|
||||
|
||||
import anyio
|
||||
import httpx
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import Self, deprecated
|
||||
from typing_extensions import Self
|
||||
|
||||
import mcp
|
||||
from mcp import types
|
||||
|
|
@ -190,29 +190,6 @@ class ClientSessionGroup:
|
|||
"""Returns the tools as a dictionary of names to tools."""
|
||||
return self._tools
|
||||
|
||||
@overload
|
||||
async def call_tool(
|
||||
self,
|
||||
name: str,
|
||||
arguments: dict[str, Any],
|
||||
read_timeout_seconds: float | None = None,
|
||||
progress_callback: ProgressFnT | None = None,
|
||||
*,
|
||||
meta: dict[str, Any] | None = None,
|
||||
) -> types.CallToolResult: ...
|
||||
|
||||
@overload
|
||||
@deprecated("The 'args' parameter is deprecated. Use 'arguments' instead.")
|
||||
async def call_tool(
|
||||
self,
|
||||
name: str,
|
||||
*,
|
||||
args: dict[str, Any],
|
||||
read_timeout_seconds: float | None = None,
|
||||
progress_callback: ProgressFnT | None = None,
|
||||
meta: dict[str, Any] | None = None,
|
||||
) -> types.CallToolResult: ...
|
||||
|
||||
async def call_tool(
|
||||
self,
|
||||
name: str,
|
||||
|
|
@ -221,14 +198,13 @@ class ClientSessionGroup:
|
|||
progress_callback: ProgressFnT | None = None,
|
||||
*,
|
||||
meta: dict[str, Any] | None = None,
|
||||
args: dict[str, Any] | None = None,
|
||||
) -> types.CallToolResult:
|
||||
"""Executes a tool given its name and arguments."""
|
||||
session = self._tool_to_session[name]
|
||||
session_tool_name = self.tools[name].name
|
||||
return await session.call_tool(
|
||||
session_tool_name,
|
||||
arguments if args is None else args,
|
||||
arguments=arguments,
|
||||
read_timeout_seconds=read_timeout_seconds,
|
||||
progress_callback=progress_callback,
|
||||
meta=meta,
|
||||
|
|
|
|||
|
|
@ -1196,9 +1196,6 @@ class ResourceLink(Resource):
|
|||
ContentBlock = TextContent | ImageContent | AudioContent | ResourceLink | EmbeddedResource
|
||||
"""A content block that can be used in prompts and tool results."""
|
||||
|
||||
Content: TypeAlias = ContentBlock
|
||||
# """DEPRECATED: Content is deprecated, you should use ContentBlock directly."""
|
||||
|
||||
|
||||
class PromptMessage(BaseModel):
|
||||
"""Describes a message returned as part of a prompt."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue