| name | meta-tools-lifecycle |
| description | Master the complete tool lifecycle workflow: create, validate, approve, reload, and use. Agents learn to autonomously orchestrate tool creation with policy validation and human approval. |
| metadata | {"category":"Tool Lifecycle","difficulty":"advanced","apply-to":"matimo_create_tool matimo_validate_tool matimo_doctor matimo_review matimo_reload_tools matimo_list_user_tools"} |
Meta-Tools Lifecycle: Complete Workflow
This skill teaches you how to autonomously orchestrate Matimo's complete tool lifecycleโfrom conception through validation, human approval, registration, and delivery. This is the workflow for agents that create tools dynamically.
The Complete Tool Lifecycle
1. Understand Requirements
โ
2. Design YAML (matimo_validate_tool or matimo_doctor for validation)
โ
3. Create on Disk (matimo_create_tool)
โ
4. Request Human Approval (matimo_review)
โ
5. Reload Registry (matimo_reload_tools)
โ
6. Execute the Tool
โ
7. List & Manage (matimo_list_user_tools)
Step 1: Understand Requirements
Before writing YAML, clarify:
What does the tool need to do?
- Read-only (GET) vs. modify data (POST/PUT/DELETE)
- Which API endpoint(s) to call
- What inputs does it need (parameters)
- What output should it return
What domain?
- Public API (GitHub, weather, etc.)
- Internal service
- File system operation
- Something else
Is it safe?
- Uses whitelisted domains only
- Uses safe HTTP methods (GET/POST preferred)
- No SSRF attacks (no internal IPs)
- No arbitrary code execution
Step 2: Design YAML with Validation
Generate Complete YAML First
REQUIRED fields (all must be present):
name: tool_name
version: "1.0.0"
description: "What this tool does"
parameters:
param_name:
type: string
required: true
description: "What it does"
execution:
type: http
method: GET
url: "https://api.example.com/endpoint"
Example: Minimal Valid Tool
name: weather_lookup
version: "1.0.0"
description: Get current weather for a city
parameters:
city:
type: string
required: true
description: City name (e.g., "New York")
execution:
type: http
method: GET
url: "https://api.weatherapi.com/current?q={city}"
Validate Before Creating
Always call matimo_doctor BEFORE matimo_create_tool:
Input: matimo_doctor(yaml_content: "<your complete YAML>")
Output: { valid: true, ... } โ
Safe to create
OR: { valid: false, schemaErrors: [...], policyErrors: [...] } โ Fix first
If validation fails:
| Error | Cause | Fix |
|---|
version: Invalid input, expected string | Missing/wrong type | Add version: "1.0.0" |
execution: Invalid input, expected object | Missing section | Add complete execution block |
execution.method: Invalid option | Wrong HTTP verb | Use GET, POST, PUT, DELETE, or PATCH |
parameters: Invalid input, expected object | Missing field | Add parameters: {} or with actual params |
Command tools are blocked (policy) | Trying to use type: command | Use HTTP GET/POST instead |
SSRF detected: forbidden IP range | Using internal IP (169.254., 10.) | Use public APIs |
Reserved namespace violation: matimo_* | Name starts with matimo_ | Choose different name |
If policy blocks your tool:
- Understand why: Read the rule that blocked it
- Redesign: Use an allowed API or method
- Re-validate: Check with matimo_doctor again until
valid: true
Example: Fixing Validation Errors
WRONG:
name: weather_fetch
# Missing version โ
VALIDATED:
name: weather_fetch
version: "1.0.0"
description: Get weather
parameters: {}
execution:
type: http
method: GET
url: "https://api.weatherapi.com/v1/current.json"
Step 3: Create Tool on Disk
Once matimo_doctor returns valid: true:
Call matimo_create_tool with:
- name: "tool_name"
- yaml_content: "<complete YAML string>"
- target_dir: "<directory path provided by user>"
Expected response:
{
"success": true,
"path": "/path/to/tool_name/definition.yaml",
"status": "draft",
"approvalState": "pending",
"message": "Tool created as draft. Requires approval before execution..."
}
What happens:
- โ
Tool YAML written to disk:
{target_dir}/tool_name/definition.yaml
- โ
Tool status set to
draft (not yet approved)
- โ
Approval state marked
pending (waiting for human)
- โธ๏ธ Tool NOT yet executable (needs approval)
Common responses:
| Response | Meaning | Next Step |
|---|
success: true, approvalState: "pending" | Draft created, awaiting approval | Call matimo_review |
success: true, approvalState: "auto-approved" | Low-risk tool, ready to use | Call matimo_reload_tools |
success: false, message: "..." | Creation failed (invalid YAML) | Call matimo_doctor again, fix errors, retry |
Step 4: Request Human Approval
Critical: Tools created by agents are untrusted and require human approval:
Call matimo_review with:
- toolName: "weather_fetch"
- target_dir: "<same directory>"
Expected response (if human approves):
{
"approved": true,
"message": "Tool approved for production."
}
Expected response (if human rejects):
{
"approved": false,
"message": "Tool rejected."
// Tool remains draft, NOT executable
}
What the human sees:
- Tool name and description
- Parameters and their types
- Execution method (HTTP GET, etc.)
- Proposed by agent, security reviewed
- Decision: Approve (y) or reject (n)
If rejected:
- โ Tool remains in
draft status
- โ Cannot execute or reload
- ๐ก Understand why human rejected, redesign, and re-submit
If approved:
- โ
Tool marked as
approved status
- โ
HMAC signature created (tamper detection)
- โ
Ready for reload
Step 5: Reload Registry
After human approval, the tool registry must be refreshed:
Call matimo_reload_tools with:
- target_dir: "<same directory>"
Expected response:
{
"loaded": ["weather_fetch", "..."],
"approved": ["weather_fetch"],
"rejected": [],
"message": "Reloaded X tools..."
}
What happens:
- ๐ System re-scans all tool directories
- โ
Approved tools become executable
- โ Rejected tools are skipped
- ๐ Registry updated in-memory
After reload:
- Tool is discoverable by agents
- Tool can be called via matimo.execute()
- Tool appears in LLM tool bindings (if using LangChain)
Step 6: Execute the Tool
Once reloaded, the agent can call the tool naturally:
For HTTP tool:
Input: { city: "New York" }
Action: matimo.execute("weather_fetch", { city: "New York" })
Output: { success: true, weather: { ... } }
For created tool with requires_approval: true:
First call prompts human: "Approve execution of weather_fetch?"
On approval: Tool executes
On rejection: Tool blocked
Agent-created tools with requires_approval:
- โ
Can be created
- โ
Can be approved for production
- โ
Still require human approval on first execution (extra safety)
- โ
After human approves once, auto-approved in session
Step 7: List and Manage Tools
Discover what tools have been created:
Call matimo_list_user_tools with:
- target_dir: "<same directory>"
Expected response:
{
"tools": [
{
"name": "weather_fetch",
"status": "approved",
"riskLevel": "LOW",
"description": "Get weather for a city"
},
{
"name": "file_reader",
"status": "rejected",
"reason": "Command tools are blocked"
}
]
}
What you learn:
- โ
weather_fetch is ready to use (approved)
- โ
file_reader failed policy (rejected)
- ๐ Risk levels guide execution safety
Common Patterns
Pattern 1: Safe HTTP GET Tool
name: github_user_lookup
version: "1.0.0"
description: Look up a GitHub user's profile
parameters:
username:
type: string
required: true
description: GitHub username (e.g., "octocat")
execution:
type: http
method: GET
url: "https://api.github.com/users/{username}"
โ Result: Auto-approved (low-risk read-only), no human approval needed
Pattern 2: Safe HTTP POST Tool
name: todo_create
version: "1.0.0"
description: Create a new todo item
parameters:
title:
type: string
required: true
completed:
type: boolean
required: false
execution:
type: http
method: POST
url: "https://jsonplaceholder.typicode.com/todos"
โ Result: Pending approval, human reviews then approves
Pattern 3: Blocked Command Tool
name: shell_exec
version: "1.0.0"
description: Execute shell commands
parameters:
cmd:
type: string
required: true
execution:
type: command
command: bash
args: ["-c", "{cmd}"]
โ Result: matimo_doctor blocks immediately with "Command tools are blocked (policy)"
What agent learns: "I can't create shell commands; use HTTP instead"
Pattern 4: Policy Violation - SSRF
name: metadata_probe
version: "1.0.0"
execution:
type: http
method: GET
url: "http://169.254.169.254/latest/meta-data/"
โ Result: matimo_doctor blocks with "SSRF detected: forbidden IP range 169.254.*"
What agent learns: "Can't probe internal IPs; they're blocked"
Pattern 5: Namespace Hijack (Rejected)
name: matimo_backdoor
โ Result: matimo_doctor blocks with "Reserved namespace violation: matimo_* is protected"
What agent learns: "Can't use matimo_* names; they're reserved for built-ins"
Workflow Decision Tree
Should I create this tool?
Does it solve the user's goal? โ YES โ Proceed
โ
Is it safe (policy passes)?
โโ YES โ Create (agent-created tools always pending approval)
โ โโโ matimo_doctor โ matimo_create_tool โ matimo_review
โ โ matimo_reload_tools โ Execute
โ
โโ NO โ Understand policy error
โ Redesign to comply (different API, different method)
โ Re-validate with matimo_doctor
โ When valid, create
If human rejects approval:
Why did they reject?
โโ Security concern โ Redesign differently
โโ Governance concern โ Ask for clarification
โโ Not needed โ Mark complete, try different approach
โโ Technical issue โ Fix and re-submit
If policy blocks:
Which rule blocked it?
โโ Command blocked โ Use HTTP instead
โโ SSRF detected โ Use public API, not internal IP
โโ Namespace reserved โ Rename without matimo_ prefix
โโ Domain blocked โ Check allowed-domains policy
โโ Other โ Read error, understand constraint, redesign
Debugging & Troubleshooting
Symptom: matimo_doctor returns validation errors
Field: "execution.method"
Message: "Invalid option: expected one of GET|POST|PUT|DELETE|PATCH"
Fix:
- Read error: method was
PATCH when execution.type: http expects GET/POST/PUT/DELETE/PATCH
- Check YAML: wrong value or syntax
- Correct:
method: POST (exact casing)
- Re-validate with matimo_doctor
Symptom: matimo_create_tool returns "success: false"
Message: "Schema validation failed: Tool schema validation failed:
โข version: Invalid input: expected string, received undefined"
Fix:
- YAML is missing
version field
- Add:
version: "1.0.0"
- Call matimo_doctor to verify
- Then matimo_create_tool
Symptom: matimo_review asks for approval but tool is auto-approved
Expected: Tool should be executable immediately
Actual: Human still asked to approve
Fix:
- Low-risk tools (GET-only to public APIs) are
auto-approved
- Other tools are
pending and require human approval
- This is correct behavior for agent-created tools
- Call matimo_reload_tools after approval
Symptom: Tool not in registry after matimo_reload_tools
Expected: "weather_fetch" in matimo_list_user_tools()
Actual: Not in list
Fix:
- Did matimo_review succeed? (Check for
approved: true)
- Did matimo_reload_tools complete? (Check response)
- Call matimo_list_user_tools() to verify
- If still missing, re-run matimo_reload_tools
Key Principles
- โ
Always validate before creating โ matimo_doctor catches errors early
- โ
Accept human feedback โ If rejected, learn why and redesign
- โ
Respect policy โ It's there to prevent attacks; work within it
- โ
Reload after approval โ Tools don't appear until registry is refreshed
- โ
Complete YAML is critical โ Missing
version or execution = failure
- โ
Name tools for discovery โ Clear names help humans understand what they're approving
References
- Complete tool creation spec: See
tool-creation skill
- Policy validation rules: See
policy-validation skill
- Tool discovery: See
tool-discovery skill
- Matimo Architecture: See copilot-instructions.md
Last Updated: March 2026
Status: Complete
Level: Advanced (assumes familiarity with tool-creation skill)