Repository navigation
feat(tools): add tool_context module aliasing ToolContext to Context - #945
Merged
AmaadMartin merged 3 commits intoSep 25, 2026
Merged
Conversation
added 3 commits
September 24, 2026 14:16
adk-python exposes ToolContext and CallbackContext from
google.adk.tools.tool_context, where both names bind to the unified
Context class. A TypeScript user porting a Python agent writes
import {ToolContext} from '@google/adk' and gets a compile error.
Bind both names to Context as plain re-exports, so a Context the
framework builds satisfies a ToolContext-typed parameter. Re-export the
three auth names the Python module re-exports from the same path.
adk-python documents its guides under docs/guides/<topic>/<feature>/. adk-js had no such directory, so a reader porting a Python agent has nowhere to learn which adk-js name matches ToolContext. Add the guide and the index it needs. The unit test covers the sample.
The three auth re-exports could not be reached. The core package exports map is a closed allowlist with no entry for this path, and it publishes only dist, so no consumer can import them from here. All three already ship from the package root. Drop the guide tree with them. adk-js routes its documentation to adk.dev, and declaring a docs/guides convention is a package-layout decision, not part of this port.
Collaborator
|
Merging in about 6h unless someone objects. Close this PR, add |
Collaborator
|
Merging in about 1h unless someone objects. Close this PR, add |
adk-foundry-approver
approved these changes
Sep 25, 2026
adk-foundry-approver
left a comment
Collaborator
There was a problem hiding this comment.
Approved automatically by ADK Foundry. No human has read this change.
This approval attests only that the change passed the gates below, all
enforced in code:
- the merge critic read the diff and approved it (93.9% precision measured
against 107 upstream pull requests with known maintainer outcomes) - ? changed lines across ? file(s), inside the 200/5 ceiling
- no auth, credential, security, release or dependency-manifest path touched
- required checks green, re-verified immediately before this approval
- opened 24h ago and visible as
automerge: scheduledthroughout,
with no objection from anyone
To stop this merging, close the pull request or add status/on-hold. To stop
the mechanism entirely, revoke this account's access; delivery continues and
nothing merges.
Merged
prasanna8585
pushed a commit
to prasanna8585/adk-js
that referenced
this pull request
Nov 10, 2026
…oogle#945) * feat(tools): add tool_context module aliasing ToolContext to Context adk-python exposes ToolContext and CallbackContext from google.adk.tools.tool_context, where both names bind to the unified Context class. A TypeScript user porting a Python agent writes import {ToolContext} from '@google/adk' and gets a compile error. Bind both names to Context as plain re-exports, so a Context the framework builds satisfies a ToolContext-typed parameter. Re-export the three auth names the Python module re-exports from the same path. * docs(tools): add the ToolContext developer guide adk-python documents its guides under docs/guides/<topic>/<feature>/. adk-js had no such directory, so a reader porting a Python agent has nowhere to learn which adk-js name matches ToolContext. Add the guide and the index it needs. The unit test covers the sample. * refactor(tools): keep only the reachable part of the tool_context port The three auth re-exports could not be reached. The core package exports map is a closed allowlist with no entry for this path, and it publishes only dist, so no consumer can import them from here. All three already ship from the package root. Drop the guide tree with them. adk-js routes its documentation to adk.dev, and declaring a docs/guides convention is a package-layout decision, not part of this port.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
Python ADK exports
ToolContextandCallbackContextas aliases for the unifiedContextclass (google.adk.tools.tool_context). TypeScript ADK providesContext, but it does not exportToolContextorCallbackContext. Developers who port Python agents and importToolContextfrom@google/adkget a compile error.Solution:
Re-export
ContextasToolContextandCallbackContextincore/src/tools/tool_context.tsand from the package root. Direct class aliases allow a framework-constructedContextto satisfy aToolContextparameter in both directions. Unlike Python, this module omitsAuthHandler,AuthConfig, andAuthCredentialbecause@google/adkalready exports them at the package root.Testing Plan
Unit Tests:
npx vitest run --project unit:core core/test/tools/tool_context_test.ts(6 passed).Manual End-to-End (E2E) Tests:
Verified with a
FunctionToolwhoseexecutecallback accepts aToolContextparameter and updatesstateDelta.Checklist