Open
Description
Bug: Missing docstring in fetch_user_age
breaks tool understanding
The fetch_user_age
function in the context.md
documentation is missing a docstring.
This causes many language models (other than OpenAI’s) to misinterpret the tool or ignore it completely. Typical responses include:
"I cannot determine the user's age because the available tools lack the ability to fetch user-specific information."
"I cannot fulfill this request. The available tools lack the ability to fetch the user's age."
This happens because, without a docstring, the tool schema lacks a proper description.
Suggested fix:
@function_tool
async def fetch_user_age(wrapper: RunContextWrapper[UserInfo]) -> str:
"""Returns the age of the user."""
return f"User {wrapper.context.name} is 47 years old"
This minimal docstring improves compatibility across LLM providers and ensures accurate tool usage.