Skip to main content

agentmux_mcp/tools/
presence_tool.rs

1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Presence: one tool for who is working on what, with an `action`
5//! (docs/specs/SPEC_MUXAPI_TOOL_CONSOLIDATION_2026_10_15.md §4.2, slice S3). It
6//! replaces WhoIsWorkingOn, ClaimWork and ReleaseWork (`status` is new, SPEC in
7//! docs/reports/REPORT_SWARM_PHRASE_ACCURATE_SPECIFIC_CURRENT_2026_11_02.md §0); their handlers
8//! (overlap.rs) run each action unchanged.
9
10use super::family::{pick, relabeled, Act};
11use super::*;
12
13pub(super) const ACTS: &[Act] = &[
14    Act { action: "who", tool: "WhoIsWorkingOn", rename: &[] },
15    Act { action: "claim", tool: "ClaimWork", rename: &[] },
16    Act { action: "release", tool: "ReleaseWork", rename: &[] },
17    Act { action: "status", tool: "SetStatus", rename: &[] },
18];
19
20pub(super) async fn call(name: &str, arguments: &Value, cx: &ToolCtx<'_>) -> Result<String> {
21    match name {
22        "Presence" => {
23            let (act, args) = pick("Presence", ACTS, arguments)?;
24            relabeled("Presence", ACTS, overlap::call(act.tool, &args, cx).await)
25        }
26        _ => Err(not_in_family()),
27    }
28}
29
30#[cfg(test)]
31mod tests {
32    use super::*;
33
34    #[test]
35    fn every_action_is_in_the_schema() {
36        let schema: Value = serde_json::from_str(crate::tool_schemas::PRESENCE_TOOL).unwrap();
37        let mut listed: Vec<&str> = schema["inputSchema"]["properties"]["action"]["enum"]
38            .as_array()
39            .unwrap()
40            .iter()
41            .filter_map(|v| v.as_str())
42            .collect();
43        let mut want = super::super::family::action_names(ACTS);
44        listed.sort();
45        want.sort();
46        assert_eq!(listed, want);
47    }
48}