mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-28 02:10:38 +02:00
Fix handling tools without descriptions
This commit is contained in:
parent
e80db43456
commit
05288fc507
3 changed files with 12 additions and 3 deletions
|
|
@ -148,7 +148,7 @@ class ResourceTemplate(BaseModel):
|
|||
f"URI parameters {uri_params} must be a subset of the function arguments: {func_params}"
|
||||
)
|
||||
|
||||
description = description or fn.__doc__ or ""
|
||||
description = description or fn.__doc__
|
||||
|
||||
if not inspect.isroutine(fn):
|
||||
fn = fn.__call__
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Tool(BaseModel):
|
|||
|
||||
fn: Callable[..., Any]
|
||||
name: str = Field(description="Name of the tool")
|
||||
description: str = Field(description="Description of what the tool does")
|
||||
description: str | None = Field(description="Description of what the tool does")
|
||||
parameters: dict[str, Any] = Field(description="JSON schema for tool parameters")
|
||||
tags: Annotated[set[str], BeforeValidator(_convert_set_defaults)] = Field(
|
||||
default_factory=set, description="Tags for the tool"
|
||||
|
|
@ -74,7 +74,7 @@ class Tool(BaseModel):
|
|||
if func_name == "<lambda>":
|
||||
raise ValueError("You must provide a name for lambda functions")
|
||||
|
||||
func_doc = description or fn.__doc__ or ""
|
||||
func_doc = description or fn.__doc__
|
||||
|
||||
# if the fn is a callable class, we need to get the __call__ method from here out
|
||||
if not inspect.isroutine(fn):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue