How do I move LlamaIndex Montage tool use into the HTTP client lifetime?
LlamaIndex discovery helpers can make remote tools look like ordinary reusable objects. Review when the underlying BasicMCPClient or custom session is active, ensuring execution happens inside the documented lifecycle rather than after cleanup has invalidated the connection. Review which component owns the BasicMCPClient or custom session before retaining discovered tools. Notebook layout and helper return values can obscure cleanup, so test execution at the point where the application genuinely needs the remote connection.
Help me move LlamaIndex Montage tool use into the HTTP client lifetime. Locate where the HTTP client is created and where the application stores discovered tools. Read the actual response and release resources through the supported path. No writes.Trace resource ownership
Locate where the HTTP client is created and where the application stores discovered tools. Check whether those tools rely on a session that has already been released before use. The ownership map should distinguish discovery-time objects from the client resources they need, especially where a notebook cell or helper returns before execution.
Consult the matching client contract
Use the installed BasicMCPClient integration reference for HTTP support and resource ownership. Do not infer a lifetime from notebook layout or another package’s context-manager example. Notebook layout is not a resource contract; the official installed client reference determines whether a session remains usable after a helper or cell finishes.
Keep the hosted transport intact
Retain Montage’s Streamable HTTP endpoint during the lifetime investigation. Switching to a local stdio sample changes the test and does not explain why a remote client closed prematurely. Keeping transport unchanged lets the test isolate lifetime rather than introducing a local subprocess that has different initialization, auth and cleanup behavior.
Test the execution point directly
Call signals_status through the intended active client without a retrieval model or agent loop. Keep connection closure errors separate from server permission rejections and missing workspace data. The direct call should happen where application code really needs it, not only in a setup cell that precedes the problematic close boundary.
Verify result before cleanup
Read the actual response and release resources through the supported path. Discovery at an earlier notebook cell is not equivalent evidence that later tool execution remains valid after the client lifetime ends. A completed metadata cell and a later real workspace response are different artifacts; retain both stages if execution remains blocked after discovery succeeds.
Keep the boundaries clear.
- Keeping transport unchanged lets the test isolate lifetime rather than introducing a local subprocess that has different initialization, auth and cleanup behavior.
- A completed metadata cell and a later real workspace response are different artifacts; retain both stages if execution remains blocked after discovery succeeds.
Start with a read-only check: ask your agent to report actual source coverage before collecting records or exporting an audience.
Primary references
Documentation reviewed 2026-11-15. Product capabilities, client availability and plans can change. Third-party marks identify their products, not an affiliation.