swarm repositories / source
aboutsummaryrefslogtreecommitdiff
path: root/crates/phone-opus/src/mcp/catalog.rs
diff options
context:
space:
mode:
authormain <main@swarm.moe>2026-03-23 16:28:52 -0400
committermain <main@swarm.moe>2026-03-23 16:28:52 -0400
commitc3ad44cf3ec3bcd080f62c19d915ac1749576302 (patch)
treea3da7810f794182f4740e0da270e9c40f3fdad2b /crates/phone-opus/src/mcp/catalog.rs
parent5cf9432092da40a2653c3d156ca5a4746e853827 (diff)
downloadphone_opus-c3ad44cf3ec3bcd080f62c19d915ac1749576302.zip
Add optional background consult jobs
Diffstat (limited to 'crates/phone-opus/src/mcp/catalog.rs')
-rw-r--r--crates/phone-opus/src/mcp/catalog.rs38
1 files changed, 37 insertions, 1 deletions
diff --git a/crates/phone-opus/src/mcp/catalog.rs b/crates/phone-opus/src/mcp/catalog.rs
index 4c71e83..839c477 100644
--- a/crates/phone-opus/src/mcp/catalog.rs
+++ b/crates/phone-opus/src/mcp/catalog.rs
@@ -41,11 +41,23 @@ impl ToolSpec {
const TOOL_SPECS: &[ToolSpec] = &[
ToolSpec {
name: "consult",
- description: "Run a blocking consult against the system Claude Code install using a read-only built-in toolset, optionally resume a prior Claude session by session_id, and return the response.",
+ description: "Run a consult against the system Claude Code install using a read-only built-in toolset, optionally resume a prior Claude session by session_id, optionally queue the consult in the background, and return the response or job handle.",
dispatch: DispatchTarget::Worker,
replay: ReplayContract::NeverReplay,
},
ToolSpec {
+ name: "consult_job",
+ description: "Read the status of one background consult job by job_id. When the job has finished, the final Claude response or failure is included.",
+ dispatch: DispatchTarget::Host,
+ replay: ReplayContract::Convergent,
+ },
+ ToolSpec {
+ name: "consult_jobs",
+ description: "List recent background consult jobs. Defaults to render=porcelain; use render=json for structured output.",
+ dispatch: DispatchTarget::Host,
+ replay: ReplayContract::Convergent,
+ },
+ ToolSpec {
name: "health_snapshot",
description: "Read host lifecycle, worker generation, rollout state, and latest fault. Defaults to render=porcelain; use render=json for structured output.",
dispatch: DispatchTarget::Host,
@@ -98,10 +110,34 @@ fn tool_schema(name: &str) -> Value {
"session_id": {
"type": "string",
"description": "Optional Claude session handle returned by a previous consult call. When set, phone_opus resumes that conversation instead of starting a fresh one."
+ },
+ "background": {
+ "type": "boolean",
+ "description": "When true, queue the consult as a background job and return immediately with a job handle. The default is false, which keeps consult synchronous."
}
},
"required": ["prompt"]
})),
+ "consult_job" => with_common_presentation(json!({
+ "type": "object",
+ "properties": {
+ "job_id": {
+ "type": "string",
+ "description": "Background consult job handle returned by consult with background=true."
+ }
+ },
+ "required": ["job_id"]
+ })),
+ "consult_jobs" => with_common_presentation(json!({
+ "type": "object",
+ "properties": {
+ "limit": {
+ "type": "integer",
+ "minimum": 1,
+ "description": "Maximum number of recent background jobs to return. Defaults to 10."
+ }
+ }
+ })),
"health_snapshot" | "telemetry_snapshot" => with_common_presentation(json!({
"type": "object",
"properties": {}