Interactive examples of WebMCP tools that AI agents can call in real-time. Working demonstrations of calculator, color converter, storage, and DOM query tools.
This page demonstrates live WebMCP tools that register themselves with the browser and can be called by AI agents in real-time. Each tool showcases a different WebMCP capability.
These tools are live and ready! The WebMCP polyfill is included with this documentation site. Install the MCP-B browser extension to enable AI agents (like Claude) to discover and call these tools directly.
Demonstrates: Basic tool registration with a simple input schemaThis tool shows the fundamentals of registerTool() - a single required parameter and straightforward execution. Watch the animated result display when AI computes your expression!
Try it with your AI assistant: Ask Claude to “use the calculator tool to compute 42 * 1.5 + 10” and watch the animated result appear!
Demonstrates: Complex schemas with enum, default values, and optional parametersThis tool showcases advanced input schema features - the outputFormat parameter uses an enum for constrained choices and includes a default value. Watch the color splash animation and generated palette when AI converts your color!
Try it with your AI assistant: Ask Claude to “convert the color #FF5733 to RGB format” and watch the dramatic color visualization!
Copy
// Converts HEX colors to RGB and HSL formatsexport const ColorConverterTool = () => { useEffect(() => { const registerTool = async () => { if (!window.navigator?.modelContext) return; await window.navigator.modelContext.registerTool({ name: 'color_converter', description: 'Converts HEX colors to RGB and HSL formats. Input must be in HEX format.', inputSchema: { type: 'object', properties: { color: { type: 'string', description: 'Color in HEX format (e.g., "#3b82f6" or "3b82f6"). Must be a valid HEX color code.' }, outputFormat: { type: 'string', enum: ['rgb', 'hsl', 'all'], description: 'Desired output format (rgb, hsl, or all)', default: 'all' } }, required: ['color'] }, handler: async ({ color, outputFormat = 'all' }) => { // Conversion logic here } }); }; registerTool(); }, []);};
Demonstrates: Multiple tool registration and browser API integrationThis component registers three related tools (storage_set, storage_get, storage_list) that work together to manage browser localStorage. Watch the data flow animation as AI reads and writes to persistent storage!
Try it with your AI assistant: Ask Claude to “store my favorite color as blue, then list all stored items” and watch the data persist!
Copy
// Manages browser localStorage with set, get, and list operationsexport const StorageTool = () => { useEffect(() => { const registerTools = async () => { if (!window.navigator?.modelContext) return; // Registers multiple tools: storage_set, storage_get, storage_list await Promise.all([ window.navigator.modelContext.registerTool({ name: 'storage_set', description: 'Store a key-value pair in localStorage', // ... implementation }), window.navigator.modelContext.registerTool({ name: 'storage_get', description: 'Retrieve a value from localStorage', // ... implementation }), window.navigator.modelContext.registerTool({ name: 'storage_list', description: 'List all items in localStorage', // ... implementation }) ]); }; registerTools(); }, []);};
Demonstrates: Page introspection and structured data responsesThis tool queries the actual page DOM using CSS selectors and returns structured element information. Watch the scanning animation and see matched elements highlighted directly on the page when AI queries!
Try it with your AI assistant: Ask Claude “how many h2 headings are on this page?” and watch the elements get highlighted on screen!