Skip to content

Conversation

Abbas-Asad
Copy link
Contributor

Summary

This pull request fixes issue #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
@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"

### Summary

This pull request fixes [issue openai#892](openai#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"
@seratch seratch added the documentation Improvements or additions to documentation label Jun 25, 2025
@seratch seratch merged commit 653abc5 into openai:main Jun 25, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing docstring in fetch_user_age breaks tool understanding

2 participants