use polyc_llm::ToolSpec;
use serde_json::json;
pub const TOOL_NAME: &str = "demote";
pub const ALL: &[&str] = &[TOOL_NAME];
pub const ARG_TARGET_USER_ID: &str = "target_user_id";
#[must_use]
pub fn all_specs() -> Vec<ToolSpec> {
vec![demote_spec()]
}
#[must_use]
pub fn demote_spec() -> ToolSpec {
ToolSpec::new(
TOOL_NAME,
"For an admin only: remove a specific person's ADMIN ROLE — not their access to \
Polychrome (that's revoke) and not a wallet. Use it when an admin asks to demote, \
un-admin, or take away someone's admin role — for example \"demote @sam\" or \"@Vitor \
shouldn't be an admin anymore\". Pass the target's user id EXACTLY as it appears in the \
mention markup in the message (the id inside `<@...>`), never a typed-out name. The \
person keeps their ordinary access to Polychrome after this — use revoke separately if \
their access should be removed too. This refuses to demote the last remaining admin (a \
deployment can never be left with zero admins), and refuses to demote anyone who isn't \
currently an admin. If the person asking isn't an admin, it returns a refusal rather \
than changing anyone's role.",
json!({
"type": "object",
"properties": {
ARG_TARGET_USER_ID: {
"type": "string",
"description": "The target's provider-native user id, taken \
verbatim from the mention markup (`<@U...>`) in the \
message — not a display name or handle."
}
},
"required": [ARG_TARGET_USER_ID],
"additionalProperties": false
}),
)
.titled("Remove someone's admin role (admin)")
}