Back to Blog

WebMCP Is Now Available for Early Preview: Revolutionizing AI-Web Interaction

March 2, 2026by Ichiban Team
webmcpaiweb-standardschromemcp

Hero

在这种模式下,AI Agent 不需要去猜测哪个输入框对应搜索词。元数据明确定义了 SearchArticles 这个工具,以及它所需的参数 query

#命令式 API

对于更复杂、高度动态的交互(如需要执行 JavaScript 或管理异步状态),WebMCP 提供了命令式 API。该 API 允许开发者注册自定义的 JavaScript 函数,供 Agent 直接调用。

// Example of an Imperative WebMCP Tool Registration
if ('webMCP' in navigator) {
  navigator.webMCP.registerTool({
    name: 'fetchCurrentStock',
    description: 'Fetches real-time inventory for a given product ID.',
    parameters: {
      type: 'object',
      properties: {
        productId: { type: 'string' }
      },
      required: ['productId']
    },
    execute: async (params) => {
      const response = await fetch(`/api/inventory/${params.productId}`);
      return await response.json();
    }
  });
}