Skip to main content

Gemini

gemini-cli

npm install -g @google/gemini-cli

gemini
commandfornotes
/bug提交 Gemini CLI 问题/bug <标题>
/chat保存/恢复会话历史save <tag>
resume <tag>
list
/clear清屏,清除可见历史Ctrl+L
/compress用摘要替换全部上下文
/copy复制上次输出到剪贴板
/editor选择支持的编辑器
/extensions列出当前会话扩展
/help /?显示帮助信息
/mcp管理 MCP 服务器和工具desc/descriptions
nodesc/nodescriptions
schema
/memory管理 AI 指令上下文add <内容>
show
refresh
/restore恢复文件到工具执行前状态/restore [tool_call_id]
/stats显示会话统计信息
/theme更换 CLI 主题
/auth更换认证方式
/about显示版本信息
/tools列出可用工具desc/descriptions
nodesc/nodescriptions
/privacy显示隐私声明及同意设置
/quit /exit退出 CLI
!<shell命令>执行 shell 命令!ls -la
!git status
!切换 shell 模式
@<路径>注入指定文件/目录内容到 prompt@README.md
@src/
@单独 @ 传递原始查询

⚠️ Shell 模式下命令拥有与终端同等权限,请谨慎操作。

{
"contextFileName": "GEMINI.md",
"bugCommand": {
"urlTemplate": "https://bug.example.com/new?title={title}&info={info}"
},
"fileFiltering": {
"respectGitIgnore": true,
"enableRecursiveFileSearch": false
},
// https://github.com/google-gemini/gemini-cli/blob/main/docs/core/tools-api.md#built-in-tools
"coreTools": [],
"excludeTools": [],
"allowMCPServers": [],
"excludeMCPServers": [],
"autoAccept": false,
"sandbox": false, // docker
"toolDiscoveryCommand": "",
"toolCallCommand": "",
"mcpServers": {
"myPythonServer": {
"command": "python",
"args": ["mcp_server.py", "--port", "8080"],
"cwd": "./mcp_tools/python",
"timeout": 5000
}
},
"checkpointing": { "enabled": false },
"preferredEditor": "vscode",
"telemetry": {
"enabled": false,
"target": "local",
"otlpEndpoint": "http://localhost:4317",
"logPrompts": true
},
"usageStatisticsEnabled": false,
"hideTips": false,
"hideBanner": false,
"summarizeToolOutput": {
"run_shell_command": {
"tokenBudget": 2000
}
},
"maxSessionTurns": -1,
"theme": "Atom One",
"selectedAuthType": "oauth-personal"
}
toolfor
FS文件系统工具
LSTool列出目录内容
ReadFileTool读取单个文件内容
WriteFileTool写入内容到文件
GrepTool在文件中搜索模式
GlobTool查找匹配 glob 模式的文件
EditTool对文件进行原地修改
ReadManyFilesTool读取并拼接多个文件或 glob 内容
Execution执行工具
ShellTool执行 shell 命令
WebWeb 工具
WebFetchTool获取指定 URL 内容
WebSearchTool执行网页搜索
Memory内存工具
MemoryTool与 AI 的记忆交互

GEMINI.md

  • 使用 @file.md 可注入指定文件内容到 prompt