You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tool parameters lose descriptions from Annotated[...] and docstring Args sections #270
@ai.tool builds the parameter schema with get_type_hints(fn), which strips Annotated metadata. The most natural typed-tool patterns therefore produce undocumented arguments:
fromtypingimportAnnotatedfrompydanticimportField@ai.toolasyncdefget_weather(
city: Annotated[str, Field(description="City name")],
days: Annotated[int, Field(ge=1, le=7, description="Forecast length")] =3,
) ->str:
"""Get the weather forecast. Args: city: City to forecast for. """return"sunny"
Today neither the Field(description=...) nor the Args: entry for city reaches the JSON schema the model sees. Descriptions materially affect tool selection and argument quality, so this hurts most in exactly the multi-tool workspaces the agent loop targets.
Suggested behavior
resolve hints with get_type_hints(fn, include_extras=True) so Field metadata survives into model_json_schema() (pydantic already supports this; no new dependency)
additionally fill missing property descriptions from a Google-style Args: docstring section, with Field taking precedence
schemas for tools that use neither mechanism stay byte-identical
Activity