Tomasz Czajka

ШІ-агенти

WebMCP: цей сайт розмовляє з ШІ-агентами

WebMCP — новий стандарт браузерів. Вебсторінка описує, що вміє, у вигляді інструментів: кожен має назву, опис і схему вхідних даних у JSON. ШІ-агент у браузері користується сайтом через ці інструменти, а не вгадує, куди клікнути.

Ваш браузер

Перевіряю…

Щоб під’єднати справжнього агента, скористайтеся свіжим Chrome і ввімкніть прапорець «WebMCP for testing» у chrome://flags.

Як це працює

  1. 1

    Сторінка оголошує інструменти

    Кожна функція реєструє свої інструменти в Angular. Інструменти сапера існують лише тоді, коли гра на екрані.

  2. 2

    Браузер їх показує

    Браузер показує агентові інструменти відкритої сторінки: назви, описи й схеми вхідних даних.

  3. 3

    Агент викликає інструмент

    Інструмент викликає той самий сервіс Angular, що й кнопки, тож сторінка оновлюється так, ніби клікнула людина.

Пісочниця

Викличте інструмент так, як це зробив би агент. Гра праворуч працює наживо, тому її інструменти активні й на цій сторінці.

Сапер

Складність

Залишилось бомб 10
Прапорців поставлено 0
Рахунок 0
Прогрес 0 / 71
Лівий клік відкриває клітинку. Правий клік ставить прапорець.

Журнал викликів

Кожен виклик інструмента на цьому сайті — від ШІ-агента чи з пісочниці. Розгорніть рядок, щоб побачити JSON.

  • Викликів ще немає. Запустіть інструмент у пісочниці або дайте пограти агентові.

Каталог інструментів

Усі інструменти, які може надати цей сайт, і де вони доступні.

Кожна сторінка

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),
  ],
};

Реєстрація інструментів для одного компонента

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 });