use serde_json::{Value, json};
pub fn create_group_tool() -> Value {
json!({
"name": "scim_create_group",
"description": "Create a new group in the SCIM server",
"inputSchema": {
"type": "object",
"properties": {
"group_data": {
"type": "object",
"description": "Group data conforming to SCIM Group schema",
"properties": {
"schemas": {
"type": "array",
"items": {"type": "string"},
"description": "SCIM schemas for the group"
},
"displayName": {
"type": "string",
"description": "Human-readable name for the group"
},
"members": {
"type": "array",
"description": "Group members with user references",
"items": {
"type": "object",
"properties": {
"value": {"type": "string"},
"$ref": {"type": "string"},
"type": {"type": "string"}
}
}
},
"externalId": {
"type": "string",
"description": "External identifier for the group"
}
},
"required": ["schemas", "displayName"]
},
"tenant_id": {
"type": "string",
"description": "Optional tenant identifier"
}
},
"required": ["group_data"]
}
})
}
pub fn get_group_tool() -> Value {
json!({
"name": "scim_get_group",
"description": "Retrieve a group by ID from the SCIM server",
"inputSchema": {
"type": "object",
"properties": {
"group_id": {
"type": "string",
"description": "The unique identifier of the group to retrieve"
},
"tenant_id": {
"type": "string",
"description": "Optional tenant identifier"
}
},
"required": ["group_id"]
}
})
}
pub fn update_group_tool() -> Value {
json!({
"name": "scim_update_group",
"description": "Update an existing group in the SCIM server with optional versioning for optimistic locking",
"inputSchema": {
"type": "object",
"properties": {
"group_id": {
"type": "string",
"description": "The unique identifier of the group to update"
},
"group_data": {
"type": "object",
"description": "Updated group data conforming to SCIM Group schema"
},
"expected_version": {
"type": "string",
"description": "Optional version for conditional update (e.g., 'abc123def' or 'W/\"abc123def\"'). Raw format preferred for simplicity. If provided, update only succeeds if current version matches. Prevents lost updates in concurrent scenarios."
},
"tenant_id": {
"type": "string",
"description": "Optional tenant identifier"
}
},
"required": ["group_id", "group_data"]
}
})
}
pub fn delete_group_tool() -> Value {
json!({
"name": "scim_delete_group",
"description": "Delete a group from the SCIM server with optional versioning for safe deletion",
"inputSchema": {
"type": "object",
"properties": {
"group_id": {
"type": "string",
"description": "The unique identifier of the group to delete"
},
"expected_version": {
"type": "string",
"description": "Optional version for conditional delete (e.g., 'abc123def' or 'W/\"abc123def\"'). Raw format preferred for simplicity. If provided, delete only succeeds if current version matches. Prevents accidental deletion of modified resources."
},
"tenant_id": {
"type": "string",
"description": "Optional tenant identifier"
}
},
"required": ["group_id"]
}
})
}
pub fn list_groups_tool() -> Value {
json!({
"name": "scim_list_groups",
"description": "List groups with optional pagination and sorting",
"inputSchema": {
"type": "object",
"properties": {
"start_index": {
"type": "integer",
"minimum": 1,
"description": "1-based index of the first result to return"
},
"count": {
"type": "integer",
"minimum": 0,
"description": "Maximum number of results to return"
},
"tenant_id": {
"type": "string",
"description": "Optional tenant identifier"
}
}
}
})
}
pub fn search_groups_tool() -> Value {
json!({
"name": "scim_search_groups",
"description": "Search for groups by attribute value",
"inputSchema": {
"type": "object",
"properties": {
"attribute": {
"type": "string",
"description": "The attribute name to search by (e.g., 'displayName', 'externalId')"
},
"value": {
"description": "The value to search for"
},
"tenant_id": {
"type": "string",
"description": "Optional tenant identifier"
}
},
"required": ["attribute", "value"]
}
})
}
pub fn group_exists_tool() -> Value {
json!({
"name": "scim_group_exists",
"description": "Check if a group exists in the SCIM server",
"inputSchema": {
"type": "object",
"properties": {
"group_id": {
"type": "string",
"description": "The unique identifier of the group to check"
},
"tenant_id": {
"type": "string",
"description": "Optional tenant identifier"
}
},
"required": ["group_id"]
}
})
}