Skip to main content

tdm_server_rust/dev/mcp/
mod.rs

1//! MCP 排查:SkyWalking trace 查询模板
2
3use serde_json::json;
4
5/// 生成 SkyWalking UI / GraphQL 排查指引 JSON
6pub fn trace_lookup_template(ui_base: &str, trace_id: &str) -> serde_json::Value {
7    let ui = ui_base.trim().trim_end_matches('/');
8    json!({
9        "trace_id": trace_id,
10        "skywalking_ui": format!("{ui}/trace?traceId={trace_id}"),
11        "graphql_hint": {
12            "endpoint": "http://127.0.0.1:12800/graphql",
13            "query": format!(
14                r#"query {{ trace: queryTrace(traceId: "{trace_id}") {{ spans {{ endpointName duration isError }} }} }}"#
15            ),
16        },
17        "log_search": format!("在 SkyWalking Log 面板搜索 traceId={trace_id}"),
18    })
19}