Skip to content

The page's WebMCP tools cannot be used by an agent

webmcp-tools-invalidminor
On this page

Why it matters

  • WebMCP lets a page offer AI agents in the browser defined actions, such as searching products or booking an appointment, instead of the agent clicking its way through the page.
  • An agent picks a tool by its name and description, and builds its input from its schema (JSON Schema). A tool without a name is never called, one without a description never chosen, and a required parameter without a name never filled.
  • These are the errors Lighthouse 13.6's webmcp-schema-validity audit fails.

Example

Wrong
<script>
  navigator.modelContext?.registerTool({ name: 'search_products', execute: () => [] })
</script>
Right
<script>
  navigator.modelContext?.registerTool({ name: 'search_products', description: 'ابحث في منتجات المتجر', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'ما يبحث عنه الزائر' } } }, execute: () => [] })
</script>

How to fix

Give each tool a name and a description, and an input schema of type object whose properties are named:

html
<script>
  navigator.modelContext?.registerTool({
    name: 'search_products',
    description: 'Search the shop’s products by name or category',
    inputSchema: {
      type: 'object',
      properties: { query: { type: 'string', description: 'What the visitor looks for' } },
      required: ['query'],
    },
    execute: async ({ query }) => searchProducts(query),
  })
</script>

In forms: toolname and tooldescription on the <form>, and a name on each required field.

How we detect

Before the page's scripts run, in each engine (Chromium, Firefox and WebKit), we put a recorder for navigator.modelContext and document.modelContext that keeps what registerTool and provideContext are given: the name, the description and the input schema. No tool is ever called. After the load we read forms with toolname. Then we apply Lighthouse's errors: a tool without a name or description, a required parameter without a name; and add an input schema that is not an object. Each finding names the engines that saw it.