Review and update the context section documentation#701
Conversation
- Removed the "index" page from ReadonlyContext meta.json. - Updated ReadonlyContext description for clarity and conciseness. - Enhanced property descriptions in ReadonlyContext, including userContent, invocationId, agentName, appName, userId, sessionId, and state. - Streamlined examples in ReadonlyContext to focus on practical use cases. - Revised ToolContext documentation to clarify its purpose and features. - Added new properties and methods in ToolContext, including functionCallId, actions, session, sessionService, and memoryService. - Improved examples and best practices for ToolContext usage.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
There was a problem hiding this comment.
Code Review
This pull request performs a comprehensive overhaul of the ADK-TS context documentation, simplifying content and integrating visual aids like Mermaid diagrams and Fumadocs UI components. Feedback focuses on ensuring consistency in state scoping examples—specifically removing the 'session:' prefix to align with documented rules—and improving the robustness of the provided testing mocks by implementing both 'get' and 'set' methods in state proxies.
- Remove invalid session: prefix from session-scoped state keys in callback-context and invocation-context examples - Add .set() method exposure to mock state Proxy in context-patterns testing example for consistency with real State API Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Description
Full rewrite of all pages in
apps/docs/content/docs/framework/context/to match the quality standard established in the artifacts section (PR #694).API accuracy fixes:
searchMemory()return type corrected toPromise<MemorySearchResult[]>(wasSearchMemoryResponse) with proper.memory/.scoreaccessmemoryServicetype corrected toMemoryService(not deprecatedBaseMemoryService); service calls updated tomemoryService.search()(notsearchMemory())user:,app:,temp:) not dotssessionService.updateSession()ReadonlyContextproperties:appName,userId,sessionIdToolContextproperties:session,sessionService,memoryServiceAgentBuilder.withInstruction()examples corrected — acceptsstringonly; dynamic instruction examples now useLlmAgentdirectly withInstructionProviderdescriptionfield to allLlmAgentinstantiation examplesStructure changes:
"index"frommeta.jsonpages array (index page is loaded automatically)classDiagramMermaid on index page withflowchartto fix class name truncation rendering issueMermaidinvocation lifecycle diagram toinvocation-context.mdxStyle compliance:
<Card>title now has an emoji prefix<Cards>section (2–4 links)context-caching.mdxplain-text "Next steps" replaced with<Cards>componentcontext-patterns.mdxreduced from ~770 to ~200 lines — removed wrong APIs and bloated examples, kept: context selection table, state scoping, anti-patterns, Vitest mock patternRelated Issue
closes #699
Type of Change
How Has This Been Tested?
packages/adk/src/agents/andpackages/adk/src/tools/<Card>titles carry emoji prefixesmeta.jsonno longer lists"index"in the pages arrayhrefpaths point to existing pages)Checklist
Screenshots (if applicable)
N/A — documentation changes only.
Additional Notes
The
apps/examples/src/01-getting-started/index.tsfile was also restored to its original content after being inadvertently overwritten during docs authoring.