mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 13:34:17 +02:00
Don't store exclude args as attribute
This commit is contained in:
parent
23617c9c72
commit
32a091e228
3 changed files with 2 additions and 14 deletions
|
|
@ -226,7 +226,6 @@ class OpenAPITool(Tool):
|
|||
tags: set[str] = set(),
|
||||
timeout: float | None = None,
|
||||
annotations: ToolAnnotations | None = None,
|
||||
exclude_args: list[str] | None = None,
|
||||
serializer: Callable[[Any], str] | None = None,
|
||||
):
|
||||
super().__init__(
|
||||
|
|
@ -235,7 +234,6 @@ class OpenAPITool(Tool):
|
|||
parameters=parameters,
|
||||
tags=tags,
|
||||
annotations=annotations,
|
||||
exclude_args=exclude_args,
|
||||
serializer=serializer,
|
||||
)
|
||||
self._client = client
|
||||
|
|
|
|||
|
|
@ -47,10 +47,6 @@ class Tool(FastMCPBaseModel, ABC):
|
|||
annotations: ToolAnnotations | None = Field(
|
||||
default=None, description="Additional annotations about the tool"
|
||||
)
|
||||
exclude_args: list[str] | None = Field(
|
||||
default=None,
|
||||
description="Arguments to exclude from the tool schema, such as State, Memory, or Credential",
|
||||
)
|
||||
serializer: Callable[[Any], str] | None = Field(
|
||||
default=None, description="Optional custom serializer for tool results"
|
||||
)
|
||||
|
|
@ -169,7 +165,6 @@ class FunctionTool(Tool):
|
|||
parameters=schema,
|
||||
tags=tags or set(),
|
||||
annotations=annotations,
|
||||
exclude_args=exclude_args,
|
||||
serializer=serializer,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@ async def test_tool_exclude_args_in_tool_manager():
|
|||
|
||||
tools = mcp._tool_manager.list_tools()
|
||||
assert len(tools) == 1
|
||||
assert tools[0].exclude_args is not None
|
||||
for args in tools[0].exclude_args:
|
||||
assert args not in tools[0].parameters
|
||||
assert "state" not in echo.parameters["properties"]
|
||||
|
||||
|
||||
async def test_tool_exclude_args_without_default_value_raises_error():
|
||||
|
|
@ -64,10 +62,7 @@ async def test_add_tool_method_exclude_args():
|
|||
# Check internal tool objects directly
|
||||
tools = mcp._tool_manager.list_tools()
|
||||
assert len(tools) == 1
|
||||
assert tools[0].exclude_args is not None
|
||||
assert tools[0].exclude_args == ["state"]
|
||||
for args in tools[0].exclude_args:
|
||||
assert args not in tools[0].parameters
|
||||
assert "state" not in tools[0].parameters["properties"]
|
||||
|
||||
|
||||
async def test_tool_functionality_with_exclude_args():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue