The principle: If you give a model 100 tools when only 5 are relevant, performance suffers. Think of it like giving someone an entire Home Depot when they just need a saw, hammer, and nails.
Why Context Matters
When AI agents have access to many tools:- Decision quality decreases - More options means more potential for wrong choices
- Token usage increases - Tool definitions consume context window
- Response latency grows - More tools to evaluate before acting
- Error rates climb - Irrelevant tools create confusion
URL-Based Tool Scoping
Expose different tools based on the current URL path:Progressive Tool Disclosure
Reveal tools as the user progresses through a workflow: Each stage only shows tools relevant to that step, reducing cognitive load on the AI model.Role-Based Tool Exposure
Different tools for different user roles:Feature Flag-Based Tools
Control tool availability with feature flags:Component Lifecycle Scoping
Tools automatically register when components mount and unregister when they unmount:The WebMCP Advantage
Unlike browser automation approaches, WebMCP lets you design context-aware tool exposure: Just as websites don’t put all content on one page, you can scope tools to different pages in your app, creating a natural progressive disclosure pattern for AI.Best Practices
Start with minimal tools
Start with minimal tools
Begin with the smallest set of tools needed for the current context. Add more only as the workflow progresses.
Use the enabled prop
Use the enabled prop
The
enabled prop on useWebMCP lets you conditionally register tools based on state without conditional hooks.Consider multi-tab scenarios
Consider multi-tab scenarios
When users have multiple tabs open, the extension aggregates tools from all tabs. Use clear naming to avoid confusion.
Related Topics
Dynamic Tool Registration
Implementation patterns for dynamic tools
Multi-Tab Tool Collection
How tools work across browser tabs
Why WebMCP?
Understanding the WebMCP approach
Best Practices
Complete tool development guide
