Del Tool Call Dialects
Del supports universal tool calling across multiple AI model formats. This document describes the various tool call dialects that Del can parse and execute.
🎯 Overview
Del uses a two-stage execution process:
- Stage 1: Model generates tool calls in its native format
- Stage 2: Del executes tools and feeds real results back to the model
This prevents AI hallucination and ensures accurate, real-world data.
🔧 Supported Tool Call Formats
1. Chinese Models Format (DeepSeek, Qwen, ChatGLM, etc.)
Format: Used by Chinese AI models like DeepSeek Coder, Qwen2.5, ChatGLM, etc.
Basic Structure:
<|tool▁calls▁begin|>
<|tool▁call▁begin|>
function<|tool▁sep|>tool_name
```json
{
"arg1": "value1",
"arg2": "value2"
}
<|tool▁call▁end|> <|tool▁calls▁end|>
**Real Example**:
<|tool▁calls▁begin|> <|tool▁call▁begin|> function<|tool▁sep|>list_dir
{"path": "."}
<|tool▁call▁end|> <|tool▁calls▁end|>
**Variations Supported**:
- With or without closing tags
- Inline JSON: `function<|tool▁sep|>list_dir {"path": "."}`
- Empty arguments: `function<|tool▁sep|>project_context {}`
### 2. OpenAI XML Format
**Format**: Used by OpenAI GPT models and compatible APIs.
**Structure**:
```xml
<tool_calls>
<invoke name="tool_name">
<parameter name="arg1">value1</parameter>
<parameter name="arg2">value2</parameter>
</invoke>
</tool_calls>
Example:
<tool_calls>
<invoke name="read_file">
<parameter name="path">main.go</parameter>
</invoke>
</tool_calls>
3. OpenAI JSON Format
Format: JSON array format used by some OpenAI integrations.
Structure:
[{"name": "tool_name", "parameters": {"arg1": "value1", "arg2": "value2"}}]
Example:
[{"name": "git_operation", "parameters": {"operation": "status"}}]
4. Llama Function Format
Format: Used by Llama models and Meta’s function calling implementations.
Structure:
<function=tool_name>{"arg1": "value1", "arg2": "value2"}</function>
Example:
<function=security_scan>{"path": "."}</function>
5. Markdown Format
Format: Human-readable format sometimes used by models.
Structure:
## Function Call
tool_name({"arg1": "value1", "arg2": "value2"})
Example:
## Tool Call
analyze_code({"content": "package main..."})
6. Legacy Del Format (Deprecated)
Format: Del’s original custom format (maintained for backward compatibility).
Structure:
TOOL_USE: tool_name {"arg1": "value1", "arg2": "value2"}
Example:
TOOL_USE: run_command {"command": "git status"}
🚀 Available Tools
Core File Operations
read_file- Read file contentswrite_file- Write content to fileslist_dir- List directory contents
Multi-File Operations
multi_edit- Batch edit multiple filesbatch_operations- Execute multiple file operations
Code Analysis
analyze_code- Analyze code metricsextract_functions- Extract function namesfind_references- Find symbol referencessearch_code- Search code patternsformat_code- Auto-format codelint_code- Run linters
Git Operations
git_operation- Execute git commands (status, commit, push, diff, etc.)
Project Intelligence
project_context- Analyze project structuresecurity_scan- Scan for vulnerabilities
External Operations
run_command- Execute shell commandsweb_search- Search the web for informationtest_runner- Auto-detect and run tests
📋 Tool Arguments Reference
Common Arguments
File Operations:
{
"path": "relative/or/absolute/path"
}
Git Operations:
{
"operation": "status|add|commit|push|pull|diff|log|branch",
"files": "optional file pattern",
"message": "commit message for commits",
"branch": "branch name for branch operations"
}
Multi-Edit Operations:
{
"operations": [
{"file": "path1", "old": "text to replace", "new": "replacement text"},
{"file": "path2", "old": "another text", "new": "new text"}
]
}
Command Execution:
{
"command": "shell command to execute"
}
🔍 Parsing Logic
Del uses a universal parser that tries formats in this order:
- Chinese Model Format (most common)
- OpenAI XML Format
- OpenAI JSON Format
- Llama Format
- Markdown Format
- Legacy Del Format
The first matching format is used. This ensures maximum compatibility across different models.
🛡️ Safety Features
Del includes a safe mode system that requires confirmation for dangerous operations:
Sensitive Operations (require confirmation):
- File writes (
write_file,multi_edit) - Git commits/pushes (
git_operationwith commit/push) - Shell commands with dangerous patterns (
run_commandwith rm, sudo, etc.) - Code formatting (
format_code)
Toggle Safety:
safe- Toggle safe mode on/offunsafe- Disable safe mode (use with caution!)
🧪 Testing Tool Calls
You can test tool call parsing by asking Del to perform various operations:
File Operations:
- “show me the main function” →
read_file - “list files in this directory” →
list_dir
Git Operations:
- “what’s the git status?” →
git_operation - “commit these changes” →
git_operation
Analysis:
- “analyze this project” →
project_context - “scan for vulnerabilities” →
security_scan
🔧 Model-Specific Tips
DeepSeek Coder
- Naturally uses Chinese format
- May include fake output blocks (Del filters these out)
- Works best with explicit tool requests
Qwen2.5 Coder
- Consistent Chinese format usage
- Good at following tool calling instructions
- Reliable JSON argument formatting
CodeLlama
- May use Llama format or custom variations
- Sometimes needs explicit prompting for tool use
- Works well with function-style requests
GPT Models (via Ollama)
- Usually XML format if configured for tools
- May fall back to JSON format
- Excellent at understanding tool requirements
🚨 Troubleshooting
Tool Not Detected
- Check if model is using a supported format
- Verify tool name spelling
- Enable debug mode to see parsing attempts
Invalid Arguments
- Ensure JSON syntax is correct
- Check argument names match tool requirements
- Use empty
{}for tools with no arguments
Permission Denied
- Check if safe mode is blocking the operation
- Use
unsafecommand to disable (carefully) - Confirm tool arguments for dangerous operations
Model Hallucinating Results
- Del’s two-stage system prevents this
- If you see fake
<|tool▁outputs▁begin|>blocks, they’re filtered out - Only real tool execution results are shown
📈 Extending Support
To add support for new tool call formats:
-
Add a new parser function following the pattern:
func (d *Del) parseNewFormat(response string) []ToolCall -
Add it to the parsing chain in
parseToolCalls() -
Test with the target model format
-
Update this documentation
🔗 Related Files
cmd/del/main.go- Main implementation with all parsersREADME.md- General Del documentationCLAUDE.md- Project-specific instructions
💡 Best Practices
- Use explicit requests: “scan for vulnerabilities” vs “check security”
- Specify paths: Include relative paths for file operations
- Test safety: Use safe mode for destructive operations
- Verify results: Del shows real tool execution output
- Model selection: Choose models that follow instructions well
Del supports universal tool calling across 6+ major AI model formats, ensuring consistent functionality regardless of your chosen model.