You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add `trusted_tools` config option to allow automatic execution of
trusted tool calls without manual approval. By default, all tool calls
require approval, but users can now trust specific tools, groups, or all
tools. Update README and type annotations to document the new behavior.
Trusted tools are determined by function definition, group, or name.
Closes#1534
CopilotChat.nvim brings GitHub Copilot Chat capabilities directly into Neovim with a focus on transparency and user control.
20
20
21
21
- 🤖 **Multiple AI Models** - GitHub Copilot (including GPT-4o, Gemini 2.5 Pro, Claude 4 Sonnet, Claude 3.7 Sonnet, Claude 3.5 Sonnet, o3-mini, o4-mini) + custom providers (Ollama, Mistral.ai). The exact list of available models depends on your [GitHub Copilot settings](https://github.com/settings/copilot/features) and the models provided by GitHub's API.
22
-
- 🔧 **Tool Calling** - LLM can call workspace functions (file reading, git operations, search) with your explicit approval
22
+
- 🔧 **Tool Calling** - LLM can call workspace functions (file reading, git operations, search) with manual approval or automatic execution for trusted tools
23
23
- 🔒 **Privacy First** - Only shares what you explicitly request - no background data collection
24
24
- 📝 **Interactive Chat** - Interactive UI with completion, diffs, and quickfix integration
25
25
- 🎯 **Smart Prompts** - Composable templates and sticky prompts for consistent context
@@ -92,7 +92,7 @@ EOF
92
92
# Core Concepts
93
93
94
94
-**Resources** (`#<name>`) - Add specific content (files, git diffs, URLs) to your prompt
95
-
-**Tools** (`@<name>`) - Give LLM access to functions it can call with your approval
95
+
-**Tools** (`@<name>`) - Give LLM access to functions it can call during the chat, with manual approval by default
96
96
-**Sticky Prompts** (`> <text>`) - Persist context across single chat session
97
97
-**Models** (`$<model>`) - Specify which AI model to use for the chat
98
98
-**Prompts** (`/PromptName`) - Use predefined prompt templates for common tasks
@@ -114,7 +114,15 @@ EOF
114
114
> You are a helpful coding assistant
115
115
```
116
116
117
-
When you use `@copilot`, the LLM can call functions like `bash`, `edit`, `file`, `glob`, `grep`, `gitdiff` etc. You'll see the proposed function call and can approve/reject it before execution.
117
+
When you use `@copilot`, the LLM can call functions from the `copilot` group such as `bash`, `edit`, `file`, `glob`, `grep`, and `gitdiff`.
118
+
119
+
- By default, proposed tool calls wait for your approval.
120
+
- You can configure `trusted_tools` to automatically run specific tools or groups.
121
+
- Resources added with `#...` are resolved immediately and shared as context.
122
+
- Tool call results are sent back to the model as plain output, while manual resources keep their `##<uri>` references in chat.
123
+
124
+
> [!WARNING]
125
+
> `trusted_tools = true` allows the model to run every enabled tool without asking. Only use it if you fully trust the tool set and workspace.
118
126
119
127
# Usage
120
128
@@ -136,21 +144,20 @@ When you use `@copilot`, the LLM can call functions like `bash`, `edit`, `file`,
-`CopilotChatAnnotationHeader` - Annotation header highlight in chat buffer
281
293
282
294
## Prompts
283
295
@@ -304,14 +316,44 @@ Define your own prompts in the configuration:
304
316
305
317
## Functions
306
318
319
+
Use `trusted_tools` to control which tool calls are executed automatically:
320
+
321
+
```lua
322
+
{
323
+
trusted_tools=nil, -- default: require approval for all tool calls
324
+
325
+
-- trust all functions in a group
326
+
-- trusted_tools = 'copilot',
327
+
328
+
-- trust specific functions by name or groups by name
329
+
-- trusted_tools = { 'file', 'glob', 'grep' },
330
+
331
+
-- trust every enabled tool call
332
+
-- trusted_tools = true,
333
+
}
334
+
```
335
+
336
+
A tool is trusted when any of these match:
337
+
338
+
- Its function definition sets `trusted = true`
339
+
- Its function name appears in `trusted_tools`
340
+
- Its function group appears in `trusted_tools`
341
+
-`trusted_tools = true`
342
+
343
+
For most setups, trusting a few read-only functions such as `file`, `glob`, or `grep` is safer than trusting everything.
344
+
345
+
> [!WARNING]
346
+
> Trusted tools run without asking for confirmation. Be especially careful with tools like `bash` and `edit`, which can change your workspace.
347
+
307
348
Define your own functions in the configuration with input handling and schema:
308
349
309
350
```lua
310
351
{
311
352
functions= {
312
353
birthday= {
313
-
description="Retrieves birthday information for a person",
314
-
uri="birthday://{name}",
354
+
description='Retrieves birthday information for a person',
355
+
uri='birthday://{name}',
356
+
trusted=false,
315
357
schema= {
316
358
type='object',
317
359
required= { 'name' },
@@ -329,14 +371,16 @@ Define your own functions in the configuration with input handling and schema:
329
371
uri='birthday://' ..input.name,
330
372
mimetype='text/plain',
331
373
data=input.name..' birthday info',
332
-
}
374
+
},
333
375
}
334
-
end
335
-
}
376
+
end,
377
+
},
336
378
}
337
379
}
338
380
```
339
381
382
+
If a function has a `uri`, it can be used manually with `#birthday:Alice`. Functions without a `uri` are tool-only and can only be called by the model.
0 commit comments