Skip to main content

systemprompt_analytics/repository/tools/
mod.rs

1//! MCP tool-execution analytics over `mcp_tool_executions`.
2//!
3//! [`ToolAnalyticsRepository`] reports tool success/failure/timeout rates,
4//! latency percentiles, error and per-agent breakdowns, and trend series.
5//! Cross-tool listing lives in `list_queries`, single-tool drill-down in
6//! `detail_queries`.
7//!
8//! Copyright (c) systemprompt.io — Business Source License 1.1.
9//! See <https://systemprompt.io> for licensing details.
10
11mod detail_queries;
12pub(super) mod list_queries;
13
14use sqlx::PgPool;
15use std::sync::Arc;
16use systemprompt_database::DbPool;
17
18#[derive(Debug)]
19pub struct ToolAnalyticsRepository {
20    pool: Arc<PgPool>,
21}
22
23impl ToolAnalyticsRepository {
24    pub fn new(db: &DbPool) -> Self {
25        let pool = db.pool();
26        Self { pool }
27    }
28}