Skip to content

--allowed-tools does not work in non-interactive mode #9011

@mistergarrison

Description

@mistergarrison

What happened?

--allowed-tools only applies to interactive mode, but is ignored if the prompt is supplied on the command-line. The following command should work, but doesn't:

gemini --allowed-tools="ShellTool(wc)" \
    --prompt="use wc to tell me how many lines there are in /proc/meminfo"

What did you expect to happen?

$ gemini --allowed-tools="ShellTool(wc)" \
    --prompt="use wc to tell me how many lines there are in /proc/meminfo"
There are 55 lines in /proc/meminfo.
$ 

Client information

Client Information

Run gemini to enter the interactive CLI, then run the /about command.

> /about
╭─────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                             │
│ About Gemini CLI                                                                            │
│                                                                                             │
│ CLI Version                     0.7.0-nightly.20250918.2722473a-git.fa8cea17                │
│ Git Commit                      fa8cea17                                                    │
│ Model                           gemini-2.5-pro                                              │
│ Sandbox                         no sandbox                                                  │
│ OS                              linux                                                       │
│ Auth Method                     gemini-api-key                                              │
│                                                                                             │
╰─────────────────────────────────────────────────────────────────────────────────────────────╯

Login information

n/a

Anything else we need to know?

It would be good if this was also fixed for tools.allowed in settings.json as well.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions