Skip to content

fix(adk): defer MCP tool discovery until invocation (v1.0.x backport) - #3602

Closed
EItanya wants to merge 1 commit into
backport/v1.0.x/06-3340from
backport/v1.0.x/07-3560
Closed

EItanya wants to merge 1 commit into
backport/v1.0.x/06-3340from
backport/v1.0.x/07-3560

Conversation

@EItanya

@EItanya EItanya commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

# Description

Slow MCP discovery can exceed router timeouts and fail agent resumes,
holding worker reservations and capacity while startup waits. Separate
classification also duplicates MCP connections and paginated listings.

This fixes it by:

- Deferring HTTP, SSE, and stdio MCP connections until invocation
preparation.
- Classifying and filtering ADK's own discovery responses before the SDK
caches
  them, preserving server TTLs and catalog notification handling.
- Omitting failed toolsets for the execution regardless of prior
discovery success,
keeping healthy tools available and retrying on later executions without
exposing
  unclassified tools.
- Serializing discovery and classification publication per toolset, with
cancellation
  support for queued invocations.
- Preserving MCP App result compaction through a single callback,
alongside rich
stored results, credentials, approvals, and tracing. Tools reclassified
as ordinary
keep their real output; removed app names remain available for
historical compaction.
- Documenting discovery, SDK caching, pagination guards, and failure
handling in
  `docs/architecture/mcp.md`.

# Change Type

```
/kind fix
```

# Testing

- Added unit coverage for zero startup requests, one paginated
discovery,
filtered SDK cache hits, TTL expiry, catalog notifications, partial
failures,
execution-scoped retries after initial and later failures, cancellation,
concurrent
  discovery, reclassification, and stdio startup.
- Added app-result coverage for cached tools, approvals, and historical
results
  after catalog removal, preserving the original rich payloads.
- Added E2E coverage for slow MCP discovery across repeated resumes and
initial
discovery failure and recovery; extended app-history E2E coverage to
verify SDK
  caching across model steps and rediscovery after restore.

# Changelog

```release-note
MCP discovery no longer delays startup or resume and caches filtered tools safely.
```

---------

Signed-off-by: Shashank Ram <shashank.ram@solo.io>
(cherry picked from commit ccb2dd3)
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
@EItanya

EItanya commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Closing: the team decided to leave release/v1.0.x as it is for stability, so neither the revert of #3586 nor the re-stacked backports will land.

Comment left by Claude on behalf of @EItanya

@EItanya EItanya closed this Nov 9, 2026
@EItanya
EItanya deleted the backport/v1.0.x/07-3560 branch November 10, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants