Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
fc723c5f53
|
|||
|
7f138af4b5
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1557,7 +1557,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "todo-mcp"
|
name = "todo-mcp"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "todo-mcp"
|
name = "todo-mcp"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.85"
|
rust-version = "1.85"
|
||||||
description = "simple todo cli with mcp server for ai integration"
|
description = "simple todo cli with mcp server for ai integration"
|
||||||
|
|||||||
14
src/mcp.rs
14
src/mcp.rs
@@ -55,7 +55,8 @@ fn tool_schemas() -> Value {
|
|||||||
"text": { "type": "string", "description": "todo text" },
|
"text": { "type": "string", "description": "todo text" },
|
||||||
"priority": { "type": "string", "enum": ["low", "medium", "high", "critical"] },
|
"priority": { "type": "string", "enum": ["low", "medium", "high", "critical"] },
|
||||||
"tags": { "type": "array", "items": { "type": "string" } },
|
"tags": { "type": "array", "items": { "type": "string" } },
|
||||||
"no_project": { "type": "boolean" }
|
"no_project": { "type": "boolean" },
|
||||||
|
"project": { "type": "string", "description": "explicit project path, use when the server cannot auto-detect git repos (e.g. running in a container)" }
|
||||||
},
|
},
|
||||||
"required": ["text"]
|
"required": ["text"]
|
||||||
}
|
}
|
||||||
@@ -70,6 +71,7 @@ fn tool_schemas() -> Value {
|
|||||||
"priority": { "type": "string", "enum": ["low", "medium", "high", "critical"] },
|
"priority": { "type": "string", "enum": ["low", "medium", "high", "critical"] },
|
||||||
"search": { "type": "string" },
|
"search": { "type": "string" },
|
||||||
"here": { "type": "boolean", "description": "only show todos for current repo" },
|
"here": { "type": "boolean", "description": "only show todos for current repo" },
|
||||||
|
"project": { "type": "string", "description": "explicit project path to filter by, use when the server cannot auto-detect git repos (e.g. running in a container)" },
|
||||||
"all": { "type": "boolean", "description": "include completed todos" }
|
"all": { "type": "boolean", "description": "include completed todos" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,7 +158,12 @@ async fn dispatch(pool: &Pool, name: &str, args: &Value) -> Value {
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let tags = str_array(args, "tags");
|
let tags = str_array(args, "tags");
|
||||||
let no_project = args.get("no_project").and_then(|v| v.as_bool()).unwrap_or(false);
|
let no_project = args.get("no_project").and_then(|v| v.as_bool()).unwrap_or(false);
|
||||||
let project = if no_project { None } else { db::detect_project() };
|
let explicit_project = args.get("project").and_then(|v| v.as_str()).map(String::from);
|
||||||
|
let project = if no_project {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
explicit_project.or_else(db::detect_project)
|
||||||
|
};
|
||||||
db::insert_todo(pool, text, &priority, project.as_deref(), &tags)
|
db::insert_todo(pool, text, &priority, project.as_deref(), &tags)
|
||||||
.await
|
.await
|
||||||
.map(|t| serde_json::to_string(&t).unwrap())
|
.map(|t| serde_json::to_string(&t).unwrap())
|
||||||
@@ -168,7 +175,8 @@ async fn dispatch(pool: &Pool, name: &str, args: &Value) -> Value {
|
|||||||
let search = args.get("search").and_then(|v| v.as_str()).map(String::from);
|
let search = args.get("search").and_then(|v| v.as_str()).map(String::from);
|
||||||
let here = args.get("here").and_then(|v| v.as_bool()).unwrap_or(false);
|
let here = args.get("here").and_then(|v| v.as_bool()).unwrap_or(false);
|
||||||
let all = args.get("all").and_then(|v| v.as_bool()).unwrap_or(false);
|
let all = args.get("all").and_then(|v| v.as_bool()).unwrap_or(false);
|
||||||
let project = if here { db::detect_project() } else { None };
|
let explicit_project = args.get("project").and_then(|v| v.as_str()).map(String::from);
|
||||||
|
let project = explicit_project.or_else(|| if here { db::detect_project() } else { None });
|
||||||
db::list_todos(
|
db::list_todos(
|
||||||
pool,
|
pool,
|
||||||
ListFilters {
|
ListFilters {
|
||||||
|
|||||||
Reference in New Issue
Block a user