feat(mcp): add colibri_list_task_costs tool + test assertion #233

Merged
clawdie merged 1 commit from feat/layer2-dashboard-complete into main 2026-06-27 13:58:09 +02:00
2 changed files with 23 additions and 1 deletions

View file

@ -15,6 +15,8 @@
//! | `colibri_create_task` | write-gated| Create a task |
//! | `colibri_intake_task` | write-gated| Submit intake task with capabilities|
//! | `colibri_set_cost_mode` | write-gated | Switch cost mode (fast/smart/max) |
//! | `colibri_get_task` | read-only | Task details with cost data |
//! | `colibri_list_task_costs` | read-only | All tasks with cost (dashboard) |
//!
//! Write tools require `COLIBRI_MCP_WRITE=1`.
@ -156,6 +158,16 @@ pub fn tool_list() -> Vec<Value> {
"required": ["task_id"]
})),
),
json_tool(
"colibri_list_task_costs",
"List all tasks with cost data (tokens, cost_usd, cache ratio, success). Dashboard-ready summary for web UI.",
Some(serde_json::json!({
"type": "object",
"properties": {
"status": { "type": "string", "description": "Optional status filter: done, failed, or empty for all" }
}
})),
),
json_tool(
"colibri_external_mcp_servers",
"List configured external MCP servers from COLIBRI_MCP_EXTERNAL_CONFIG",
@ -304,6 +316,14 @@ pub async fn dispatch_tool(
None => Err(McpError::not_found(format!("task not found: {task_id}"))),
}
}
"colibri_list_task_costs" => {
let status = arguments
.get("status")
.and_then(|v| v.as_str())
.map(|s| s.to_string());
let all_tasks = client.list_tasks(status.as_deref()).await.map_err(map_client_error)?;
Ok(tool_text(all_tasks))
}
"colibri_external_mcp_servers" => {
let registry = external::load_registry_if_present(&config.external_config_path).await?;
Ok(tool_text(serde_json::json!({

View file

@ -252,6 +252,8 @@ fn tool_list_has_all_phase1_tools() {
assert!(names.contains(&"colibri_external_mcp_servers"));
assert!(names.contains(&"colibri_external_mcp_list_tools"));
assert!(names.contains(&"colibri_external_mcp_call_tool"));
assert!(names.contains(&"colibri_list_task_costs"));
assert!(names.contains(&"colibri_get_task"));
assert_eq!(names.len(), 11);
assert_eq!(names.len(), 12);
}