Skip to content

Review and update the context section documentation#701

Merged
Timonwa merged 2 commits into
mainfrom
699-review-and-update-the-adk-ts-context-section-documentation
May 15, 2026
Merged

Review and update the context section documentation#701
Timonwa merged 2 commits into
mainfrom
699-review-and-update-the-adk-ts-context-section-documentation

Conversation

@Timonwa
Copy link
Copy Markdown
Contributor

@Timonwa Timonwa commented May 14, 2026

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 to Promise<MemorySearchResult[]> (was SearchMemoryResponse) with proper .memory / .score access
  • memoryService type corrected to MemoryService (not deprecated BaseMemoryService); service calls updated to memoryService.search() (not searchMemory())
  • State prefix notation fixed throughout: colons (user:, app:, temp:) not dots
  • Removed examples calling non-existent sessionService.updateSession()
  • Added missing ReadonlyContext properties: appName, userId, sessionId
  • Added missing ToolContext properties: session, sessionService, memoryService
  • AgentBuilder.withInstruction() examples corrected — accepts string only; dynamic instruction examples now use LlmAgent directly with InstructionProvider
  • Added required description field to all LlmAgent instantiation examples

Structure changes:

  • Removed "index" from meta.json pages array (index page is loaded automatically)
  • Replaced classDiagram Mermaid on index page with flowchart to fix class name truncation rendering issue
  • Added Mermaid invocation lifecycle diagram to invocation-context.mdx

Style compliance:

  • Every <Card> title now has an emoji prefix
  • Every page ends with a Next Steps <Cards> section (2–4 links)
  • All Fumadocs components have matching imports at the top of each file
  • context-caching.mdx plain-text "Next steps" replaced with <Cards> component
  • context-patterns.mdx reduced from ~770 to ~200 lines — removed wrong APIs and bloated examples, kept: context selection table, state scoping, anti-patterns, Vitest mock pattern

Related Issue

closes #699

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring (no functional changes)
  • Tests
  • Other (please describe):

How Has This Been Tested?

  • Verified all exported symbol names, method signatures, and types against source files in packages/adk/src/agents/ and packages/adk/src/tools/
  • Confirmed all <Card> titles carry emoji prefixes
  • Confirmed every Fumadocs component used on a page has a matching import
  • Confirmed meta.json no longer lists "index" in the pages array
  • Confirmed no broken internal links (all href paths point to existing pages)

Checklist

  • My code follows the code style of this project
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • My changes generate no new warnings
  • I have checked for potential breaking changes and addressed them

Screenshots (if applicable)

N/A — documentation changes only.

Additional Notes

The apps/examples/src/01-getting-started/index.ts file was also restored to its original content after being inadvertently overwritten during docs authoring.

- 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.
@Timonwa Timonwa linked an issue May 14, 2026 that may be closed by this pull request
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
adk-typescript-docs Ready Ready Preview May 14, 2026 5:05pm
adk-web Ready Ready Preview May 14, 2026 5:05pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 14, 2026

⚠️ No Changeset found

Latest commit: dd04c13

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread apps/docs/content/docs/framework/context/callback-context.mdx Outdated
Comment thread apps/docs/content/docs/framework/context/callback-context.mdx Outdated
Comment thread apps/docs/content/docs/framework/context/invocation-context.mdx Outdated
Comment thread apps/docs/content/docs/framework/context/invocation-context.mdx Outdated
Comment thread apps/docs/content/docs/framework/context/context-patterns.mdx Outdated
- 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>
@Timonwa Timonwa merged commit 65daae6 into main May 15, 2026
4 checks passed
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.

Review and update the ADK-TS Context section documentation

2 participants