Open-source AI agent providing terminal access to Gemini models with extensible tool support and developer-focused features
The Gemini CLI provides a comprehensive command-line interface supporting both interactive and non-interactive modes with extensive configuration options.
Main CLI entry point supporting various execution modes and configuration options.
gemini [options] [promptWords...]Usage Examples:
# Interactive mode
gemini
# Direct prompt
gemini "Explain TypeScript generics"
# Model selection
gemini --model gemini-2.0-flash-exp "Review my code"
# Sandbox execution
gemini --sandbox "Create a web server"
# Non-interactive with stdin
echo "What is async/await?" | gemini --prompt "Explain this"--model, -m <string> # Gemini model to use (default: from GEMINI_MODEL env)
--prompt, -p <string> # Non-interactive prompt (appended to stdin)
--prompt-interactive, -i <string> # Execute prompt then continue interactivelyUsage Examples:
# Specify model
gemini --model gemini-2.0-flash-exp "Generate a function"
# Non-interactive execution
gemini --prompt "Summarize this file" < document.txt
# Interactive after initial prompt
gemini --prompt-interactive "Start by reviewing my code"--sandbox, -s # Run in sandbox environment
--sandbox-image <string> # Specific sandbox image URI
--debug, -d # Enable debug mode
--yolo, -y # Auto-accept all actions (YOLO mode)
--approval-mode <mode> # Set approval mode: default, auto_edit, yoloUsage Examples:
# Enable sandbox
gemini --sandbox "Install and test npm packages"
# Debug mode
gemini --debug "Troubleshoot this issue"
# Auto-accept mode
gemini --yolo "Fix all TypeScript errors"
# Specific approval mode
gemini --approval-mode auto_edit "Refactor this code"--all-files, -a # Include ALL files in context (deprecated)
--include-directories <dirs> # Additional directories to include (comma-separated)
--checkpointing, -c # Enable file edit checkpointingUsage Examples:
# Include additional directories
gemini --include-directories "src,tests,docs" "Review the entire project"
# Enable checkpointing for file edits
gemini --checkpointing "Refactor the authentication module"--allowed-tools <tools> # Tools allowed without confirmation (comma-separated)
--allowed-mcp-server-names <names> # Allowed MCP server names (comma-separated)
--extensions, -e <names> # Specific extensions to use (comma-separated)
--list-extensions, -l # List all available extensions and exitUsage Examples:
# Allow specific tools
gemini --allowed-tools "file_edit,shell" "Update configuration files"
# Use specific extensions
gemini --extensions "github-integration,code-formatter" "Push changes to GitHub"
# List available extensions
gemini --list-extensions--telemetry # Enable telemetry
--telemetry-target <target> # Telemetry target: local, gcp
--telemetry-otlp-endpoint <url> # OTLP endpoint URL
--telemetry-otlp-protocol <protocol> # OTLP protocol: grpc, http
--telemetry-log-prompts # Enable prompt logging in telemetry
--telemetry-outfile <file> # Redirect telemetry to file
--show-memory-usage # Show memory usage in status bar--screen-reader # Enable screen reader mode
--session-summary <file> # Write session summary to file
--proxy <url> # Proxy configuration
--experimental-acp # Enable ACP modeCommands for managing Model Context Protocol servers.
gemini mcp <command> [options]gemini mcp add <name> <commandOrUrl> [args...] [options]
# Options:
--scope, -s <scope> # Configuration scope: user, project
--transport, -t <type> # Transport type: stdio, sse, http
--env, -e <KEY=value> # Environment variables (repeatable)
--header, -H <header> # HTTP headers for SSE/HTTP (repeatable)
--timeout <ms> # Connection timeout in milliseconds
--trust # Trust server (bypass confirmations)
--description <desc> # Server description
--include-tools <tools> # Include specific tools (comma-separated)
--exclude-tools <tools> # Exclude specific tools (comma-separated)Usage Examples:
# Add stdio MCP server
gemini mcp add weather-server npx weather-mcp-server
# Add HTTP MCP server with headers
gemini mcp add api-server http://localhost:3000/mcp \
--transport http \
--header "Authorization: Bearer token123" \
--trust
# Add with environment variables
gemini mcp add database-server python db-mcp.py \
--env "DB_HOST=localhost" \
--env "DB_PORT=5432" \
--scope usergemini mcp list # List configured MCP servers
gemini mcp remove <name> # Remove MCP server by nameCommands for managing CLI extensions.
gemini extensions <command> [options]gemini extensions install <source> # Install extension from source
gemini extensions uninstall <name> # Remove extension by name
gemini extensions list # Show installed extensions
gemini extensions update [name] # Update extension(s)
gemini extensions enable <name> # Enable extension
gemini extensions disable <name> # Disable extension
gemini extensions link <path> # Link local extension for development
gemini extensions new <name> # Create new extension templateUsage Examples:
# Install from GitHub
gemini extensions install https://github.com/user/gemini-ext-example
# Install from local directory
gemini extensions install ./my-extension
# Update specific extension
gemini extensions update my-extension
# Update all extensions
gemini extensions update
# Link for development
gemini extensions link ./development/my-extensionGEMINI_MODEL # Default model to use
NO_COLOR # Disable colors (activates no-color theme)
DEBUG / DEBUG_MODE # Enable debug mode
CLOUD_SHELL # Indicates Cloud Shell environment
SANDBOX # Indicates sandbox environment
GEMINI_CLI_NO_RELAUNCH # Prevent memory-based relaunchingHTTPS_PROXY / https_proxy # HTTPS proxy configuration
HTTP_PROXY / http_proxy # HTTP proxy configurationOTEL_EXPORTER_OTLP_ENDPOINT # OpenTelemetry OTLP endpointInternal CLI arguments structure (not exposed for programmatic use):
interface CliArgs {
// Model and generation
model?: string;
prompt?: string;
promptInteractive?: string;
// Execution environment
sandbox?: boolean | string;
debug?: boolean;
yolo?: boolean;
approvalMode?: 'default' | 'auto_edit' | 'yolo';
// Context and files
allFiles?: boolean;
includeDirectories?: string[];
checkpointing?: boolean;
// Tool configuration
allowedTools?: string[];
allowedMcpServerNames?: string[];
extensions?: string[];
listExtensions?: boolean;
// Telemetry and monitoring
telemetry?: boolean;
telemetryTarget?: 'local' | 'gcp';
telemetryOtlpEndpoint?: string;
telemetryOtlpProtocol?: 'grpc' | 'http';
telemetryLogPrompts?: boolean;
telemetryOutfile?: string;
showMemoryUsage?: boolean;
// UI and accessibility
screenReader?: boolean;
sessionSummary?: string;
proxy?: string;
experimentalAcp?: boolean;
// Positional arguments
promptWords?: string[];
}Install with Tessl CLI
npx tessl i tessl/npm-google--gemini-cli