https://ideaboard.app/workspace
No stickies yet. Ask an agent with WebMCP tool-calling access to "brainstorm and add ideas about <> to board."
1 tool

Imperative WebMCP API Reference

Define a tool, control its lifetime, and discover tools across origins.

Tool definition

Properties of tool in document.modelContext.registerTool(tool, options).

name
Identifies the tool. Must be unique. Letters, digits, hyphens, underscores, and dots; maximum 128 characters.
description
Describes what the tool does. Helps the agent decide when and how to use it.
inputSchema
Describes the accepted input parameters. Uses JSON Schema.
execute
Handles invocation and returns the result to the agent. Can be sync or async. Receives the input object and an options object whose signal is aborted when the invocation is canceled.
title
Provides a friendly display name for UIs. The agent still uses name for invocation.
annotations
Provides hints about tool behavior.
  • readOnlyHint: true: does not mutate state.
  • untrustedContentHint: true: output may contain untrusted content.
  • consequentialHint: true: action has significant consequences, such as making a payment.
Omitted hints default to false when an annotations object is supplied.

Input validation: Chromium does not validate inputs against inputSchema. Validate them in execute.

Registration lifetime

options.signal
Removes the tool registration when aborted. Create an AbortController and pass controller.signal to registerTool(). Call controller.abort() to unregister the tool at any time. This controls registration lifetime, not the invocation cancellation signal received by execute.

Discovery and exposure

getTools(options?)
Discovers tools available to the calling document. Returns a Promise<RegisteredTool[]>.
fromOrigins
Includes tools from the listed origins. An option for getTools(). Tools must be exposed to the calling document and are included alongside same-origin tools. An omitted or empty list returns only same-origin tools.
exposedTo
Shares a tool with the listed origins. An option for registerTool(). Allows a cross-origin iframe to expose its tool to its parent document.