refactor(tools): auto-compact WASM tool schemas, add descriptions, improve credential prompts (#1525)

* fix(tools): add missing description, parameters, and improve credential prompts

Silence three categories of startup warnings emitted by
CapabilitiesFile::validate() and WasmToolLoader:

1. "description" field missing → add tool descriptions to all manifests
2. "parameters" field missing → add action-enum parameter schemas
3. Short credential prompts (<30 chars) → append source URLs

Affects: github, gmail, google-calendar, google-docs, google-drive,
google-sheets, google-slides, slack, telegram, llm-context, feishu.

[skip-regression-check]

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* refactor(tools): auto-compact WASM tool schemas from module exports

Replace the manual `parameters` field in capabilities JSON with automatic
schema compaction. WasmToolSchemas::compact_schema() derives a compact
advertised schema from the WASM module's schema() export by keeping only
required and enum-constrained properties. The full schema remains
available via tool_info(detail: "schema").

This eliminates:
- The `parameters` field from CapabilitiesFile and all 11 sidecar JSONs
- The "missing parameters" startup warning from the loader
- Manual maintenance of duplicate schema data

The `description` field in capabilities JSON is retained.

[skip-regression-check]

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* fix(tests): remove cap_file.parameters reference in test_rig

The parameters field was removed from CapabilitiesFile in the previous
commit. Update test_rig.rs to match — schema is now auto-compacted from
the WASM module export, no sidecar override needed.

[skip-regression-check]

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* fix(tools): handle oneOf schemas in compact_schema, add tool name to warning

Address PR review feedback:
- compact_schema now collects properties from oneOf/anyOf/allOf variants,
  fixing GitHub-style schemas that have no top-level properties
- Use HashSet for required lookup instead of Vec::contains
- Add tool name to "Capabilities file not found" warning for consistency

[skip-regression-check]

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* fix(tools): merge oneOf const values into enum, cap property collection

Address review feedback from @serrrfirat:

1. Merge const values across oneOf variants into a single enum array,
   so the LLM sees all valid actions (not just the first variant's const).
2. Cap property collection at 100 to bound allocations.
3. Also keep properties with const constraint (single-variant case).
4. Update doc comment to describe variant collection and design choices
   around variant-level required fields.

[skip-regression-check]

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
Illia Polosukhin
2026-03-23 21:59:14 -07:00
committed by GitHub
co-authored by Claude Opus 4.6
parent b441ebec02
commit 3fdb187796
16 changed files with 322 additions and 256 deletions
@@ -1,6 +1,7 @@
{
"version": "0.2.1",
"wit_version": "0.3.0",
"description": "Manage GitHub repositories, issues, pull requests, reviews, and workflows. Supports listing, creating, commenting, merging PRs, and triggering GitHub Actions.",
"capabilities": {
"webhook": {
"hmac_secret_name": "github_webhook_secret",
+2 -1
View File
@@ -1,6 +1,7 @@
{
"version": "0.2.0",
"wit_version": "0.3.0",
"description": "Read, search, send, draft, and reply to emails via Gmail. Supports Gmail search query syntax (is:unread, from:, subject:, after:, etc.).",
"http": {
"allowlist": [
{
@@ -53,7 +54,7 @@
},
{
"name": "google_oauth_client_secret",
"prompt": "Google OAuth Client Secret"
"prompt": "Google OAuth Client Secret (from console.cloud.google.com/apis/credentials)"
}
]
}
@@ -1,6 +1,7 @@
{
"version": "0.2.0",
"wit_version": "0.3.0",
"description": "View, create, update, and delete Google Calendar events. Supports timed events, all-day events, attendees, locations, and free text search.",
"http": {
"allowlist": [
{
@@ -52,7 +53,7 @@
},
{
"name": "google_oauth_client_secret",
"prompt": "Google OAuth Client Secret"
"prompt": "Google OAuth Client Secret (from console.cloud.google.com/apis/credentials)"
}
]
}
@@ -1,6 +1,7 @@
{
"version": "0.2.0",
"wit_version": "0.3.0",
"description": "Create, read, edit, and format Google Docs documents. Supports text insert/delete/replace, formatting (bold, italic, font, color, size), paragraph styling, tables, and lists.",
"http": {
"allowlist": [
{
@@ -52,7 +53,7 @@
},
{
"name": "google_oauth_client_secret",
"prompt": "Google OAuth Client Secret"
"prompt": "Google OAuth Client Secret (from console.cloud.google.com/apis/credentials)"
}
]
}
@@ -1,6 +1,7 @@
{
"version": "0.2.0",
"wit_version": "0.3.0",
"description": "Search, access, upload, share, and organize files and folders in Google Drive. Supports personal drives and shared (organizational) drives.",
"http": {
"allowlist": [
{
@@ -57,7 +58,7 @@
},
{
"name": "google_oauth_client_secret",
"prompt": "Google OAuth Client Secret"
"prompt": "Google OAuth Client Secret (from console.cloud.google.com/apis/credentials)"
}
]
}
@@ -1,6 +1,7 @@
{
"version": "0.2.0",
"wit_version": "0.3.0",
"description": "Create, read, write, and format Google Sheets spreadsheets. Supports cell operations using A1 notation, sheet (tab) management, and cell formatting.",
"http": {
"allowlist": [
{
@@ -52,7 +53,7 @@
},
{
"name": "google_oauth_client_secret",
"prompt": "Google OAuth Client Secret"
"prompt": "Google OAuth Client Secret (from console.cloud.google.com/apis/credentials)"
}
]
}
@@ -1,6 +1,7 @@
{
"version": "0.2.0",
"wit_version": "0.3.0",
"description": "Create, read, edit, and format Google Slides presentations. Supports slide management, text operations, shapes, images, text formatting, and paragraph alignment.",
"http": {
"allowlist": [
{
@@ -52,7 +53,7 @@
},
{
"name": "google_oauth_client_secret",
"prompt": "Google OAuth Client Secret"
"prompt": "Google OAuth Client Secret (from console.cloud.google.com/apis/credentials)"
}
]
}
@@ -1,6 +1,7 @@
{
"version": "0.1.0",
"wit_version": "0.3.0",
"description": "Fetch pre-extracted web content from Brave Search for grounding LLM answers. Returns actual page content (text chunks, tables, code) relevant to the query, ready for RAG or fact-checking.",
"capabilities": {
"http": {
"allowlist": [
+2 -1
View File
@@ -1,6 +1,7 @@
{
"version": "0.2.0",
"wit_version": "0.3.0",
"description": "Send messages, list channels, read history, add reactions, and get user information in Slack.",
"http": {
"allowlist": [
{
@@ -57,7 +58,7 @@
},
{
"name": "slack_oauth_client_secret",
"prompt": "Slack OAuth Client Secret"
"prompt": "Slack OAuth Client Secret (from api.slack.com/apps > Basic Information)"
}
]
}
@@ -1,6 +1,7 @@
{
"version": "0.2.0",
"wit_version": "0.3.0",
"description": "Read and send messages from a Telegram user account. Supports contacts, chat history, message search, sending, forwarding, and deletion via encrypted MTProto.",
"http": {
"allowlist": [
{
@@ -35,7 +36,7 @@
},
{
"name": "telegram_api_hash",
"prompt": "Telegram API Hash"
"prompt": "Telegram API Hash (from my.telegram.org/apps — alphanumeric string)"
}
]
}
@@ -2,40 +2,6 @@
"version": "0.2.0",
"wit_version": "0.3.0",
"description": "Search the web using Brave Search. Returns titles, URLs, descriptions, and publication dates for matching web pages. Supports filtering by country, language, and freshness. Authentication is handled via the 'brave_api_key' secret injected by the host.",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The search query to look up on the web"
},
"count": {
"type": "integer",
"description": "Number of results to return (1-20, default 5)",
"minimum": 1,
"maximum": 20,
"default": 5
},
"country": {
"type": "string",
"description": "2-letter uppercase country code to bias results (e.g. 'US', 'DE', 'JP')"
},
"search_lang": {
"type": "string",
"description": "2-letter lowercase language code for search results (e.g. 'en', 'de', 'fr')"
},
"ui_lang": {
"type": "string",
"description": "Locale in language-region format (e.g. 'en-US', 'de-DE')"
},
"freshness": {
"type": "string",
"description": "Filter by discovery time: 'pd' (past day), 'pw' (past week), 'pm' (past month), 'py' (past year), or date range 'YYYY-MM-DDtoYYYY-MM-DD'"
}
},
"required": ["query"],
"additionalProperties": false
},
"capabilities": {
"http": {
"allowlist": [