Tomasz Czajka

Agentes de IA

WebMCP: este sitio habla con agentes de IA

WebMCP es un nuevo estándar de los navegadores. Una página describe lo que puede hacer como herramientas, cada una con un nombre, una descripción y un esquema de entrada JSON. Un agente de IA en el navegador usa el sitio a través de esas herramientas en lugar de adivinar dónde hacer clic.

Tu navegador

Comprobando…

Para conectar un agente real, usa un Chrome reciente y activa la opción «WebMCP for testing» en chrome://flags.

Cómo funciona

  1. 1

    La página declara herramientas

    Cada función registra sus herramientas en Angular. Las del buscaminas solo existen mientras el juego está en pantalla.

  2. 2

    El navegador las muestra

    El navegador muestra al agente las herramientas de la página abierta: nombres, descripciones y esquemas de entrada.

  3. 3

    El agente llama a una herramienta

    La herramienta llama al mismo servicio de Angular que los botones, así que la página cambia como si alguien hubiera hecho clic.

Zona de pruebas

Llama a una herramienta como lo haría un agente. El juego de la derecha funciona en vivo, así que sus herramientas también están activas aquí.

Buscaminas

Dificultad

Bombas restantes 10
Banderas colocadas 0
Puntuación 0
Progreso 0 / 71
Clic izquierdo para revelar una celda. Clic derecho para colocar una bandera.

Registro de actividad

Cada llamada a una herramienta en este sitio, de un agente de IA o de la zona de pruebas. Despliega una fila para ver el JSON.

  • Aún no hay llamadas. Ejecuta una herramienta en la zona de pruebas o deja que juegue un agente.

Catálogo de herramientas

Todas las herramientas que este sitio puede ofrecer y dónde están disponibles.

Todas las páginas

list_pages Activa ahora Solo lectura

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

Sin entrada

navigate_to_page Activa ahora

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

Esquema de entrada
{
  "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 Activa ahora

Switches the website language and keeps the current page open.

Esquema de entrada
{
  "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 Activa ahora

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

Esquema de entrada
{
  "type": "object",
  "properties": {
    "scheme": {
      "type": "string",
      "enum": [
        "light",
        "dark"
      ]
    }
  },
  "required": [
    "scheme"
  ]
}
set_seasonal_effect Activa ahora

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

Esquema de entrada
{
  "type": "object",
  "properties": {
    "effect": {
      "type": "string",
      "enum": [
        "auto",
        "off",
        "snow",
        "butterflies",
        "halloween"
      ]
    }
  },
  "required": [
    "effect"
  ]
}

Página del buscaminas

Abrir página
minesweeper_get_board Activa ahora Solo lectura

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

Sin entrada

minesweeper_reveal_cell Activa ahora

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

Esquema de entrada
{
  "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 Activa ahora

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

Esquema de entrada
{
  "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 Activa ahora Con consecuencias

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

Esquema de entrada
{
  "type": "object",
  "properties": {
    "difficulty": {
      "type": "string",
      "enum": [
        "beginner",
        "intermediate",
        "expert",
        "custom"
      ]
    }
  }
}

Página del bot de chistes

Abrir página
ask_joke_botSalida no fiable

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

Esquema de entrada
{
  "type": "object",
  "properties": {
    "topic": {
      "type": "string",
      "description": "Topic or message for the joke bot."
    }
  },
  "required": [
    "topic"
  ]
}

Para desarrolladores

Las herramientas son constantes simples que llaman a servicios de Angular. El registro las vincula al ciclo de vida de la app o de un componente.

Definir una herramienta

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

Registrar herramientas para todas las páginas

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

Registrar herramientas para un componente

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

Pruébalo en la consola de 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 });