systemprompt_identifiers/mcp.rs
1//! MCP-protocol identifiers (server, execution, tool-call).
2
3crate::define_id!(AiToolCallId, schema);
4crate::define_id!(McpExecutionId, generate, schema);
5crate::define_id!(McpServerId, non_empty);
6
7impl McpServerId {
8 pub fn from_env() -> Result<Self, crate::error::IdValidationError> {
9 let id = std::env::var("MCP_SERVICE_ID").map_err(|_| {
10 crate::error::IdValidationError::invalid(
11 "McpServerId",
12 "MCP_SERVICE_ID environment variable not set",
13 )
14 })?;
15 Self::try_new(id)
16 }
17}