From 77553aa5a5de241518ec2dff92212067d13da248 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Thu, 5 Feb 2026 11:05:53 -0500 Subject: [PATCH] Start draft on declarative explainer --- declarative-api-explainer.md | 120 +++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 declarative-api-explainer.md diff --git a/declarative-api-explainer.md b/declarative-api-explainer.md new file mode 100644 index 0000000..4b528d5 --- /dev/null +++ b/declarative-api-explainer.md @@ -0,0 +1,120 @@ +# WebMCP declarative API + +See discussion in https://github.com/webmachinelearning/webmcp/issues/22 that led to the creation of +this proposal. + +## Motivation + +WebMCP lets developers expose intricate functionality backed by a website's JavaScript functions to +an agent as "tools", effectively turning the site into an "MCP server". Agents can see the list of +tools a site offers paired with natural language descriptions of what the tools do, and invoke them +with structured data. + +With WebMCP, agents can perform complex actions like booking a flight or reserving a table by +hooking into a site's own code designed to perform those actions, instead of the agent having to +figure it out manually through a brittle series of screen shots, scrolls, and out-of-date screen +reads. + +However, not all site functionality is exposed via JavaScript functions, and features that *are* +take some effort to rewrite with an agent invoker in mind. Much of a site's functionality is +provided via semantic HTML elements like `
`, and its various inputs. To **make it easier** for +developers to expose this kind of site functionality while still using thte semantic web, we +propose: + +1. New attributes that augment ``s and [form-associated + elements](https://html.spec.whatwg.org/#form-associated-element), that expose these as WebMCP + tools to agents. +2. Algorithms that deterministically "compile" a form and its associated inputs down to a WebMCP + "input schema", so that the agent knows how to fill out the form and submit it. +3. Two ways of getting a form response back to the agent that invoked the form tool: + 1. `SubmitEvent#respondWith()`, which lets JavaScript on the page override the default form + action, and pipe a response back to the agent without navigating the page. + 2. Extracting `