opencode_sdk/http/
tools.rs1use crate::error::Result;
6use crate::http::HttpClient;
7use crate::types::tool::{Agent, Command, Tool, ToolIds};
8use reqwest::Method;
9
10#[derive(Clone)]
12pub struct ToolsApi {
13 http: HttpClient,
14}
15
16impl ToolsApi {
17 pub fn new(http: HttpClient) -> Self {
19 Self { http }
20 }
21
22 pub async fn ids(&self) -> Result<ToolIds> {
28 self.http
29 .request_json(Method::GET, "/experimental/tool/ids", None)
30 .await
31 }
32
33 pub async fn list(&self) -> Result<Vec<Tool>> {
39 self.http
40 .request_json(Method::GET, "/experimental/tool", None)
41 .await
42 }
43
44 pub async fn agents(&self) -> Result<Vec<Agent>> {
50 self.http.request_json(Method::GET, "/agent", None).await
51 }
52
53 pub async fn commands(&self) -> Result<Vec<Command>> {
59 self.http.request_json(Method::GET, "/command", None).await
60 }
61}