---
title: "Add custom WebMCP tools"
method: POST
path: "/webmcp/custom-tools"
---

# Add custom WebMCP tools

`POST /webmcp/custom-tools`

Add a namespaced batch of custom tools. A custom tool can be page-backed or CDP-backed.
Page-backed tools execute in the page via JavaScript. CDP-backed tools execute via CDP and
can use all browser REPL tools (see `/repl`). The source must evaluate to a non-empty array
of definitions with URL matchers, tool metadata (including an optional output schema), and
execute functions. The batch is added atomically. Matchers apply to top-level documents and
nested frames, including out-of-process iframes; each matching tool is exposed once on the
tab's top-level document and appears in `GET /webmcp/tools`.

To update one tool, list the tools, delete its ID, and add its replacement. Set
force_overwrite_namespace to replace every existing tool in the namespace atomically;
omitted or false adds tools without replacing existing ones. Existing invocations continue.

## Request body

- AddCustomWebMCPToolsRequest
  - `namespace` string, required
  - `source` string, required — JavaScript expression that evaluates to a non-empty array of custom tool definitions.
  - `force_overwrite_namespace` boolean — Atomically replace all existing tools in this namespace with this batch when true.

## Response `201`

Custom tools added. The response contains only the newly added tools.

- CustomWebMCPToolsResponse
  - `tools` CustomWebMCPDefinition[], required
    - `id` string, required
    - `namespace` string, required
    - `kind` string, required
    - `match` CustomWebMCPMatch, required
      - `url_patterns` string[], required
    - `tool` WebMCPToolMetadata, required — Tool metadata follows the [MCP Tool definition](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool) and the [WebMCP RegisteredTool definition](https://webmachinelearning.github.io/webmcp/#dictdef-registeredtool). outputSchema is optional for page and custom tools.
      - `name` string, required
      - `title` string
      - `description` string, required
      - `inputSchema` object, required
      - `outputSchema` object
      - `annotations` WebMCPToolAnnotations — Tool-provided behavioral hints from the [MCP tool specification](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool) and the [WebMCP ToolAnnotations definition](https://webmachinelearning.github.io/webmcp/#dictdef-toolannotations). These hints are untrusted and are not enforced by Kernel.
        - `readOnlyHint` boolean
        - `destructiveHint` boolean
        - `idempotentHint` boolean
        - `openWorldHint` boolean
        - `consequentialHint` boolean
        - `untrustedContentHint` boolean
        - `autosubmit` boolean

## Other responses

- `400` — Bad Request
- `409` — Conflict
- `500` — Internal Server Error

## Changes

- **2026-09-23** `20deed4d1ac2` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/kernel/apis/kernel-images-api/changes/webmcp/custom-tools/post.md)

---

[API](https://skmtc.dev/kernel/apis/kernel-images-api.md) · [All operations](https://skmtc.dev/kernel/apis/kernel-images-api/llms.txt) · [OpenAPI document](https://skmtc.dev/kernel/apis/kernel-images-api/revisions/a1c46fb41d0f?raw)
