pub struct PendingGeneration {
pub server_id: ServerId,
pub server_info: ServerInfo,
pub config: ServerConfig,
pub output_dir_override: Option<PathBuf>,
pub created_at: DateTime<Utc>,
pub expires_at: DateTime<Utc>,
}Expand description
Pending generation session.
Stores introspection data between introspect_server and
save_categorized_tools calls.
Fields§
§server_id: ServerIdServer identifier
server_info: ServerInfoFull server introspection data
config: ServerConfigServer configuration for regeneration if needed
output_dir_override: Option<PathBuf>Caller-supplied output_dir override from introspect_server, exactly as received
(already validated as syntactically safe - relative, no .. - but not yet confinement-
checked against the filesystem). None when the default {server_id} directory was
used.
save_categorized_tools derives the real export target fresh from this and
Self::server_id immediately before writing anything - see
crate::output_dir::resolve_output_dir.
created_at: DateTime<Utc>Session creation time
expires_at: DateTime<Utc>Session expiration time (30 minutes default)
Implementations§
Source§impl PendingGeneration
impl PendingGeneration
Sourcepub const DEFAULT_TIMEOUT_MINUTES: i64 = 30
pub const DEFAULT_TIMEOUT_MINUTES: i64 = 30
Default session timeout: 30 minutes.
Sourcepub fn new(
server_id: ServerId,
server_info: ServerInfo,
config: ServerConfig,
output_dir_override: Option<PathBuf>,
clock: &dyn Clock,
) -> Self
pub fn new( server_id: ServerId, server_info: ServerInfo, config: ServerConfig, output_dir_override: Option<PathBuf>, clock: &dyn Clock, ) -> Self
Creates a new pending generation session.
The session’s created_at/expires_at are derived from clock.now(),
so tests can inject a fake clock instead of rewinding expires_at
after construction. Production callers should pass SystemClock.
§Examples
use mcp_execution_server::types::PendingGeneration;
use mcp_execution_server::clock::SystemClock;
use mcp_execution_core::{ServerId, ServerConfig};
use mcp_execution_introspector::ServerInfo;
use std::path::PathBuf;
let server_id = ServerId::new("github").unwrap();
let config = ServerConfig::builder()
.command("npx".to_string())
.arg("-y".to_string())
.arg("@anthropic/mcp-server-github".to_string())
.build()
.unwrap();
let pending = PendingGeneration::new(
server_id,
server_info,
config,
None,
&SystemClock,
);Sourcepub fn is_expired(&self, clock: &dyn Clock) -> bool
pub fn is_expired(&self, clock: &dyn Clock) -> bool
Checks if this session has expired, using clock.now() as the current time.
§Examples
use mcp_execution_server::types::PendingGeneration;
use mcp_execution_server::clock::SystemClock;
let pending = PendingGeneration::new(
ServerId::new("test").unwrap(),
server_info,
ServerConfig::builder().command("echo".to_string()).build().unwrap(),
None,
&SystemClock,
);
assert!(!pending.is_expired(&SystemClock));Trait Implementations§
Source§impl Clone for PendingGeneration
impl Clone for PendingGeneration
Source§fn clone(&self) -> PendingGeneration
fn clone(&self) -> PendingGeneration
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more