AgentContext
. Use the context API to request the latest tool list on each invocation:
Tool discovery overview
AgentContext.current().get_tools()
returns an ordered list of tool definitions ready for use by your agent framework. The runtime combines two sources:
- Static tools that you register with your agent package or configure through deployment metadata.
- Managed Model Context Protocol (MCP) tools supplied by the StreamNative cloud console and connected MCP servers.
Use tools in agent code
Invokeget_tools()
inside the handler that constructs your agent rather than caching results at import time. This ensures each invocation sees the current configuration and any MCP updates.
Dynamic updates with the model context protocol
Orca Engine maintains long-lived Server-Sent Events (SSE) streams to each registered MCP server. These notifications power two capabilities:- Dynamic tool discovery: When an MCP server adds, removes, or updates a tool, the runtime refreshes its catalog and the next call to
get_tools()
reflects the change—no redeployment required. - Real-time MCP messages: SSE messages surface remote events so your agent can react to live signals, such as tool hot reloads or targeted prompts from connected systems.
get_tools()
return the latest tools and that long-lived sessions see the updated capabilities.
Because MCP updates arrive asynchronously, call get_tools()
within the request scope or immediately before you instantiate the agent. Avoid storing the returned list in module-level variables.
Best practices
- Request
AgentContext.current().get_tools()
inside the invocation flow to pick up runtime changes. - Use descriptive names and function comments for static tools so large-language-model-based agents can choose them accurately.
- Coordinate session strategy with your tooling approach—combine this page with Agent Context for state, metrics, and session controls.
- When testing locally, inject a mock context that provides representative tool lists before importing modules that expect runtime tools.