お使いのブラウザ
確認中…
実際のエージェントを接続するには、最新のChromeを使い、chrome://flagsで「WebMCP for testing」フラグを有効にしてください。
AIエージェント
WebMCPは新しいブラウザ標準です。Webページは自分にできることを「ツール」として記述し、各ツールには名前、説明、JSONの入力スキーマがあります。ブラウザ内のAIエージェントは、どこをクリックすべきか推測する代わりに、そのツールを通じてサイトを操作します。
確認中…
実際のエージェントを接続するには、最新のChromeを使い、chrome://flagsで「WebMCP for testing」フラグを有効にしてください。
ページがツールを宣言する
各機能がAngularにツールを登録します。マインスイーパーのツールは、ゲームが画面に表示されている間だけ存在します。
ブラウザがツールを一覧にする
ブラウザは、開いているページのツール(名前、説明、入力スキーマ)をエージェントに示します。
エージェントがツールを呼び出す
ツールはボタンと同じAngularサービスを呼び出すので、人がクリックしたときと同じようにページが更新されます。
エージェントと同じ方法でツールを呼び出してみましょう。右側のゲームは実際に動いているので、そのツールもこのページで有効になっています。
難易度
AIエージェントやプレイグラウンドから、このサイトで行われたすべてのツール呼び出し。行を展開するとJSONを確認できます。
このWebサイトが公開できるすべてのツールと、それぞれが利用できる場所。
list_pages 現在有効 読み取り専用Lists the pages of this website, the article ids, the supported languages and the page that is open now.
入力なし
navigate_to_page 現在有効 Opens a page of this website in the current language. For a specific article pass page "articles" and its article id.
{
"type": "object",
"properties": {
"page": {
"type": "string",
"enum": [
"home",
"games",
"minesweeper",
"chess",
"mill",
"abalone",
"articles",
"joker",
"webmcp",
"contact",
"links"
],
"description": "Page to open."
},
"article": {
"type": "string",
"enum": [
"resource-sandbox",
"birds",
"r2r-vs-ros2"
],
"description": "Optional article id, only with page \"articles\"."
}
},
"required": [
"page"
]
}set_language 現在有効 Switches the website language and keeps the current page open.
{
"type": "object",
"properties": {
"language": {
"type": "string",
"enum": [
"pl",
"en",
"de",
"fr",
"es",
"it",
"pt",
"uk",
"no",
"sv",
"zh",
"ja",
"hi"
],
"description": "pl=Polish, en=English, de=German, fr=French, es=Spanish, it=Italian, pt=Portuguese (Brazil), uk=Ukrainian, no=Norwegian, sv=Swedish, zh=Chinese, ja=Japanese, hi=Hindi."
}
},
"required": [
"language"
]
}set_color_scheme 現在有効 Switches the website between the light and the dark color scheme.
{
"type": "object",
"properties": {
"scheme": {
"type": "string",
"enum": [
"light",
"dark"
]
}
},
"required": [
"scheme"
]
}set_seasonal_effect 現在有効 Sets the decorative animated overlay. "auto" picks one by date: snow in winter, butterflies in spring, halloween in October.
{
"type": "object",
"properties": {
"effect": {
"type": "string",
"enum": [
"auto",
"off",
"snow",
"butterflies",
"halloween"
]
}
},
"required": [
"effect"
]
}minesweeper_get_board 現在有効 読み取り専用Returns the visible board, the game status and the counters. Hidden cells never reveal whether they hold a mine.
入力なし
minesweeper_reveal_cell 現在有効 Reveals a hidden cell, like a left click. Revealing a mine loses the game. Returns the updated board.
{
"type": "object",
"properties": {
"row": {
"type": "integer",
"minimum": 0,
"maximum": 23,
"description": "0-based row, top to bottom."
},
"col": {
"type": "integer",
"minimum": 0,
"maximum": 29,
"description": "0-based column, left to right."
}
},
"required": [
"row",
"col"
]
}minesweeper_toggle_flag 現在有効 Toggles a flag on a hidden cell, like a right click. Returns the updated board.
{
"type": "object",
"properties": {
"row": {
"type": "integer",
"minimum": 0,
"maximum": 23,
"description": "0-based row, top to bottom."
},
"col": {
"type": "integer",
"minimum": 0,
"maximum": 29,
"description": "0-based column, left to right."
}
},
"required": [
"row",
"col"
]
}minesweeper_new_game 現在有効 副作用ありDiscards the current game and starts a new one. Optionally switches the difficulty: beginner (9×9, 10 mines), intermediate (16×16, 40 mines), expert (16 rows × 30 columns, 99 mines) or custom (the last custom size).
{
"type": "object",
"properties": {
"difficulty": {
"type": "string",
"enum": [
"beginner",
"intermediate",
"expert",
"custom"
]
}
}
}ask_joke_bot信頼できない出力Sends a message to the AI joke bot on this page. The message and the answer appear in the chat. Returns the joke.
{
"type": "object",
"properties": {
"topic": {
"type": "string",
"description": "Topic or message for the joke bot."
}
},
"required": [
"topic"
]
}ツールはAngularサービスを呼び出すただの定数です。登録によって、アプリまたはコンポーネントのライフタイムに紐づけられます。
ツールを定義する
export const SET_COLOR_SCHEME = defineWebMcpTool({
name: 'set_color_scheme',
description: 'Switches the website between the light and the dark color scheme.',
inputSchema: {
type: 'object',
properties: { scheme: { type: 'string', enum: ['light', 'dark'] } },
required: ['scheme'],
},
execute: (input) => {
inject(ColorSchemeService).setScheme(input.scheme);
return `Color scheme set to ${input.scheme}.`;
},
});全ページ向けにツールを登録する
export const appConfig: ApplicationConfig = {
providers: [
provideWebMcpTools('site', SITE_WEBMCP_TOOLS),
],
};1つのコンポーネント向けにツールを登録する
export class MinesweeperComponent {
constructor() {
declareWebMcpTools('minesweeper', MINESWEEPER_WEBMCP_TOOLS);
}
}DevToolsのコンソールで試す
const tools = await document.modelContext.getTools();
tools.map((tool) => tool.name);
const reveal = tools.find((tool) => tool.name === 'minesweeper_reveal_cell');
await document.modelContext.executeTool(reveal, { row: 4, col: 4 });