dnslib/mcp/tools/
stats.rs1use rmcp::{ErrorData as McpError, model::*};
2
3use crate::{
4 control_plane::policy::Policy,
5 core::dns::service::DnsService,
6 core::dns::stats,
7 mcp::{helpers::run_json, params::StatsParams},
8};
9
10pub async fn handle_get_stats<C: DnsService + Send + Sync>(
11 client: &C,
12 policy: &Policy,
13 p: StatsParams,
14) -> Result<CallToolResult, McpError> {
15 Ok(run_json(
16 "dns_get_stats",
17 policy.check_read(),
18 stats::get_stats(client, p.stats_type.as_deref().unwrap_or("LastDay")),
19 )
20 .await)
21}