systemprompt_cli/commands/infrastructure/logs/tools/
mod.rs1mod list;
10
11use anyhow::Result;
12use clap::Subcommand;
13use schemars::JsonSchema;
14use serde::{Deserialize, Serialize};
15use systemprompt_identifiers::TraceId;
16
17use crate::context::CommandContext;
18
19#[derive(Debug, Subcommand)]
20pub enum ToolsCommands {
21 #[command(
22 about = "List MCP tool executions",
23 after_help = "EXAMPLES:\n systemprompt infra logs tools list\n systemprompt infra logs \
24 tools list --name research_blog\n systemprompt infra logs tools list \
25 --server content-manager --since 1h"
26 )]
27 List(list::ListArgs),
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
31pub struct ToolExecutionRow {
32 pub timestamp: String,
33 pub trace_id: TraceId,
34 pub tool_name: String,
35 pub server: String,
36 pub status: String,
37 #[serde(skip_serializing_if = "Option::is_none")]
38 pub duration_ms: Option<i64>,
39}
40
41#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
42pub struct ToolsListOutput {
43 pub executions: Vec<ToolExecutionRow>,
44 pub total: u64,
45}
46
47pub async fn execute(command: ToolsCommands, ctx: &CommandContext) -> Result<()> {
48 match command {
49 ToolsCommands::List(args) => list::execute(args, ctx).await,
50 }
51}