pub mod resource;
pub mod shared;
pub mod tool;
use clap::Subcommand;
#[derive(Subcommand)]
#[command(rename_all = "verbatim")]
pub enum GetCommand {
#[command(name = "get")]
Get,
}
#[derive(Subcommand)]
#[command(rename_all = "verbatim")]
pub enum Commands {
#[command(name = "list")]
List,
#[command(name = "resource")]
Resource {
#[command(subcommand)]
command: resource::Commands,
},
#[command(name = "shared")]
Shared {
#[command(subcommand)]
command: shared::Commands,
},
#[command(name = "tool")]
Tool {
#[command(subcommand)]
command: tool::Commands,
},
CompletionsCapability {
#[command(subcommand)]
command: GetCommand,
},
Implementation {
#[command(subcommand)]
command: GetCommand,
},
InitializeResult {
#[command(subcommand)]
command: GetCommand,
},
JsonRpcError {
#[command(subcommand)]
command: GetCommand,
},
JsonRpcNotification {
#[command(subcommand)]
command: GetCommand,
},
JsonRpcRequest {
#[command(subcommand)]
command: GetCommand,
},
LoggingCapability {
#[command(subcommand)]
command: GetCommand,
},
PromptsCapability {
#[command(subcommand)]
command: GetCommand,
},
ResourcesCapability {
#[command(subcommand)]
command: GetCommand,
},
ServerCapabilities {
#[command(subcommand)]
command: GetCommand,
},
TasksCancelCapability {
#[command(subcommand)]
command: GetCommand,
},
TasksCapability {
#[command(subcommand)]
command: GetCommand,
},
TasksListCapability {
#[command(subcommand)]
command: GetCommand,
},
TasksRequestsCapability {
#[command(subcommand)]
command: GetCommand,
},
TasksToolsCallCapability {
#[command(subcommand)]
command: GetCommand,
},
TasksToolsCapability {
#[command(subcommand)]
command: GetCommand,
},
ToolsCapability {
#[command(subcommand)]
command: GetCommand,
},
}
impl Commands {
pub async fn handle(self, handle: &objectiveai_cli_sdk::output::Handle) -> Result<(), crate::error::Error> {
match self {
Commands::List => {
const NAMES: &[&str] = &["resource", "shared", "tool", "CompletionsCapability", "Implementation", "InitializeResult", "JsonRpcError", "JsonRpcNotification", "JsonRpcRequest", "LoggingCapability", "PromptsCapability", "ResourcesCapability", "ServerCapabilities", "TasksCancelCapability", "TasksCapability", "TasksListCapability", "TasksRequestsCapability", "TasksToolsCallCapability", "TasksToolsCapability", "ToolsCapability"];
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schemas>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schemas {
schemas: NAMES.iter().map(|s| s.to_string()).collect(),
},
},
).emit(handle).await;
Ok(())
}
Commands::Resource { command } => command.handle(handle).await,
Commands::Shared { command } => command.handle(handle).await,
Commands::Tool { command } => command.handle(handle).await,
Commands::CompletionsCapability { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.CompletionsCapability.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::Implementation { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.Implementation.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::InitializeResult { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.InitializeResult.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::JsonRpcError { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.JsonRpcError.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::JsonRpcNotification { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.JsonRpcNotification.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::JsonRpcRequest { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.JsonRpcRequest.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::LoggingCapability { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.LoggingCapability.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::PromptsCapability { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.PromptsCapability.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::ResourcesCapability { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.ResourcesCapability.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::ServerCapabilities { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.ServerCapabilities.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::TasksCancelCapability { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.TasksCancelCapability.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::TasksCapability { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.TasksCapability.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::TasksListCapability { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.TasksListCapability.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::TasksRequestsCapability { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.TasksRequestsCapability.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::TasksToolsCallCapability { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.TasksToolsCallCapability.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::TasksToolsCapability { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.TasksToolsCapability.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::ToolsCapability { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/mcp.ToolsCapability.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
}
}
}