Skip to content

Commit e3378c6

Browse files
committed
docs update for tool settings globbing support
1 parent f6f92e2 commit e3378c6

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

crates/chat-cli/src/cli/chat/tools/custom_tool.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use crate::cli::agent::{
2424
};
2525
use crate::cli::chat::CONTINUATION_LINE;
2626
use crate::cli::chat::token_counter::TokenCounter;
27-
use crate::os::Os;
2827
use crate::mcp_client::{
2928
Client as McpClient,
3029
ClientConfig as McpClientConfig,
@@ -37,6 +36,7 @@ use crate::mcp_client::{
3736
StdioTransport,
3837
ToolCallResult,
3938
};
39+
use crate::os::Os;
4040

4141
// TODO: support http transport type
4242
#[derive(Clone, Serialize, Deserialize, Debug, Eq, PartialEq, JsonSchema)]
@@ -321,7 +321,10 @@ mod tests {
321321
}
322322

323323
// Test basic substitution
324-
assert_eq!(substitute_env_vars("Value is ${env:TEST_VAR}", &os.env), "Value is test_value");
324+
assert_eq!(
325+
substitute_env_vars("Value is ${env:TEST_VAR}", &os.env),
326+
"Value is test_value"
327+
);
325328

326329
// Test multiple substitutions
327330
assert_eq!(
@@ -330,7 +333,10 @@ mod tests {
330333
);
331334

332335
// Test non-existent variable
333-
assert_eq!(substitute_env_vars("${env:NON_EXISTENT_VAR}", &os.env), "${NON_EXISTENT_VAR}");
336+
assert_eq!(
337+
substitute_env_vars("${env:NON_EXISTENT_VAR}", &os.env),
338+
"${NON_EXISTENT_VAR}"
339+
);
334340

335341
// Test mixed content
336342
assert_eq!(

crates/chat-cli/src/cli/chat/tools/fs_write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl FsWrite {
407407
return PermissionEvalResult::Deny({
408408
denied_match_set
409409
.iter()
410-
.filter_map(|i| sanitized_deny_list.get(*i).map(|s| s.to_string()))
410+
.filter_map(|i| sanitized_deny_list.get(*i).map(|s| (*s).clone()))
411411
.collect::<Vec<_>>()
412412
});
413413
}

docs/built-in-tools.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Execute the specified bash command.
2121
"toolsSettings": {
2222
"execute_bash": {
2323
"allowedCommands": ["git status", "git fetch"],
24+
"deniedCommands": ["git commit .*", "git push .*"],
2425
"allowReadOnly": true
2526
}
2627
}
@@ -31,7 +32,8 @@ Execute the specified bash command.
3132

3233
| Option | Type | Default | Description |
3334
|--------|------|---------|------------------------------------------------------------------------------------------|
34-
| `allowedCommands` | array of strings | `[]` | List of specific commands that are allowed without prompting. Supports regex formatting. Note that regex entered are anchored with \A and \z. |
35+
| `allowedCommands` | array of strings | `[]` | List of specific commands that are allowed without prompting. Supports regex formatting. Note that regex entered are anchored with \A and \z |
36+
| `deniedCommands` | array of strings | `[]` | List of specific commands that are denied. Supports regex formatting. Note that regex entered are anchored with \A and \z. Deny rules are evaluated before allow rules |
3537
| `allowReadOnly` | boolean | `true` | Whether to allow read-only commands without prompting |
3638

3739
## Fs_read Tool
@@ -44,7 +46,8 @@ Tool for reading files, directories, and images.
4446
{
4547
"toolsSettings": {
4648
"fs_read": {
47-
"allowedPaths": ["~/projects", "./src/**"]
49+
"allowedPaths": ["~/projects", "./src/**"],
50+
"deniedPaths": ["/some/denied/path/", "/another/denied/path/**/file.txt"]
4851
}
4952
}
5053
}
@@ -54,7 +57,8 @@ Tool for reading files, directories, and images.
5457

5558
| Option | Type | Default | Description |
5659
|--------|------|---------|-------------|
57-
| `allowedPaths` | array of strings | `[]` | List of paths that can be read without prompting. Supports glob patterns. |
60+
| `allowedPaths` | array of strings | `[]` | List of paths that can be read without prompting. Supports glob patterns |
61+
| `deniedPaths` | array of strings | `[]` | List of paths that are denied. Supports glob patterns. Deny rules are evaluated before allow rules |
5862

5963
## Fs_write Tool
6064

@@ -66,7 +70,8 @@ Tool for creating and editing files.
6670
{
6771
"toolsSettings": {
6872
"fs_write": {
69-
"allowedPaths": ["~/projects/output.txt", "./src/**"]
73+
"allowedPaths": ["~/projects/output.txt", "./src/**"],
74+
"deniedPaths": ["/some/denied/path/", "/another/denied/path/**/file.txt"]
7075
}
7176
}
7277
}
@@ -76,7 +81,8 @@ Tool for creating and editing files.
7681

7782
| Option | Type | Default | Description |
7883
|--------|------|---------|-------------|
79-
| `allowedPaths` | array of strings | `[]` | List of paths that can be written to without prompting. Supports glob patterns. |
84+
| `allowedPaths` | array of strings | `[]` | List of paths that can be written to without prompting. Supports glob patterns |
85+
| `deniedPaths` | array of strings | `[]` | List of paths that are denied. Supports glob patterns. Deny rules are evaluated before allow rules |
8086

8187
## Report_issue Tool
8288

@@ -106,7 +112,8 @@ Make AWS CLI API calls with the specified service, operation, and parameters.
106112
{
107113
"toolsSettings": {
108114
"use_aws": {
109-
"allowedServices": ["s3", "lambda", "ec2"]
115+
"allowedServices": ["s3", "lambda", "ec2"],
116+
"deniedServices": ["eks", "rds"]
110117
}
111118
}
112119
}
@@ -117,6 +124,7 @@ Make AWS CLI API calls with the specified service, operation, and parameters.
117124
| Option | Type | Default | Description |
118125
|--------|------|---------|-------------|
119126
| `allowedServices` | array of strings | `[]` | List of AWS services that can be accessed without prompting |
127+
| `deniedServices` | array of strings | `[]` | List of AWS services to deny. Deny rules are evaluated before allow rules |
120128

121129
## Using Tool Settings in Agent Configuration
122130

0 commit comments

Comments
 (0)