Skip to main content

objectiveai_cli/command/tools/
get.rs

1//! `tools get` — read one tool's manifest by `(owner, name, version)`.
2//! Returns `None` if not present.
3
4use objectiveai_sdk::cli::command::tools::get::{Request, Response};
5
6use crate::context::Context;
7use crate::error::Error;
8
9pub async fn execute(ctx: &Context, request: Request) -> Result<Response, Error> {
10    Ok(ctx
11        .filesystem
12        .get_tool(&request.owner, &request.name, &request.version)
13        .await
14        .map(Into::into))
15}
16
17pub mod request_schema {
18    use objectiveai_sdk::cli::command::tools::get as sdk;
19    use objectiveai_sdk::cli::command::tools::get::request_schema::{Request, Response};
20
21    use crate::context::Context;
22    use crate::error::Error;
23
24    pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
25        Ok(objectiveai_sdk::cli::command::ResponseSchema(schemars::schema_for!(sdk::Request)))
26    }
27}
28
29pub mod response_schema {
30    use objectiveai_sdk::cli::command::tools::get as sdk;
31    use objectiveai_sdk::cli::command::tools::get::response_schema::{Request, Response};
32
33    use crate::context::Context;
34    use crate::error::Error;
35
36    pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
37        Ok(objectiveai_sdk::cli::command::ResponseSchema(schemars::schema_for!(sdk::Response)))
38    }
39}