or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cli-interface.mdconfiguration.mdextensions.mdindex.mdinteractive-commands.mdmcp-integration.mdthemes.md

cli-interface.mddocs/

0

# Command Line Interface

1

2

The Gemini CLI provides a comprehensive command-line interface supporting both interactive and non-interactive modes with extensive configuration options.

3

4

## Capabilities

5

6

### Binary Command

7

8

Main CLI entry point supporting various execution modes and configuration options.

9

10

```bash { .api }

11

gemini [options] [promptWords...]

12

```

13

14

**Usage Examples:**

15

16

```bash

17

# Interactive mode

18

gemini

19

20

# Direct prompt

21

gemini "Explain TypeScript generics"

22

23

# Model selection

24

gemini --model gemini-2.0-flash-exp "Review my code"

25

26

# Sandbox execution

27

gemini --sandbox "Create a web server"

28

29

# Non-interactive with stdin

30

echo "What is async/await?" | gemini --prompt "Explain this"

31

```

32

33

### Global CLI Options

34

35

#### Model and Generation Options

36

37

```bash { .api }

38

--model, -m <string> # Gemini model to use (default: from GEMINI_MODEL env)

39

--prompt, -p <string> # Non-interactive prompt (appended to stdin)

40

--prompt-interactive, -i <string> # Execute prompt then continue interactively

41

```

42

43

**Usage Examples:**

44

45

```bash

46

# Specify model

47

gemini --model gemini-2.0-flash-exp "Generate a function"

48

49

# Non-interactive execution

50

gemini --prompt "Summarize this file" < document.txt

51

52

# Interactive after initial prompt

53

gemini --prompt-interactive "Start by reviewing my code"

54

```

55

56

#### Execution Environment Options

57

58

```bash { .api }

59

--sandbox, -s # Run in sandbox environment

60

--sandbox-image <string> # Specific sandbox image URI

61

--debug, -d # Enable debug mode

62

--yolo, -y # Auto-accept all actions (YOLO mode)

63

--approval-mode <mode> # Set approval mode: default, auto_edit, yolo

64

```

65

66

**Usage Examples:**

67

68

```bash

69

# Enable sandbox

70

gemini --sandbox "Install and test npm packages"

71

72

# Debug mode

73

gemini --debug "Troubleshoot this issue"

74

75

# Auto-accept mode

76

gemini --yolo "Fix all TypeScript errors"

77

78

# Specific approval mode

79

gemini --approval-mode auto_edit "Refactor this code"

80

```

81

82

#### Context and File Options

83

84

```bash { .api }

85

--all-files, -a # Include ALL files in context (deprecated)

86

--include-directories <dirs> # Additional directories to include (comma-separated)

87

--checkpointing, -c # Enable file edit checkpointing

88

```

89

90

**Usage Examples:**

91

92

```bash

93

# Include additional directories

94

gemini --include-directories "src,tests,docs" "Review the entire project"

95

96

# Enable checkpointing for file edits

97

gemini --checkpointing "Refactor the authentication module"

98

```

99

100

#### Tool Configuration Options

101

102

```bash { .api }

103

--allowed-tools <tools> # Tools allowed without confirmation (comma-separated)

104

--allowed-mcp-server-names <names> # Allowed MCP server names (comma-separated)

105

--extensions, -e <names> # Specific extensions to use (comma-separated)

106

--list-extensions, -l # List all available extensions and exit

107

```

108

109

**Usage Examples:**

110

111

```bash

112

# Allow specific tools

113

gemini --allowed-tools "file_edit,shell" "Update configuration files"

114

115

# Use specific extensions

116

gemini --extensions "github-integration,code-formatter" "Push changes to GitHub"

117

118

# List available extensions

119

gemini --list-extensions

120

```

121

122

#### Telemetry and Monitoring Options

123

124

```bash { .api }

125

--telemetry # Enable telemetry

126

--telemetry-target <target> # Telemetry target: local, gcp

127

--telemetry-otlp-endpoint <url> # OTLP endpoint URL

128

--telemetry-otlp-protocol <protocol> # OTLP protocol: grpc, http

129

--telemetry-log-prompts # Enable prompt logging in telemetry

130

--telemetry-outfile <file> # Redirect telemetry to file

131

--show-memory-usage # Show memory usage in status bar

132

```

133

134

#### Accessibility and UI Options

135

136

```bash { .api }

137

--screen-reader # Enable screen reader mode

138

--session-summary <file> # Write session summary to file

139

--proxy <url> # Proxy configuration

140

--experimental-acp # Enable ACP mode

141

```

142

143

## Subcommands

144

145

### MCP Server Management

146

147

Commands for managing Model Context Protocol servers.

148

149

```bash { .api }

150

gemini mcp <command> [options]

151

```

152

153

#### MCP Add Command

154

155

```bash { .api }

156

gemini mcp add <name> <commandOrUrl> [args...] [options]

157

158

# Options:

159

--scope, -s <scope> # Configuration scope: user, project

160

--transport, -t <type> # Transport type: stdio, sse, http

161

--env, -e <KEY=value> # Environment variables (repeatable)

162

--header, -H <header> # HTTP headers for SSE/HTTP (repeatable)

163

--timeout <ms> # Connection timeout in milliseconds

164

--trust # Trust server (bypass confirmations)

165

--description <desc> # Server description

166

--include-tools <tools> # Include specific tools (comma-separated)

167

--exclude-tools <tools> # Exclude specific tools (comma-separated)

168

```

169

170

**Usage Examples:**

171

172

```bash

173

# Add stdio MCP server

174

gemini mcp add weather-server npx weather-mcp-server

175

176

# Add HTTP MCP server with headers

177

gemini mcp add api-server http://localhost:3000/mcp \

178

--transport http \

179

--header "Authorization: Bearer token123" \

180

--trust

181

182

# Add with environment variables

183

gemini mcp add database-server python db-mcp.py \

184

--env "DB_HOST=localhost" \

185

--env "DB_PORT=5432" \

186

--scope user

187

```

188

189

#### MCP List and Remove Commands

190

191

```bash { .api }

192

gemini mcp list # List configured MCP servers

193

gemini mcp remove <name> # Remove MCP server by name

194

```

195

196

### Extension Management

197

198

Commands for managing CLI extensions.

199

200

```bash { .api }

201

gemini extensions <command> [options]

202

```

203

204

#### Extension Commands

205

206

```bash { .api }

207

gemini extensions install <source> # Install extension from source

208

gemini extensions uninstall <name> # Remove extension by name

209

gemini extensions list # Show installed extensions

210

gemini extensions update [name] # Update extension(s)

211

gemini extensions enable <name> # Enable extension

212

gemini extensions disable <name> # Disable extension

213

gemini extensions link <path> # Link local extension for development

214

gemini extensions new <name> # Create new extension template

215

```

216

217

**Usage Examples:**

218

219

```bash

220

# Install from GitHub

221

gemini extensions install https://github.com/user/gemini-ext-example

222

223

# Install from local directory

224

gemini extensions install ./my-extension

225

226

# Update specific extension

227

gemini extensions update my-extension

228

229

# Update all extensions

230

gemini extensions update

231

232

# Link for development

233

gemini extensions link ./development/my-extension

234

```

235

236

## Environment Variables

237

238

### Runtime Configuration

239

240

```bash { .api }

241

GEMINI_MODEL # Default model to use

242

NO_COLOR # Disable colors (activates no-color theme)

243

DEBUG / DEBUG_MODE # Enable debug mode

244

CLOUD_SHELL # Indicates Cloud Shell environment

245

SANDBOX # Indicates sandbox environment

246

GEMINI_CLI_NO_RELAUNCH # Prevent memory-based relaunching

247

```

248

249

### HTTP Configuration

250

251

```bash { .api }

252

HTTPS_PROXY / https_proxy # HTTPS proxy configuration

253

HTTP_PROXY / http_proxy # HTTP proxy configuration

254

```

255

256

### Telemetry Configuration

257

258

```bash { .api }

259

OTEL_EXPORTER_OTLP_ENDPOINT # OpenTelemetry OTLP endpoint

260

```

261

262

## CLI Arguments Interface

263

264

Internal CLI arguments structure (not exposed for programmatic use):

265

266

```typescript { .api }

267

interface CliArgs {

268

// Model and generation

269

model?: string;

270

prompt?: string;

271

promptInteractive?: string;

272

273

// Execution environment

274

sandbox?: boolean | string;

275

debug?: boolean;

276

yolo?: boolean;

277

approvalMode?: 'default' | 'auto_edit' | 'yolo';

278

279

// Context and files

280

allFiles?: boolean;

281

includeDirectories?: string[];

282

checkpointing?: boolean;

283

284

// Tool configuration

285

allowedTools?: string[];

286

allowedMcpServerNames?: string[];

287

extensions?: string[];

288

listExtensions?: boolean;

289

290

// Telemetry and monitoring

291

telemetry?: boolean;

292

telemetryTarget?: 'local' | 'gcp';

293

telemetryOtlpEndpoint?: string;

294

telemetryOtlpProtocol?: 'grpc' | 'http';

295

telemetryLogPrompts?: boolean;

296

telemetryOutfile?: string;

297

showMemoryUsage?: boolean;

298

299

// UI and accessibility

300

screenReader?: boolean;

301

sessionSummary?: string;

302

proxy?: string;

303

experimentalAcp?: boolean;

304

305

// Positional arguments

306

promptWords?: string[];

307

}

308

```