Przejdź do treści
Biblioteka skilli
AI i agenci · Budowanie i kod

webmcp-declarative-forms

/webmcp-declarative-forms

Wdraża deklaratywne API WebMCP: adnotuje formularze HTML atrybutami toolname i tooldescription do automatycznego wyodrębniania narzędzi, aby istniejące formularze obsługiwali agenci przy minimalnych zmianach kodu.

Licencja
MIT
Ostatnia zmiana repozytorium
14.09.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 14.09.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Wdraża deklaratywne API WebMCP: adnotuje formularze HTML atrybutami toolname i tooldescription do automatycznego wyodrębniania narzędzi, aby istniejące formularze obsługiwali agenci przy minimalnych zmianach kodu.

Oryginalny opis (EN)

Implement the WebMCP Declarative API — annotate HTML forms with toolname and tooldescription attributes for automatic tool extraction. Use when making existing forms agent-ready with minimal code changes.

Jak działa

  1. Before writing code
  2. Conceptual Architecture
Sekcje z nagłówków SKILL.md, w oryginale · 110 linii, 572 słów
Podgląd SKILL.md
---
name: webmcp-declarative-forms
description: Implement the WebMCP Declarative API — annotate HTML forms with toolname and tooldescription attributes for automatic tool extraction. Use when making existing forms agent-ready with minimal code changes.
allowed-tools: Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch
---

# WebMCP Declarative Forms

## Before writing code

**Fetch live docs**:
1. Fetch `https://webmachinelearning.github.io/webmcp/` for the declarative form attribute specification
2. Web-search `webmcp declarative form toolname tooldescription HTML attributes` for attribute syntax and behavior
3. Web-search `site:developer.chrome.com webmcp declarative forms` for Chrome implementation details
4. Web-search `webmcp SubmitEvent agentInvoked` for the agent submission event API

## Conceptual Architecture

### What Declarative Forms Are

The Declarative API lets developers make existing HTML forms agent-ready by adding attributes — no JavaScript required for basic cases. Chrome auto-extracts form tools and exposes them to agents.

### HTML Attributes

| Attribute | Applied To | Purpose |
|-----------|-----------|---------|
| `toolname` | `<form>` | Unique tool name (becomes the tool's `name`) |
| `tooldescription` | `<form>` | Natural-language description for the agent |
| Standard `name`, `type` | `<input>`, `<select>`, `<textarea>` | Mapped to JSON Schema properties automatically |

### How It Works

1. Developer adds `toolname` and `tooldescription` to a `<form>` element
2. Browser auto-extracts form fields into a JSON Schema (input names become properties, types are inferred)
3. The form becomes a registered tool visible to agents
4. When an agent invokes the tool, the browser fills the form fields and submits
5. A `SubmitEvent` fires with `agentInvoked` property set to `true`
6. The site can detect agent submissions and handle them accordingly

### Basic Example

```html
<form toolname="searchProducts" tooldescription="Search the product catalog by keyword and price range">
  <label>
    Search: <input name="query" type="text" required />
  </label>
  <label>
    Max Price: <input name="maxPrice" type="number" min="0" />
  </label>
  <label>
    Category:
    <select name="category">
      <option value="all">All</option>
      <option value="electronics">Electronics</option>
      <option value="clothing">Clothing</option>
    </select>
  </label>
  <button type="submit">Search</button>
</form>
```

### Detecting Agent Submissions

```js
form.addEventListener("submit", (event) => {
  if (event.agentInvoked) {
    // Agent submitted this form — handle programmatically
    event.preventDefault();
    const data = new FormData(form);
    handleAgentSearch(Object.fromEntries(data));
  }
  // Otherwise, normal user submission
});
```

### Schema Inference

The browser infers JSON Schema from form fields:
- `<input type="text">` → `{ type: "string" }`
- `<input type="number">` → `{ type: "number" }`
- `<input type="email">` → `{ type: "string", format: "email" }`
- `<input required>` → Added to `required` array
- `<select>` → `{ type: "string", enum: [...options] }`
- `<input type="checkbox">` → `{ type: "boolean" }`

### When to Use Declarative vs Imperative

| Scenario | Recommended |
|----------|-------------|
| Simple search or filter forms | Declarative |
| Legacy server-rendered pages | Declarative |
| Complex multi-step interactions | Imperative |
| Dynamic SPA with state management | Imperative |
| Quick agent enablement of existing forms | Declarative |
| Tools that need user confirmation dialogs | Imperative |
| Both simple and complex on one page | Both |

### Combining Both APIs

A page can use both declarative forms and imperative tools simultaneously:
- Simple forms get `toolname`/`tooldescription` attributes
- Complex interactions use `navigator.modelContext.registerTool()`
- Both appear in the agent's tool list together

### Best Practices

- Use descriptive `toolname` values that clearly identify the action
- Write `tooldescription` for the agent, not the user — explain what the form does and what it returns
- Ensure form field `name` attributes are semantic (`query` not `q`, `maxPrice` not `mp`)
- Handle `agentInvoked` submissions gracefully — return structured data, not HTML redirects
- Test with agents to verify the auto-inferred schema matches expectations
- Add `required` attributes to mandatory fields so the schema reflects them

Fetch the specification for exact attribute names, SubmitEvent properties, and schema inference rules before implementing.

Wersje

W bazie nie ma innych skilli o nazwie webmcp-declarative-forms.

Migawka bazy z 13.11.2026 · wersja paczki bcbcbeb91823 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100webmcp
    Przygotowuje stronę do użycia przez agentów AI w przeglądarce: planuje ścieżki użytkownika i wdraża je przez document.modelContext.
  • 100webmcp-context-provider
    Wdraża API provideContext z WebMCP: zbiorczą rejestrację narzędzi, metadane kontekstowe, współdzielenie stanu strony i dynamiczne aktualizacje kontekstu dla agentów.
  • 100webmcpx
    Dodaje do strony narzędzia WebMCP, aby agenty AI mogły z niej korzystać, i sprawdza definicje narzędzi.
  • 100webmcp-gen
    Buduje i waliduje eksperymentalne narzędzia WebMCP dla istniejącej strony: udostępnia prawdziwe przepływy witryny jako narzędzia strony, tworzy webmcp.init.js i porównuje WebMCP z automatyzacją drzewa dostępności.
  • 85webmcp
    Tworzy narzędzia WebMCP działające na stronie, czyli funkcje JavaScript lub narzędzia HTML wystawiające MCP w przeglądarce.
  • 100webmcp-setup
    Konfiguruje projekt WebMCP: włącza flagi Chrome, instaluje polyfill MCP-B, tworzy szkielet rejestracji narzędzi i przygotowuje środowisko deweloperskie przy starcie nowej witryny z WebMCP.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.