steer_tools/tools/
glob.rs1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3use thiserror::Error;
4
5use crate::ToolSpec;
6use crate::error::{ToolExecutionError, WorkspaceOpError};
7use crate::result::GlobResult;
8
9pub const GLOB_TOOL_NAME: &str = "glob";
10
11pub struct GlobToolSpec;
12
13impl ToolSpec for GlobToolSpec {
14 type Params = GlobParams;
15 type Result = GlobResult;
16 type Error = GlobError;
17
18 const NAME: &'static str = GLOB_TOOL_NAME;
19 const DISPLAY_NAME: &'static str = "Glob";
20
21 fn execution_error(error: Self::Error) -> ToolExecutionError {
22 ToolExecutionError::Glob(error)
23 }
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Error)]
27#[serde(tag = "code", content = "details", rename_all = "snake_case")]
28pub enum GlobError {
29 #[error("{0}")]
30 Workspace(WorkspaceOpError),
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
34pub struct GlobParams {
35 pub pattern: String,
37 pub path: Option<String>,
39}