mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-24 06:24:18 +02:00
Clean up tool call
This commit is contained in:
parent
fdaf95ed25
commit
0889c07f27
1 changed files with 8 additions and 5 deletions
|
|
@ -101,13 +101,16 @@ class Tool(BaseModel):
|
|||
) -> list[TextContent | ImageContent | EmbeddedResource]:
|
||||
"""Run the tool with arguments."""
|
||||
try:
|
||||
result = await self.fn_metadata.call_fn_with_arg_validation(
|
||||
self.fn,
|
||||
self.is_async,
|
||||
arguments,
|
||||
pass_args = (
|
||||
{self.context_kwarg: context}
|
||||
if self.context_kwarg is not None
|
||||
else None,
|
||||
else None
|
||||
)
|
||||
result = await self.fn_metadata.call_fn_with_arg_validation(
|
||||
fn=self.fn,
|
||||
fn_is_async=self.is_async,
|
||||
arguments_to_validate=arguments,
|
||||
arguments_to_pass_directly=pass_args,
|
||||
)
|
||||
return _convert_to_content(result)
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue