Compare commits

...
Author SHA1 Message Date
bincxz 30be0e555e fix(mcp): describe snippet placeholders without mustache tokens
Keep agents informed that snippets use two curly braces on each side,
without emitting a literal {{name}} token that template hosts interpolate.
2026-09-21 15:36:06 +08:00
bincxz 747dc34f49 fix(mcp): drop mustache braces from tool descriptions
Hosts that interpolate {{name}} in tools/list text treat the literal
{{variables}} snippet wording as a missing template variable and abort
the turn. Use plain language instead and regenerate the committed specs.
2026-09-21 15:17:40 +08:00
6 changed files with 10 additions and 5 deletions

No files matched your search

+1 -1
View File
@@ -412,7 +412,7 @@ const MODEL_DESCRIPTION_HINTS = Object.freeze({
"vault.note.update":
"Update an existing Vault → Notes entry (visible in the vault notes sidebar).",
"vault.snippets.run":
"Text snippets (kind=snippet) paste shell commands with optional {{variables}}. Scripts (kind=script) run via nct JavaScript runtime — use scripts_run for script-only workflows.",
"Text snippets (kind=snippet) paste shell commands with optional named placeholders written with two curly braces on each side. Scripts (kind=script) run via nct JavaScript runtime — use scripts_run for script-only workflows.",
"vault.snippets.create":
"Create vault snippets (shell text) or scripts (kind=script, nct JavaScript). For multi-step terminal automation use kind=script and call scripts_reference.",
"vault.scripts.run":
+1 -1
View File
@@ -18,7 +18,7 @@ const VAULT_HOSTS_VS_NOTES_GUIDANCE =
+ "If vault_hosts_create or vault_hosts_import fails, report the error — do not silently create a Vault note instead.";
const VAULT_SCRIPTS_GUIDANCE =
"Snippets vs automation scripts: snippets_* for shell command text (optional {{variables}}). "
"Snippets vs automation scripts: snippets_* for shell command text (optional named placeholders written with two curly braces on each side). "
+ "scripts_* for nct JavaScript automation (await nct.screen.sendLine, waitForText/waitForRegex, dialogs). "
+ "Call scripts_reference before authoring scripts. scripts_run with wait=true blocks until completion; "
+ "use scripts_runs_list / scripts_run_stop / scripts_run_pause / scripts_run_resume for lifecycle. "
@@ -35,3 +35,8 @@ test("VAULT_SCRIPTS_GUIDANCE prefers explicit wait APIs", () => {
assert.match(VAULT_SCRIPTS_GUIDANCE, /waitForText\/waitForRegex/);
assert.doesNotMatch(VAULT_SCRIPTS_GUIDANCE, /sendLine,\s*waitFor,\s*dialogs/);
});
test("VAULT_SCRIPTS_GUIDANCE avoids mustache template braces", () => {
assert.doesNotMatch(VAULT_SCRIPTS_GUIDANCE, /\{\{/);
assert.doesNotMatch(appendVaultAgentGuidance("Netcatty terminal manager."), /\{\{/);
});
+1 -1
View File
@@ -61,7 +61,7 @@ ${permissionRules}
**Vault → Notes (sidebar markdown docs):** When the user explicitly wants documentation saved to **Vault → Notes** (the notes sidebar / 保险箱笔记), use \`vault_notes_create\` or \`vault_notes_update\` — **not** \`host_notes_set\` (Host Details only) and **not** as a substitute for creating a host. When a message references a Vault note, use \`vault_notes_get\` with its exact \`noteId\` to read the latest content before summarizing or editing. Use that same ID for updates; do not substitute a title search. If the note no longer exists, tell the user.
**Snippets vs automation scripts:** Use \`snippets_*\` for shell command text (paste/execute with optional \`{{variables}}\`). Use \`scripts_*\` for multi-step terminal automation written in JavaScript with the \`nct.*\` API (\`await nct.screen.sendLine\`, \`waitForText\` / \`waitForRegex\`, dialogs, progress). Call \`scripts_reference\` before authoring or editing scripts. Run scripts with \`scripts_run\` (set \`wait: true\` to block until done); use \`scripts_runs_list\`, \`scripts_run_stop\`, \`scripts_run_pause\`, and \`scripts_run_resume\` for lifecycle control. Create/update/delete vault entries with \`snippets_create/update/delete\` (any kind) or \`scripts_create/update/delete\` (scripts only).
**Snippets vs automation scripts:** Use \`snippets_*\` for shell command text (paste/execute with optional named placeholders written with two curly braces on each side). Use \`scripts_*\` for multi-step terminal automation written in JavaScript with the \`nct.*\` API (\`await nct.screen.sendLine\`, \`waitForText\` / \`waitForRegex\`, dialogs, progress). Call \`scripts_reference\` before authoring or editing scripts. Run scripts with \`scripts_run\` (set \`wait: true\` to block until done); use \`scripts_runs_list\`, \`scripts_run_stop\`, \`scripts_run_pause\`, and \`scripts_run_resume\` for lifecycle control. Create/update/delete vault entries with \`snippets_create/update/delete\` (any kind) or \`scripts_create/update/delete\` (scripts only).
**Script triggers and hosts:** \`trigger: manual\` runs on demand; \`onConnect\` runs after SSH connect (global \`targetsAllHosts\`, dynamic \`targetGroups\`, then per-host \`connectScriptIds\` queue); \`onOutput\` runs when terminal output matches \`triggerPattern\` (regex). Link scripts to host IDs or dynamic group paths with \`scripts_targets_set\`, or manage per-host connect order with \`host_connect_scripts_list\` / \`host_connect_scripts_set\`.
@@ -1231,7 +1231,7 @@
"toolName": "snippets_run",
"rpcMethod": "vault/snippets/run",
"localExecution": false,
"description": "Run a vault snippet or automation script in a terminal session. Text snippets paste shell commands; scripts (kind=script) run via the nct JavaScript runtime. Text snippets (kind=snippet) paste shell commands with optional {{variables}}. Scripts (kind=script) run via nct JavaScript runtime — use scripts_run for script-only workflows.",
"description": "Run a vault snippet or automation script in a terminal session. Text snippets paste shell commands; scripts (kind=script) run via the nct JavaScript runtime. Text snippets (kind=snippet) paste shell commands with optional named placeholders written with two curly braces on each side. Scripts (kind=script) run via nct JavaScript runtime — use scripts_run for script-only workflows.",
"inputShape": {
"snippetId": {
"type": "string",
@@ -1295,7 +1295,7 @@
"toolName": "snippets_run",
"rpcMethod": "vault/snippets/run",
"localExecution": false,
"description": "Run a vault snippet or automation script in a terminal session. Text snippets paste shell commands; scripts (kind=script) run via the nct JavaScript runtime. Text snippets (kind=snippet) paste shell commands with optional {{variables}}. Scripts (kind=script) run via nct JavaScript runtime — use scripts_run for script-only workflows.",
"description": "Run a vault snippet or automation script in a terminal session. Text snippets paste shell commands; scripts (kind=script) run via the nct JavaScript runtime. Text snippets (kind=snippet) paste shell commands with optional named placeholders written with two curly braces on each side. Scripts (kind=script) run via nct JavaScript runtime — use scripts_run for script-only workflows.",
"inputShape": {
"snippetId": {
"type": "string",