Tomasz Czajka

Agenci AI

WebMCP: ta strona rozmawia z agentami AI

WebMCP to nowy standard przeglądarek. Strona opisuje, co potrafi, w postaci narzędzi: każde ma nazwę, opis i schemat wejścia w JSON. Agent AI w przeglądarce korzysta ze strony przez te narzędzia, zamiast zgadywać, gdzie kliknąć.

Twoja przeglądarka

Sprawdzam…

Aby podłączyć prawdziwego agenta, użyj aktualnego Chrome i włącz flagę „WebMCP for testing” w chrome://flags.

Jak to działa

  1. 1

    Strona deklaruje narzędzia

    Każda funkcja rejestruje swoje narzędzia w Angularze. Narzędzia sapera istnieją tylko, gdy gra jest na ekranie.

  2. 2

    Przeglądarka je udostępnia

    Przeglądarka pokazuje agentowi narzędzia otwartej strony: nazwy, opisy i schematy wejścia.

  3. 3

    Agent wywołuje narzędzie

    Narzędzie wywołuje ten sam serwis Angulara co przyciski, więc strona zmienia się tak, jakby kliknął człowiek.

Plac zabaw

Wywołaj narzędzie tak jak agent. Gra po prawej działa na żywo, więc jej narzędzia są aktywne także na tej stronie.

Saper

Poziom trudności

Pozostałe bomby 10
Ustawione flagi 0
Wynik 0
Postęp 0 / 71
Kliknij lewym przyciskiem, aby odkryć pole. Kliknij prawym, aby postawić flagę.

Dziennik wywołań

Każde wywołanie narzędzia na tej stronie, od agenta AI lub z placu zabaw. Rozwiń wiersz, aby zobaczyć JSON.

  • Brak wywołań. Uruchom narzędzie na placu zabaw albo pozwól zagrać agentowi.

Katalog narzędzi

Wszystkie narzędzia, które ta strona może udostępnić, i miejsca, gdzie są dostępne.

Każda strona

list_pages Aktywne teraz Tylko odczyt

Lists the pages of this website, the article ids, the supported languages and the page that is open now.

Bez wejścia

navigate_to_page Aktywne teraz

Opens a page of this website in the current language. For a specific article pass page "articles" and its article id.

Schemat wejścia
{
  "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 Aktywne teraz

Switches the website language and keeps the current page open.

Schemat wejścia
{
  "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 Aktywne teraz

Switches the website between the light and the dark color scheme.

Schemat wejścia
{
  "type": "object",
  "properties": {
    "scheme": {
      "type": "string",
      "enum": [
        "light",
        "dark"
      ]
    }
  },
  "required": [
    "scheme"
  ]
}
set_seasonal_effect Aktywne teraz

Sets the decorative animated overlay. "auto" picks one by date: snow in winter, butterflies in spring, halloween in October.

Schemat wejścia
{
  "type": "object",
  "properties": {
    "effect": {
      "type": "string",
      "enum": [
        "auto",
        "off",
        "snow",
        "butterflies",
        "halloween"
      ]
    }
  },
  "required": [
    "effect"
  ]
}

Strona sapera

Otwórz stronę
minesweeper_get_board Aktywne teraz Tylko odczyt

Returns the visible board, the game status and the counters. Hidden cells never reveal whether they hold a mine.

Bez wejścia

minesweeper_reveal_cell Aktywne teraz

Reveals a hidden cell, like a left click. Revealing a mine loses the game. Returns the updated board.

Schemat wejścia
{
  "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 Aktywne teraz

Toggles a flag on a hidden cell, like a right click. Returns the updated board.

Schemat wejścia
{
  "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 Aktywne teraz Ma skutki

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).

Schemat wejścia
{
  "type": "object",
  "properties": {
    "difficulty": {
      "type": "string",
      "enum": [
        "beginner",
        "intermediate",
        "expert",
        "custom"
      ]
    }
  }
}

Strona bota z żartami

Otwórz stronę
ask_joke_botNiezaufany wynik

Sends a message to the AI joke bot on this page. The message and the answer appear in the chat. Returns the joke.

Schemat wejścia
{
  "type": "object",
  "properties": {
    "topic": {
      "type": "string",
      "description": "Topic or message for the joke bot."
    }
  },
  "required": [
    "topic"
  ]
}

Dla programistów

Narzędzia to zwykłe stałe, które wywołują serwisy Angulara. Rejestracja wiąże je z cyklem życia aplikacji albo komponentu.

Definicja narzędzia

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

Rejestracja narzędzi dla każdej strony

export const appConfig: ApplicationConfig = {
  providers: [
    provideWebMcpTools('site', SITE_WEBMCP_TOOLS),
  ],
};

Rejestracja narzędzi dla jednego komponentu

export class MinesweeperComponent {
  constructor() {
    declareWebMcpTools('minesweeper', MINESWEEPER_WEBMCP_TOOLS);
  }
}

Wypróbuj w konsoli 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 });