Skip to content

fix(toolbox-core): Expose authorization token requirements on ToolboxTool #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 24, 2025

Conversation

anubhav756
Copy link
Contributor

@anubhav756 anubhav756 commented Jun 19, 2025

Summary

This PR exposes the authorization token requirements from the ToolboxTool class by promoting the internal list of required authorization tokens to a read-only property.

Motivation

Currently, the list of authorization services that a tool requires is stored as a private attribute within the ToolboxTool instance. This encapsulation makes it difficult for external wrapper classes or orchestration layers to programmatically inspect a tool and determine its authentication needs.

The ultimate goal, which will be implemented in a future PR (#291), is to enable self-authenticated tools. This feature requires the ability for toolbox-langchain wrapper to introspect a tool instance, identify its authorization requirements, and potentially manage the token acquisition lifecycle automatically. Currently we only expose authentication requirements, that is a map of parameter names to the corresponding applicable authentication services.

This PR is the necessary first step, providing a clean and stable public API to access this information.

Changes Proposed

  • A new read-only public property, required_authz_tokens, has been added to the ToolboxTool class.
  • This property returns an immutable tuple of the authorization service names (e.g., ('my-auth-service', 'another-service')) required by the tool.
  • By exposing this as a property, we establish a clear contract for consumers of the ToolboxTool core class, avoiding the need to access private (__ToolboxTool_) attributes.

Note

This change is non-breaking and purely additive.

@anubhav756 anubhav756 self-assigned this Jun 19, 2025
@anubhav756 anubhav756 changed the base branch from anubhav-optional-params to main June 19, 2025 13:56
@anubhav756 anubhav756 changed the title fix(toolbox-core): Expose authz token requirements from ToolboxTool fix(toolbox-core): Expose authz token requirements from ToolboxTool Jun 19, 2025
@anubhav756
Copy link
Contributor Author

/gcbrun

@anubhav756 anubhav756 marked this pull request as ready for review June 19, 2025 14:31
@anubhav756 anubhav756 requested a review from a team as a code owner June 19, 2025 14:31
@anubhav756 anubhav756 changed the title fix(toolbox-core): Expose authz token requirements from ToolboxTool fix(toolbox-core): Expose authorization token requirements on ToolboxTool Jun 19, 2025
This is used in a future PR where we inspect this protected value from the wrapper classes to implement self-authenticated tools.
@anubhav756 anubhav756 merged commit d7c3311 into main Jun 24, 2025
20 checks passed
@anubhav756 anubhav756 deleted the anubhav-state branch June 24, 2025 11:50
@release-please release-please bot mentioned this pull request Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants