Skip to main content

wowlab_sentinel/mcp/tools/
parse_simc.rs

1use schemars::JsonSchema;
2use serde::Deserialize;
3use wowlab_parsers::parse_simc;
4
5/// Input for the `parse_simc` MCP tool.
6#[derive(Debug, Default, Deserialize, JsonSchema)]
7#[schemars(
8    description = "Parse a SimulationCraft profile string into structured character, equipment, talents, and metadata."
9)]
10pub(crate) struct ParseSimcInput {
11    #[schemars(
12        description = "Raw SimC profile text, e.g. the output of `/simc` in-game or a saved .simc file."
13    )]
14    profile: String,
15}
16
17#[expect(
18    clippy::unused_async,
19    reason = "MCP route handlers share one asynchronous interface"
20)]
21pub(super) async fn handle(
22    params: ParseSimcInput,
23) -> Result<rmcp::model::CallToolResult, rmcp::ErrorData> {
24    let profile = parse_simc(&params.profile).map_err(|e| {
25        crate::mcp::mcp_error(
26            crate::telemetry::McpTool::ParseSimc,
27            &format!("Failed to parse SimC profile: {e}"),
28        )
29    })?;
30
31    Ok(crate::mcp::json_result(profile))
32}