Skip to main content

wowlab_sentinel/mcp/tools/
labels.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3use wowlab_types::data::SpellLabel;
4
5/// Input for the `list_spell_labels` tool.
6#[derive(Debug, Default, Deserialize, JsonSchema)]
7#[schemars(description = "List all known spell label IDs with their names. No parameters.")]
8#[expect(
9    clippy::empty_structs_with_brackets,
10    reason = "MCP input must remain a JSON object rather than a unit value"
11)]
12pub(super) struct ListSpellLabelsInput {}
13
14#[derive(Debug, Serialize)]
15pub(super) struct SpellLabelEntry {
16    pub id: i32,
17    pub name: String,
18}
19
20#[expect(
21    clippy::unused_async,
22    reason = "MCP route handlers share one asynchronous interface"
23)]
24pub(super) async fn handle(
25    _params: ListSpellLabelsInput,
26) -> Result<rmcp::model::CallToolResult, rmcp::ErrorData> {
27    let labels: Vec<SpellLabelEntry> = SpellLabel::known()
28        .map(|(label, name)| SpellLabelEntry {
29            id: i32::from(label),
30            name: name.to_string(),
31        })
32        .collect();
33
34    Ok(crate::mcp::json_result(labels))
35}