swarm repositories / source
aboutsummaryrefslogtreecommitdiff
path: root/crates/fidget-spinner-cli/src/mcp/catalog.rs
diff options
context:
space:
mode:
authormain <main@swarm.moe>2026-03-19 17:16:47 -0400
committermain <main@swarm.moe>2026-03-19 17:16:47 -0400
commit958c7bf261a404a7df99e394997ab10e724cfca7 (patch)
tree708b3c860a92158b7d9b4177287f469935728a15 /crates/fidget-spinner-cli/src/mcp/catalog.rs
parenteb6b1af642f5829d5dc08aa61138d893b91b60b2 (diff)
downloadfidget_spinner-958c7bf261a404a7df99e394997ab10e724cfca7.zip
Sharpen MCP concise output surfaces
Diffstat (limited to 'crates/fidget-spinner-cli/src/mcp/catalog.rs')
-rw-r--r--crates/fidget-spinner-cli/src/mcp/catalog.rs41
1 files changed, 37 insertions, 4 deletions
diff --git a/crates/fidget-spinner-cli/src/mcp/catalog.rs b/crates/fidget-spinner-cli/src/mcp/catalog.rs
index ec57a5c..b23cb31 100644
--- a/crates/fidget-spinner-cli/src/mcp/catalog.rs
+++ b/crates/fidget-spinner-cli/src/mcp/catalog.rs
@@ -1,7 +1,7 @@
use libmcp::ReplayContract;
use serde_json::{Value, json};
-use crate::mcp::output::with_render_property;
+use crate::mcp::output::with_common_presentation;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum DispatchTarget {
@@ -67,6 +67,18 @@ pub(crate) fn tool_spec(name: &str) -> Option<ToolSpec> {
dispatch: DispatchTarget::Worker,
replay: ReplayContract::Convergent,
}),
+ "tag.add" => Some(ToolSpec {
+ name: "tag.add",
+ description: "Register one repo-local tag with a required description. Notes may only reference tags from this registry.",
+ dispatch: DispatchTarget::Worker,
+ replay: ReplayContract::NeverReplay,
+ }),
+ "tag.list" => Some(ToolSpec {
+ name: "tag.list",
+ description: "List repo-local tags available for note and node tagging.",
+ dispatch: DispatchTarget::Worker,
+ replay: ReplayContract::Convergent,
+ }),
"frontier.list" => Some(ToolSpec {
name: "frontier.list",
description: "List frontiers for the current project.",
@@ -200,6 +212,8 @@ pub(crate) fn tool_definitions() -> Vec<Value> {
"project.bind",
"project.status",
"project.schema",
+ "tag.add",
+ "tag.list",
"frontier.list",
"frontier.status",
"frontier.init",
@@ -223,7 +237,7 @@ pub(crate) fn tool_definitions() -> Vec<Value> {
json!({
"name": spec.name,
"description": spec.description,
- "inputSchema": with_render_property(input_schema(spec.name)),
+ "inputSchema": with_common_presentation(input_schema(spec.name)),
"annotations": spec.annotation_json(),
})
})
@@ -262,7 +276,7 @@ pub(crate) fn list_resources() -> Vec<Value> {
fn input_schema(name: &str) -> Value {
match name {
- "project.status" | "project.schema" | "skill.list" | "system.health"
+ "project.status" | "project.schema" | "tag.list" | "skill.list" | "system.health"
| "system.telemetry" => json!({"type":"object","additionalProperties":false}),
"project.bind" => json!({
"type": "object",
@@ -272,6 +286,15 @@ fn input_schema(name: &str) -> Value {
"required": ["path"],
"additionalProperties": false
}),
+ "tag.add" => json!({
+ "type": "object",
+ "properties": {
+ "name": { "type": "string", "description": "Lowercase repo-local tag name." },
+ "description": { "type": "string", "description": "Human-facing tag description." }
+ },
+ "required": ["name", "description"],
+ "additionalProperties": false
+ }),
"skill.show" => json!({
"type": "object",
"properties": {
@@ -311,6 +334,7 @@ fn input_schema(name: &str) -> Value {
"frontier_id": { "type": "string" },
"title": { "type": "string" },
"summary": { "type": "string" },
+ "tags": { "type": "array", "items": tag_name_schema() },
"payload": { "type": "object" },
"annotations": { "type": "array", "items": annotation_schema() },
"parents": { "type": "array", "items": { "type": "string" } }
@@ -339,6 +363,7 @@ fn input_schema(name: &str) -> Value {
"properties": {
"frontier_id": { "type": "string" },
"class": node_class_schema(),
+ "tags": { "type": "array", "items": tag_name_schema() },
"include_archived": { "type": "boolean" },
"limit": { "type": "integer", "minimum": 1, "maximum": 500 }
},
@@ -369,10 +394,11 @@ fn input_schema(name: &str) -> Value {
"frontier_id": { "type": "string" },
"title": { "type": "string" },
"body": { "type": "string" },
+ "tags": { "type": "array", "items": tag_name_schema() },
"annotations": { "type": "array", "items": annotation_schema() },
"parents": { "type": "array", "items": { "type": "string" } }
},
- "required": ["title", "body"],
+ "required": ["title", "body", "tags"],
"additionalProperties": false
}),
"research.record" => json!({
@@ -462,6 +488,13 @@ fn annotation_schema() -> Value {
})
}
+fn tag_name_schema() -> Value {
+ json!({
+ "type": "string",
+ "pattern": "^[a-z0-9]+(?:[-_/][a-z0-9]+)*$"
+ })
+}
+
fn node_class_schema() -> Value {
json!({
"type": "string",