v149 · Tool Registry Explorer

Tool Registry Explorer

Define tools, add parameters, and register them with navigator.modelContext. Watch the live tool registry update as an AI agent would see it — schema-complete, immediately discoverable.

Origin Trial simulation. navigator.modelContext requires an origin trial token in Chrome 149. This demo uses a faithful mock that mirrors the real API surface — register for the origin trial to use the live API.
define tool ● live
query string required
category string optional
limit number optional
agent-visible registry 0 tools
No tools registered yet.
Define a tool and click the register button.

Generated API call

// No tool registered yet

How the API works

// 1. Check API availability (requires origin trial token)
if ('modelContext' in navigator) {

  // 2. Register a tool — name, description, JSON Schema for inputs, handler
  await navigator.modelContext.registerTool({
    name: 'search_products',
    description: 'Search the product catalogue by keyword.',
    inputSchema: {
      type: 'object',
      properties: {
        query:    { type: 'string', description: 'Search keyword' },
        category: { type: 'string', description: 'Optional category filter' },
        limit:    { type: 'number', description: 'Max results (default 10)' }
      },
      required: ['query']
    },
    // Handler is called when an agent invokes the tool
    handler: async ({ query, category, limit = 10 }) => {
      const results = await db.search(query, { category, limit });
      return { products: results };
    }
  });

  // 3. Agent discovers tools via navigator.modelContext.tools (read-only)
  const tools = await navigator.modelContext.tools;
  console.log(tools); // [ { name: 'search_products', description: '...', ... } ]

}

see also

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗