Skip to content

Conversation

MuhammadSaqib786
Copy link

Summary

Added a short section in context.md explaining how to use ToolContext, which extends RunContextWrapper and gives access to tool metadata such as tool_name, tool_call_id, and tool_arguments.

Why

This helps developers understand when to use ToolContext for advanced cases, without replacing the existing RunContextWrapper examples.

Changes

  • Added a new "Advanced: ToolContext" section under Local Context.
  • Included a simple example with explanations.

Notes

This PR updates only the documentation. No code or API changes were made.

Thanks for reviewing!

@seratch seratch added the documentation Improvements or additions to documentation label Oct 8, 2025
`ToolContext` provides the same `.context` property as `RunContextWrapper`,
plus additional fields specific to the current tool call:

- `tool_name` – the name of the tool being invoked

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you specify this please?

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.

3 participants