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