DEV Community

Cover image for WebMCP in Practice - Build a WebMCP Tool with a Coding-Agent Skill
Luca Del Puppo for Playful Programming

Posted on Originally published at blog.delpuppo.net on

WebMCP in Practice - Build a WebMCP Tool with a Coding-Agent Skill

“Archive the completed DevDesk tasks.” Before anything disappears from the board, I want to see which cards will move. And if the board changes while I’m reading that list, I want a fresh review before I confirm.

We’ll use that request to walk through Chrome’s build-webmcp-tools skill. It gives a coding agent guidance for designing, implementing, and auditing WebMCP tools. The coding agent works on the DevDesk source. Later, a browser agent calls the tool that DevDesk exposes.

Install the skill in your project

Start from Part 05 if you want to build the feature yourself. The board already has shared state, two imperative tools, and tests you can build on. Use Node.js 26 or later.

git clone https://github.com/Puppo/webmcp-in-practice.git
cd webmcp-in-practice
git switch part-05-agent-evaluations
git switch -c archive-with-webmcp-skill
npm ci

npx skills add https://github.com/GoogleChromeLabs/webmcp-tools \
  --path webmcp-skills --skill build-webmcp-tools --agent antigravity --yes

Enter fullscreen mode Exit fullscreen mode

The last command uses the Vercel Labs Skills CLI to install Chrome’s build-webmcp-tools skill and its reference files in this project’s .agents/skills directory. Open the DevDesk checkout in Antigravity and start a new session so it can discover the skill. If you use another coding agent, change --agent antigravity to its supported name. Skills CLI · Chrome’s WebMCP skills installation guide

Design the confirmation before writing code

The skill supports different starting points, including designing one tool and implementing an approved design. Here the goal is already clear, so start with the archive workflow and ask for the design first. This is a prompt you can use:

Use the build-webmcp-tools skill to design one imperative tool for DevDesk. Inspect the current board state, tool registration, and storage code before proposing changes. The user wants to archive completed tasks, optionally for one project. Show exactly which cards would move and wait for the user to confirm in the page. Walk through success, cancellation, and a board change during review. Return a proposed input schema and acceptance checks before editing files.

Read the proposed flow as if you were using the app. When someone asks to archive the Design System tasks, the agent can supply the project name, and the page can identify the completed cards. The person still decides whether those exact cards should move. That decision belongs in the dialog. A confirmed input would let the caller supply the decision itself.

Situation Expected behavior
Completed tasks match the project Show their IDs, titles, and projects. Leave the board unchanged while review is open.
Nothing matches Return a no-change result and skip the dialog.
The user confirms Move only the reviewed cards and report whether the save succeeded.
The user cancels or the request ends Leave the active tasks and archive as they were.
The board changes during review Return STALE_PREVIEW and ask for a fresh review.

Turn the approved design into code

Once the flow looks right, give the coding agent an implementation request:

Implement the approved archive flow in the existing TypeScript app using the build-webmcp-tools skill. Register archive_completed_tasks with an optional string project and reuse the current registration and board update paths. Connect it to a page dialog. Save only after confirmation and reject a stale preview. Preserve existing saved boards. Add tests that check active tasks and archived tasks before and after each outcome. Run npm test and npm run build, then show me where confirmation is enforced.

The skill gives the agent a place to check the tool schema, description, and response behavior. The app supplies the feature rules. In the reference implementation, the tool adapter validates the optional project and waits for the review controller. The controller keeps the operation pending while the dialog is open. The confirm handler checks the revision and calls the board’s save path.

When you review the patch, follow that call chain. Look for a write before confirmation, a second route that can skip the dialog, or a fresh query on confirm that might pull in cards the user never saw. Ask the coding agent to audit those paths against the acceptance checks, then read the diff yourself. If your browser supports WebMCP, use Chrome DevTools’ Application → WebMCP panel to inspect the tool and try the project filter. Chrome’s WebMCP debugging guide

Run the reference implementation

Use a separate checkout to compare your patch with the completed Part 06 example. Part 06 demo

git clone https://github.com/Puppo/webmcp-in-practice.git
cd webmcp-in-practice
git checkout part-06-coding-agent-skills
npm ci
npm test
npm run dev

Enter fullscreen mode Exit fullscreen mode

Open the URL printed by Vite. For the interactive archive exercise, you’ll need a browser and inspector or agent that can discover and invoke the native imperative tool. The automated tests cover the review logic with test doubles, including simulated dialog events. Native browser-agent execution has not been verified for this checkpoint. Chrome’s imperative WebMCP guide · Archive review tests

Review the tasks before moving them

On a reset board, move DD-104, the Design System release notes, to Done. Then call archive_completed_tasks with { "project": "Design System" }. The dialog should list that task, with its ID, title, and project. Completed tasks from other projects stay out of that review. Omitting project includes all completed tasks.

Select Cancel the first time and check that the card stays in Done. Invoke the tool again and select Archive these tasks. The card should move to the read-only archive below the board. The task is still there if you need to read it. The tool’s input has no confirmation argument. The app waits for the dialog’s confirm action before it applies the move. Tool definition · Dialog markup

Archive review dialog listing DD-104 with Cancel and Archive these tasks buttons

The dialog shows the exact task before confirmation. The screenshot was captured after calling the registered tool in Chrome Canary.

Apply the reviewed snapshot

When the dialog opens, DevDesk captures the eligible task records and the board’s revision. Every update through the board state increments that revision. The confirm handler checks it before applying the archive. Archive operations · Board state

export function applyArchive(
  preview: ReturnType<typeof prepareArchive>,
  currentRevision: number,
  tasks: readonly Task[],
  archived: readonly Task[],
) {
  if (preview.revision !== currentRevision) {
    return { ok: false as const, code: 'STALE_PREVIEW' }
  }
  const ids = new Set(preview.tasks.map(task => task.id))
  return {
    ok: true as const,
    tasks: tasks.filter(task => !ids.has(task.id)),
    archived: [...archived, ...preview.tasks],
  }
}

Enter fullscreen mode Exit fullscreen mode

If the revision differs, the operation returns STALE_PREVIEW and asks for a new review. If it matches, the app moves only the reviewed IDs. Cancel , Escape, an invocation abort, or the two-minute timeout ends a pending review without moving anything. The dialog blocks ordinary interaction with the board behind it. The stale-review test simulates a state change by advancing the revision before confirming. The revision belongs to the current page, so this check covers state changes in that page. Review controller

DevDesk saves active and archived tasks together under a version 2 storage key and reports persisted after a move. When the new key is absent, it can load the old board with an empty archive. The next save writes the new snapshot and leaves the original intact. Earlier checkpoints still read their original snapshot. The storage tests cover this migration, archive reload, and duplicate IDs across the two collections. Archive storage · Storage tests

Check the result

A successful tool response is only part of the check. In the archive review tests, the archive starts empty, stays empty while review is pending, and contains DD-104 after confirmation. The cancellation and stale-review tests also check that DD-104 is still on the active board. Those assertions catch a patch that returns the right response while changing the wrong state. Part 05 — Test Agent Outcomes, Not Just Tool Calls

The reference branch carries forward Part 05’s local evaluations and live simulations and adds archive_completed_tasks to the static tool catalog. The inherited cases still exercise the earlier board workflows. Use the archive review tests above to check confirmation and cancellation. Reference evaluation guide

If you want to measure what the skill adds, repeat the exercise in two clean checkouts from the same Part 05 revision. Keep the prompt, model, and checks fixed, and give only one session access to the skill. Compare the diffs, the outcomes, and the corrections each patch needed. The demo is a reference implementation for this walkthrough. A controlled comparison is still to run.

Top comments (0)