Runtime Consumption Patterns
Agent runtimes consume MCP tool registries through standard patterns.
Registration Lifecycle
A page's tools are not a fixed list. What an agent may invoke depends on the route, the user's role and what is on screen, so registration is scoped to the UI that owns each action:
- Register with an
AbortSignalbelonging to the component, route or dialog - Abort it when that UI goes away — WebMCP has no
unregisterTool - Unregister an action whose control becomes disabled, hidden, inert or detached
- Register it again when the control becomes operable
See Agent Runtime for the implementation, and Visibility vs Operability for why this matters: a tool that outlives its control promises something the UI is refusing.
Discovery Pattern
- Fetch tool registry from known endpoint
- Index tools by name, entity, and action type
- Cache registry with TTL based on
generated_attimestamp
Selection Pattern
- Parse user intent
- Match against available tool descriptions
- Rank by relevance
- Select best matching tool
Invocation Pattern
- Validate parameters against
input_schema - Check preconditions from
metadata - Request confirmation if
confirmation_required— enforced on the server as well, since an agent in the page can bypass client checks - Submit approval if
approval_required - Execute tool
- Validate postconditions
- Return results
Error Handling Pattern
- Parameter validation failure → report missing/invalid parameters
- Precondition failure → report unmet preconditions
- Confirmation rejected → abort
- Rate limited → retry with backoff
- Execution failure → report error with code