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

This comment was marked as off-topic.

Copy link
Author

@MuhammadSaqib786 MuhammadSaqib786 Oct 9, 2025

Choose a reason for hiding this comment

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

Thanks for reviewing! Please let me know if there’s anything you’d like me to adjust or clarify.

Copy link
Author

@MuhammadSaqib786 MuhammadSaqib786 left a comment

Choose a reason for hiding this comment

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

Thanks for reviewing! Please let me know if there’s anything you’d like me to adjust or clarify.

@seratch seratch removed the request for review from khamsukanon79120 October 10, 2025 23:48
@MuhammadSaqib786
Copy link
Author

Updated the example to use WeatherContext and typed parameters as suggested. Thanks for the helpful feedback!

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