Skip to content

Commit 653abc5

Browse files
authored
Fix #892 by adding proper tool description in context.md (#937)
### Summary This pull request fixes [issue #892](#892) by adding a missing docstring to the `fetch_user_age` tool function in `docs/context.md`. ### Problem Many non-OpenAI LLMs (such as Claude, Gemini, Mistral, etc.) are unable to use the `fetch_user_age` function because it lacks a docstring. As a result, they return responses like: > "I cannot determine the user's age because the available tools lack the ability to fetch user-specific information." ### Changes Made - Added a one-line docstring to the `fetch_user_age` function - Improved return statement to match expected tool output ```python @function_tool async def fetch_user_age(wrapper: RunContextWrapper[UserInfo]) -> str: """Fetch the age of the user. Call this function to get user's age information.""" return f"The user {wrapper.context.name} is 47 years old"
1 parent 94f8035 commit 653abc5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/context.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ class UserInfo: # (1)!
3838

3939
@function_tool
4040
async def fetch_user_age(wrapper: RunContextWrapper[UserInfo]) -> str: # (2)!
41-
return f"User {wrapper.context.name} is 47 years old"
41+
"""Fetch the age of the user. Call this function to get user's age information."""
42+
return f"The user {wrapper.context.name} is 47 years old"
4243

4344
async def main():
4445
user_info = UserInfo(name="John", uid=123)

0 commit comments

Comments
 (0)