Tomasz Czajka

Agents IA

WebMCP : ce site parle aux agents IA

WebMCP est un nouveau standard du navigateur. Une page web décrit ce qu’elle sait faire sous forme d’outils, chacun avec un nom, une description et un schéma d’entrée JSON. Un agent IA dans le navigateur utilise ensuite le site via ces outils au lieu de deviner où cliquer.

Votre navigateur

Vérification…

Pour connecter un vrai agent, utilisez une version récente de Chrome et activez le flag "WebMCP for testing" dans chrome://flags.

Comment ça marche

  1. 1

    La page déclare ses outils

    Chaque fonctionnalité enregistre ses outils auprès d’Angular. Les outils du Démineur n’existent que tant que le jeu est affiché.

  2. 2

    Le navigateur les répertorie

    Le navigateur présente à l’agent les outils de la page ouverte : noms, descriptions et schémas d’entrée.

  3. 3

    L’agent appelle un outil

    L’outil appelle le même service Angular que les boutons : la page se met à jour comme si une personne avait cliqué.

Bac à sable

Appelez un outil comme le ferait un agent. Le jeu à droite est en direct, ses outils sont donc aussi actifs sur cette page.

Démineur

Difficulté

Bombes restantes 10
Drapeaux posés 0
Score 0
Progression 0 / 71
Clic gauche pour révéler une case. Clic droit pour poser un drapeau.

Journal d’activité

Chaque appel d’outil sur ce site, par un agent IA ou depuis le bac à sable. Dépliez une ligne pour voir le JSON.

  • Aucun appel d’outil pour l’instant. Lancez un outil dans le bac à sable ou laissez jouer un agent.

Catalogue d’outils

Tous les outils que ce site peut exposer, et où ils sont disponibles.

Toutes les pages

list_pages Actif Lecture seule

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

Aucune entrée

navigate_to_page Actif

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

Schéma d’entrée
{
  "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 Actif

Switches the website language and keeps the current page open.

Schéma d’entrée
{
  "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 Actif

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

Schéma d’entrée
{
  "type": "object",
  "properties": {
    "scheme": {
      "type": "string",
      "enum": [
        "light",
        "dark"
      ]
    }
  },
  "required": [
    "scheme"
  ]
}
set_seasonal_effect Actif

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

Schéma d’entrée
{
  "type": "object",
  "properties": {
    "effect": {
      "type": "string",
      "enum": [
        "auto",
        "off",
        "snow",
        "butterflies",
        "halloween"
      ]
    }
  },
  "required": [
    "effect"
  ]
}

Page Démineur

Ouvrir la page
minesweeper_get_board Actif Lecture seule

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

Aucune entrée

minesweeper_reveal_cell Actif

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

Schéma d’entrée
{
  "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 Actif

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

Schéma d’entrée
{
  "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 Actif Avec effets

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

Schéma d’entrée
{
  "type": "object",
  "properties": {
    "difficulty": {
      "type": "string",
      "enum": [
        "beginner",
        "intermediate",
        "expert",
        "custom"
      ]
    }
  }
}

Page Bot blagueur

Ouvrir la page
ask_joke_botSortie non fiable

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

Schéma d’entrée
{
  "type": "object",
  "properties": {
    "topic": {
      "type": "string",
      "description": "Topic or message for the joke bot."
    }
  },
  "required": [
    "topic"
  ]
}

Pour les développeurs

Les outils sont de simples constantes qui appellent des services Angular. L’enregistrement les lie au cycle de vie de l’application ou d’un composant.

Définir un outil

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

Enregistrer des outils pour toutes les pages

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

Enregistrer des outils pour un composant

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

Essayez-le dans la console des 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 });