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,
Annotations {
#[command(subcommand)]
command: GetCommand,
},
BlobResourceContents {
#[command(subcommand)]
command: GetCommand,
},
Icon {
#[command(subcommand)]
command: GetCommand,
},
IconTheme {
#[command(subcommand)]
command: GetCommand,
},
ResourceContents {
#[command(subcommand)]
command: GetCommand,
},
ResourceContentsUnion {
#[command(subcommand)]
command: GetCommand,
},
Role {
#[command(subcommand)]
command: GetCommand,
},
TextResourceContents {
#[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] = &["Annotations", "BlobResourceContents", "Icon", "IconTheme", "ResourceContents", "ResourceContentsUnion", "Role", "TextResourceContents"];
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::Annotations { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/mcp.shared.Annotations.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::BlobResourceContents { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/mcp.shared.BlobResourceContents.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::Icon { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/mcp.shared.Icon.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::IconTheme { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/mcp.shared.IconTheme.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::ResourceContents { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/mcp.shared.ResourceContents.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::ResourceContentsUnion { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/mcp.shared.ResourceContentsUnion.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::Role { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/mcp.shared.Role.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::TextResourceContents { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/mcp.shared.TextResourceContents.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(())
}
}
}
}