mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 05:24:18 +02:00
Merge pull request #315 from jlowin/remove-async
Remove is_async attribute
This commit is contained in:
commit
934bdd0349
5 changed files with 0 additions and 13 deletions
|
|
@ -122,7 +122,6 @@ class OpenAPITool(Tool):
|
|||
name: str,
|
||||
description: str,
|
||||
parameters: dict[str, Any],
|
||||
is_async: bool = True,
|
||||
tags: set[str] = set(),
|
||||
timeout: float | None = None,
|
||||
annotations: ToolAnnotations | None = None,
|
||||
|
|
@ -133,7 +132,6 @@ class OpenAPITool(Tool):
|
|||
description=description,
|
||||
parameters=parameters,
|
||||
fn=self._execute_request, # We'll use an instance method instead of a global function
|
||||
is_async=is_async,
|
||||
context_kwarg="context", # Default context keyword argument
|
||||
tags=tags,
|
||||
annotations=annotations,
|
||||
|
|
@ -550,7 +548,6 @@ class FastMCPOpenAPI(FastMCP):
|
|||
name=tool_name,
|
||||
description=enhanced_description,
|
||||
parameters=combined_schema,
|
||||
is_async=True,
|
||||
tags=set(route.tags or []),
|
||||
timeout=self._timeout,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ class ProxyTool(Tool):
|
|||
description=tool.description,
|
||||
parameters=tool.inputSchema,
|
||||
fn=_proxy_passthrough,
|
||||
is_async=True,
|
||||
)
|
||||
|
||||
async def run(
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ class Tool(BaseModel):
|
|||
name: str = Field(description="Name of the tool")
|
||||
description: str = Field(description="Description of what the tool does")
|
||||
parameters: dict[str, Any] = Field(description="JSON schema for tool parameters")
|
||||
is_async: bool = Field(description="Whether the tool is async")
|
||||
context_kwarg: str | None = Field(
|
||||
None, description="Name of the kwarg that should receive context"
|
||||
)
|
||||
|
|
@ -74,7 +73,6 @@ class Tool(BaseModel):
|
|||
raise ValueError("You must provide a name for lambda functions")
|
||||
|
||||
func_doc = description or fn.__doc__ or ""
|
||||
is_async = inspect.iscoroutinefunction(fn)
|
||||
|
||||
if inspect.ismethod(fn) and hasattr(fn, "__func__"):
|
||||
sig = inspect.signature(fn.__func__)
|
||||
|
|
@ -96,7 +94,6 @@ class Tool(BaseModel):
|
|||
name=func_name,
|
||||
description=func_doc,
|
||||
parameters=schema,
|
||||
is_async=is_async,
|
||||
context_kwarg=context_kwarg,
|
||||
tags=tags or set(),
|
||||
annotations=annotations,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ class TestToolFromFunction:
|
|||
|
||||
assert tool.name == "add"
|
||||
assert tool.description == "Add two numbers."
|
||||
assert tool.is_async is False
|
||||
assert tool.parameters["properties"]["a"]["type"] == "integer"
|
||||
assert tool.parameters["properties"]["b"]["type"] == "integer"
|
||||
|
||||
|
|
@ -33,7 +32,6 @@ class TestToolFromFunction:
|
|||
|
||||
assert tool.name == "fetch_data"
|
||||
assert tool.description == "Fetch data from URL."
|
||||
assert tool.is_async is True
|
||||
assert tool.parameters["properties"]["url"]["type"] == "string"
|
||||
|
||||
def test_pydantic_model_function(self):
|
||||
|
|
@ -51,7 +49,6 @@ class TestToolFromFunction:
|
|||
|
||||
assert tool.name == "create_user"
|
||||
assert tool.description == "Create a new user."
|
||||
assert tool.is_async is False
|
||||
assert "name" in tool.parameters["$defs"]["UserInput"]["properties"]
|
||||
assert "age" in tool.parameters["$defs"]["UserInput"]["properties"]
|
||||
assert "flag" in tool.parameters["properties"]
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class TestAddTools:
|
|||
assert tool is not None
|
||||
assert tool.name == "add"
|
||||
assert tool.description == "Add two numbers."
|
||||
assert tool.is_async is False
|
||||
assert tool.parameters["properties"]["a"]["type"] == "integer"
|
||||
assert tool.parameters["properties"]["b"]["type"] == "integer"
|
||||
|
||||
|
|
@ -49,7 +48,6 @@ class TestAddTools:
|
|||
assert tool is not None
|
||||
assert tool.name == "fetch_data"
|
||||
assert tool.description == "Fetch data from URL."
|
||||
assert tool.is_async is True
|
||||
assert tool.parameters["properties"]["url"]["type"] == "string"
|
||||
|
||||
def test_pydantic_model_function(self):
|
||||
|
|
@ -70,7 +68,6 @@ class TestAddTools:
|
|||
assert tool is not None
|
||||
assert tool.name == "create_user"
|
||||
assert tool.description == "Create a new user."
|
||||
assert tool.is_async is False
|
||||
assert "name" in tool.parameters["$defs"]["UserInput"]["properties"]
|
||||
assert "age" in tool.parameters["$defs"]["UserInput"]["properties"]
|
||||
assert "flag" in tool.parameters["properties"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue