anvilmcp: handle args passed as JSON-encoded string; fix team-templates install path

- Parse args as JSON string fallback when LLM passes args incorrectly
- Update SKILLS_PROMPT and agent docs to use unquoted args syntax
- Install team-templates under $INSTALL_PATH/Teams instead of hardcoded $HOME/bin/Teams

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-07 17:40:35 +01:00
parent 919335a271
commit 824ab88fe3
4 changed files with 18 additions and 7 deletions

View File

@ -7,14 +7,14 @@
```bash
Tool: execute_code
tool: discover_skill.sh
args: ["<keyword>"]
args: [keyword]
```
3. Load relevant skill files:
```bash
Tool: execute_code
tool: load_skill.sh
args: ["<skill-name>"]
args: [skill-name]
```
**Common capability mappings:**

View File

@ -39,14 +39,14 @@ If a step succeeded, do not announce it — the tool output is the confirmation.
```bash
Tool: execute_code
tool: discover_skill.sh
args: ["<keyword>"]
args: [keyword]
```
3. Load relevant skill files:
```bash
Tool: execute_code
tool: load_skill.sh
args: ["<skill-name>"]
args: [skill-name]
```
**Common capability mappings:**

View File

@ -135,6 +135,12 @@ func handleToolCall(req MCPRequest) {
toolArgs = append(toolArgs, s)
}
}
} else if argsStr, ok := params.Arguments["args"].(string); ok {
// LLM passed args as a JSON-encoded string instead of an array
var parsed []string
if err := json.Unmarshal([]byte(argsStr), &parsed); err == nil {
toolArgs = parsed
}
}
code, _ := params.Arguments["code"].(string)
language, _ := params.Arguments["language"].(string)
@ -156,6 +162,11 @@ func handleToolCall(req MCPRequest) {
step.Args = append(step.Args, s)
}
}
} else if argsStr, ok := stepMap["args"].(string); ok {
var parsed []string
if err := json.Unmarshal([]byte(argsStr), &parsed); err == nil {
step.Args = parsed
}
}
pipeSteps = append(pipeSteps, step)
}

6
mkfile
View File

@ -21,9 +21,9 @@ build:V:
chmod 0755 $INSTALL_PATH/9p-read-inbox
cp scripts/anvilspawn $INSTALL_PATH/anvilspawn
chmod 0755 $INSTALL_PATH/anvilspawn
mkdir -p $HOME/bin/Teams
cp -f team-templates/* $HOME/bin/Teams/
chmod 0755 $HOME/bin/Teams/*
mkdir -p $INSTALL_PATH/Teams
cp -f team-templates/* $INSTALL_PATH/Teams/
chmod 0755 $INSTALL_PATH/Teams/*
mkdir -p $HOME/.config/anvillm
cp -rf cfg/* $HOME/.config/anvillm/
mkdir -p $HOME/.config/anvillm/skills