@google/gemini-cli-core 0.21.0-nightly.20251218.739c02bd6 → 0.21.0-nightly.20251220.41a1a3eed

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/dist/docs/CONTRIBUTING.md +546 -0
  2. package/dist/docs/architecture.md +80 -0
  3. package/dist/docs/assets/connected_devtools.png +0 -0
  4. package/dist/docs/assets/gemini-screenshot.png +0 -0
  5. package/dist/docs/assets/release_patch.png +0 -0
  6. package/dist/docs/assets/theme-ansi-light.png +0 -0
  7. package/dist/docs/assets/theme-ansi.png +0 -0
  8. package/dist/docs/assets/theme-atom-one.png +0 -0
  9. package/dist/docs/assets/theme-ayu-light.png +0 -0
  10. package/dist/docs/assets/theme-ayu.png +0 -0
  11. package/dist/docs/assets/theme-custom.png +0 -0
  12. package/dist/docs/assets/theme-default-light.png +0 -0
  13. package/dist/docs/assets/theme-default.png +0 -0
  14. package/dist/docs/assets/theme-dracula.png +0 -0
  15. package/dist/docs/assets/theme-github-light.png +0 -0
  16. package/dist/docs/assets/theme-github.png +0 -0
  17. package/dist/docs/assets/theme-google-light.png +0 -0
  18. package/dist/docs/assets/theme-xcode-light.png +0 -0
  19. package/dist/docs/changelogs/index.md +592 -0
  20. package/dist/docs/changelogs/latest.md +225 -0
  21. package/dist/docs/changelogs/preview.md +129 -0
  22. package/dist/docs/changelogs/releases.md +896 -0
  23. package/dist/docs/cli/authentication.md +3 -0
  24. package/dist/docs/cli/checkpointing.md +94 -0
  25. package/dist/docs/cli/commands.md +354 -0
  26. package/dist/docs/cli/configuration.md +780 -0
  27. package/dist/docs/cli/custom-commands.md +315 -0
  28. package/dist/docs/cli/enterprise.md +565 -0
  29. package/dist/docs/cli/gemini-ignore.md +71 -0
  30. package/dist/docs/cli/gemini-md.md +108 -0
  31. package/dist/docs/cli/generation-settings.md +210 -0
  32. package/dist/docs/cli/headless.md +388 -0
  33. package/dist/docs/cli/index.md +63 -0
  34. package/dist/docs/cli/keyboard-shortcuts.md +143 -0
  35. package/dist/docs/cli/model-routing.md +37 -0
  36. package/dist/docs/cli/model.md +62 -0
  37. package/dist/docs/cli/sandbox.md +171 -0
  38. package/dist/docs/cli/session-management.md +158 -0
  39. package/dist/docs/cli/settings.md +112 -0
  40. package/dist/docs/cli/system-prompt.md +93 -0
  41. package/dist/docs/cli/telemetry.md +791 -0
  42. package/dist/docs/cli/themes.md +237 -0
  43. package/dist/docs/cli/token-caching.md +20 -0
  44. package/dist/docs/cli/trusted-folders.md +95 -0
  45. package/dist/docs/cli/tutorials.md +83 -0
  46. package/dist/docs/cli/uninstall.md +47 -0
  47. package/dist/docs/core/index.md +101 -0
  48. package/dist/docs/core/memport.md +244 -0
  49. package/dist/docs/core/policy-engine.md +267 -0
  50. package/dist/docs/core/tools-api.md +131 -0
  51. package/dist/docs/examples/proxy-script.md +83 -0
  52. package/dist/docs/extensions/extension-releasing.md +183 -0
  53. package/dist/docs/extensions/getting-started-extensions.md +245 -0
  54. package/dist/docs/extensions/index.md +293 -0
  55. package/dist/docs/faq.md +154 -0
  56. package/dist/docs/get-started/authentication.md +321 -0
  57. package/dist/docs/get-started/configuration-v1.md +888 -0
  58. package/dist/docs/get-started/configuration.md +1444 -0
  59. package/dist/docs/get-started/deployment.md +143 -0
  60. package/dist/docs/get-started/examples.md +219 -0
  61. package/dist/docs/get-started/gemini-3.md +116 -0
  62. package/dist/docs/get-started/index.md +71 -0
  63. package/dist/docs/get-started/installation.md +141 -0
  64. package/dist/docs/hooks/best-practices.md +806 -0
  65. package/dist/docs/hooks/index.md +665 -0
  66. package/dist/docs/hooks/reference.md +168 -0
  67. package/dist/docs/hooks/writing-hooks.md +1026 -0
  68. package/dist/docs/ide-integration/ide-companion-spec.md +267 -0
  69. package/dist/docs/ide-integration/index.md +202 -0
  70. package/dist/docs/index.md +147 -0
  71. package/dist/docs/integration-tests.md +211 -0
  72. package/dist/docs/issue-and-pr-automation.md +134 -0
  73. package/dist/docs/local-development.md +128 -0
  74. package/dist/docs/mermaid/context.mmd +103 -0
  75. package/dist/docs/mermaid/render-path.mmd +64 -0
  76. package/dist/docs/npm.md +62 -0
  77. package/dist/docs/quota-and-pricing.md +158 -0
  78. package/dist/docs/release-confidence.md +164 -0
  79. package/dist/docs/releases.md +540 -0
  80. package/dist/docs/sidebar.json +297 -0
  81. package/dist/docs/tools/file-system.md +217 -0
  82. package/dist/docs/tools/index.md +95 -0
  83. package/dist/docs/tools/mcp-server.md +1044 -0
  84. package/dist/docs/tools/memory.md +54 -0
  85. package/dist/docs/tools/shell.md +260 -0
  86. package/dist/docs/tools/todos.md +57 -0
  87. package/dist/docs/tools/web-fetch.md +59 -0
  88. package/dist/docs/tools/web-search.md +42 -0
  89. package/dist/docs/tos-privacy.md +96 -0
  90. package/dist/docs/troubleshooting.md +158 -0
  91. package/dist/google-gemini-cli-core-0.21.0-nightly.20251219.70696e364.tgz +0 -0
  92. package/dist/src/agents/delegate-to-agent-tool.test.js +1 -0
  93. package/dist/src/agents/delegate-to-agent-tool.test.js.map +1 -1
  94. package/dist/src/agents/introspection-agent.d.ts +23 -0
  95. package/dist/src/agents/introspection-agent.js +72 -0
  96. package/dist/src/agents/introspection-agent.js.map +1 -0
  97. package/dist/src/agents/introspection-agent.test.d.ts +6 -0
  98. package/dist/src/agents/introspection-agent.test.js +47 -0
  99. package/dist/src/agents/introspection-agent.test.js.map +1 -0
  100. package/dist/src/agents/local-executor.d.ts +0 -6
  101. package/dist/src/agents/local-executor.js +73 -47
  102. package/dist/src/agents/local-executor.js.map +1 -1
  103. package/dist/src/agents/local-executor.test.d.ts +1 -7
  104. package/dist/src/agents/local-executor.test.js +27 -9
  105. package/dist/src/agents/local-executor.test.js.map +1 -1
  106. package/dist/src/agents/registry.d.ts +1 -0
  107. package/dist/src/agents/registry.js +51 -7
  108. package/dist/src/agents/registry.js.map +1 -1
  109. package/dist/src/agents/registry.test.js +112 -1
  110. package/dist/src/agents/registry.test.js.map +1 -1
  111. package/dist/src/agents/toml-loader.d.ts +65 -0
  112. package/dist/src/agents/toml-loader.js +176 -0
  113. package/dist/src/agents/toml-loader.js.map +1 -0
  114. package/dist/src/agents/toml-loader.test.d.ts +6 -0
  115. package/dist/src/agents/toml-loader.test.js +190 -0
  116. package/dist/src/agents/toml-loader.test.js.map +1 -0
  117. package/dist/src/availability/modelAvailabilityService.d.ts +2 -1
  118. package/dist/src/config/config.d.ts +9 -0
  119. package/dist/src/config/config.js +29 -0
  120. package/dist/src/config/config.js.map +1 -1
  121. package/dist/src/config/config.test.js +59 -1
  122. package/dist/src/config/config.test.js.map +1 -1
  123. package/dist/src/config/storage.d.ts +2 -0
  124. package/dist/src/config/storage.js +6 -0
  125. package/dist/src/config/storage.js.map +1 -1
  126. package/dist/src/config/storage.test.js +8 -0
  127. package/dist/src/config/storage.test.js.map +1 -1
  128. package/dist/src/core/client.js +8 -4
  129. package/dist/src/core/client.js.map +1 -1
  130. package/dist/src/core/client.test.js +20 -0
  131. package/dist/src/core/client.test.js.map +1 -1
  132. package/dist/src/core/clientHookTriggers.js +2 -2
  133. package/dist/src/core/clientHookTriggers.js.map +1 -1
  134. package/dist/src/core/coreToolHookTriggers.js +3 -3
  135. package/dist/src/core/coreToolHookTriggers.js.map +1 -1
  136. package/dist/src/core/geminiChatHookTriggers.js +3 -3
  137. package/dist/src/core/geminiChatHookTriggers.js.map +1 -1
  138. package/dist/src/core/sessionHookTriggers.js +3 -3
  139. package/dist/src/core/sessionHookTriggers.js.map +1 -1
  140. package/dist/src/generated/git-commit.d.ts +2 -2
  141. package/dist/src/generated/git-commit.js +2 -2
  142. package/dist/src/hooks/hookEventHandler.js +10 -4
  143. package/dist/src/hooks/hookEventHandler.js.map +1 -1
  144. package/dist/src/hooks/hookEventHandler.test.js +40 -0
  145. package/dist/src/hooks/hookEventHandler.test.js.map +1 -1
  146. package/dist/src/hooks/hookPlanner.js +3 -1
  147. package/dist/src/hooks/hookPlanner.js.map +1 -1
  148. package/dist/src/hooks/hookPlanner.test.js +61 -0
  149. package/dist/src/hooks/hookPlanner.test.js.map +1 -1
  150. package/dist/src/hooks/hookRegistry.d.ts +1 -1
  151. package/dist/src/hooks/hookRegistry.js +2 -2
  152. package/dist/src/hooks/hookRegistry.js.map +1 -1
  153. package/dist/src/hooks/hookRegistry.test.js +73 -0
  154. package/dist/src/hooks/hookRegistry.test.js.map +1 -1
  155. package/dist/src/hooks/hookRunner.js +14 -10
  156. package/dist/src/hooks/hookRunner.js.map +1 -1
  157. package/dist/src/hooks/hookRunner.test.js +81 -33
  158. package/dist/src/hooks/hookRunner.test.js.map +1 -1
  159. package/dist/src/hooks/types.d.ts +2 -0
  160. package/dist/src/hooks/types.js.map +1 -1
  161. package/dist/src/mcp/oauth-provider.js +6 -2
  162. package/dist/src/mcp/oauth-provider.js.map +1 -1
  163. package/dist/src/mcp/oauth-provider.test.js +4 -1
  164. package/dist/src/mcp/oauth-provider.test.js.map +1 -1
  165. package/dist/src/mcp/oauth-utils.d.ts +8 -1
  166. package/dist/src/mcp/oauth-utils.js +30 -1
  167. package/dist/src/mcp/oauth-utils.js.map +1 -1
  168. package/dist/src/mcp/oauth-utils.test.js +42 -0
  169. package/dist/src/mcp/oauth-utils.test.js.map +1 -1
  170. package/dist/src/services/contextManager.d.ts +5 -11
  171. package/dist/src/services/contextManager.js +20 -17
  172. package/dist/src/services/contextManager.js.map +1 -1
  173. package/dist/src/services/contextManager.test.js +40 -41
  174. package/dist/src/services/contextManager.test.js.map +1 -1
  175. package/dist/src/services/shellExecutionService.js +18 -2
  176. package/dist/src/services/shellExecutionService.js.map +1 -1
  177. package/dist/src/tools/get-internal-docs.d.ts +27 -0
  178. package/dist/src/tools/get-internal-docs.js +129 -0
  179. package/dist/src/tools/get-internal-docs.js.map +1 -0
  180. package/dist/src/tools/get-internal-docs.test.d.ts +6 -0
  181. package/dist/src/tools/get-internal-docs.test.js +56 -0
  182. package/dist/src/tools/get-internal-docs.test.js.map +1 -0
  183. package/dist/src/tools/tool-names.d.ts +14 -0
  184. package/dist/src/tools/tool-names.js +55 -0
  185. package/dist/src/tools/tool-names.js.map +1 -1
  186. package/dist/src/tools/tool-names.test.d.ts +6 -0
  187. package/dist/src/tools/tool-names.test.js +43 -0
  188. package/dist/src/tools/tool-names.test.js.map +1 -0
  189. package/dist/src/tools/tool-registry.d.ts +0 -1
  190. package/dist/src/tools/tool-registry.js +1 -1
  191. package/dist/src/tools/tool-registry.js.map +1 -1
  192. package/dist/src/tools/tool-registry.test.js +2 -1
  193. package/dist/src/tools/tool-registry.test.js.map +1 -1
  194. package/dist/src/utils/environmentContext.js +3 -0
  195. package/dist/src/utils/environmentContext.js.map +1 -1
  196. package/dist/src/utils/environmentContext.test.js +2 -0
  197. package/dist/src/utils/environmentContext.test.js.map +1 -1
  198. package/dist/src/utils/events.d.ts +3 -2
  199. package/dist/src/utils/events.js.map +1 -1
  200. package/dist/src/utils/googleQuotaErrors.js +20 -0
  201. package/dist/src/utils/googleQuotaErrors.js.map +1 -1
  202. package/dist/src/utils/googleQuotaErrors.test.js +53 -2
  203. package/dist/src/utils/googleQuotaErrors.test.js.map +1 -1
  204. package/dist/src/utils/memoryDiscovery.js +1 -1
  205. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  206. package/dist/src/utils/memoryDiscovery.test.js +3 -1
  207. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  208. package/dist/src/utils/shell-utils.js +25 -4
  209. package/dist/src/utils/shell-utils.js.map +1 -1
  210. package/dist/tsconfig.tsbuildinfo +1 -1
  211. package/package.json +1 -6
  212. package/dist/google-gemini-cli-core-0.21.0-nightly.20251216.bb0c0d8ee.tgz +0 -0
@@ -0,0 +1,297 @@
1
+ [
2
+ {
3
+ "label": "Overview",
4
+ "items": [
5
+ {
6
+ "label": "Introduction",
7
+ "slug": "docs"
8
+ },
9
+ {
10
+ "label": "Architecture overview",
11
+ "slug": "docs/architecture"
12
+ },
13
+ {
14
+ "label": "Contribution guide",
15
+ "slug": "docs/contributing"
16
+ }
17
+ ]
18
+ },
19
+ {
20
+ "label": "Get started",
21
+ "items": [
22
+ {
23
+ "label": "Gemini CLI quickstart",
24
+ "slug": "docs/get-started"
25
+ },
26
+ {
27
+ "label": "Gemini 3 on Gemini CLI",
28
+ "slug": "docs/get-started/gemini-3"
29
+ },
30
+ {
31
+ "label": "Authentication",
32
+ "slug": "docs/get-started/authentication"
33
+ },
34
+ {
35
+ "label": "Configuration",
36
+ "slug": "docs/get-started/configuration"
37
+ },
38
+ {
39
+ "label": "Installation",
40
+ "slug": "docs/get-started/installation"
41
+ },
42
+ {
43
+ "label": "Examples",
44
+ "slug": "docs/get-started/examples"
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ "label": "CLI",
50
+ "items": [
51
+ {
52
+ "label": "Introduction",
53
+ "slug": "docs/cli"
54
+ },
55
+ {
56
+ "label": "Commands",
57
+ "slug": "docs/cli/commands"
58
+ },
59
+ {
60
+ "label": "Checkpointing",
61
+ "slug": "docs/cli/checkpointing"
62
+ },
63
+ {
64
+ "label": "Custom commands",
65
+ "slug": "docs/cli/custom-commands"
66
+ },
67
+ {
68
+ "label": "Enterprise",
69
+ "slug": "docs/cli/enterprise"
70
+ },
71
+ {
72
+ "label": "Headless mode",
73
+ "slug": "docs/cli/headless"
74
+ },
75
+ {
76
+ "label": "Keyboard shortcuts",
77
+ "slug": "docs/cli/keyboard-shortcuts"
78
+ },
79
+ {
80
+ "label": "Model selection",
81
+ "slug": "docs/cli/model"
82
+ },
83
+ {
84
+ "label": "Sandbox",
85
+ "slug": "docs/cli/sandbox"
86
+ },
87
+ {
88
+ "label": "Session Management",
89
+ "slug": "docs/cli/session-management"
90
+ },
91
+ {
92
+ "label": "Settings",
93
+ "slug": "docs/cli/settings"
94
+ },
95
+ {
96
+ "label": "Telemetry",
97
+ "slug": "docs/cli/telemetry"
98
+ },
99
+ {
100
+ "label": "Themes",
101
+ "slug": "docs/cli/themes"
102
+ },
103
+ {
104
+ "label": "Token caching",
105
+ "slug": "docs/cli/token-caching"
106
+ },
107
+ {
108
+ "label": "Trusted Folders",
109
+ "slug": "docs/cli/trusted-folders"
110
+ },
111
+ {
112
+ "label": "Tutorials",
113
+ "slug": "docs/cli/tutorials"
114
+ },
115
+ {
116
+ "label": "Uninstall",
117
+ "slug": "docs/cli/uninstall"
118
+ },
119
+ {
120
+ "label": "System prompt override",
121
+ "slug": "docs/cli/system-prompt"
122
+ }
123
+ ]
124
+ },
125
+ {
126
+ "label": "Core",
127
+ "items": [
128
+ {
129
+ "label": "Introduction",
130
+ "slug": "docs/core"
131
+ },
132
+ {
133
+ "label": "Tools API",
134
+ "slug": "docs/core/tools-api"
135
+ },
136
+ {
137
+ "label": "Memory Import Processor",
138
+ "slug": "docs/core/memport"
139
+ },
140
+ {
141
+ "label": "Policy Engine",
142
+ "slug": "docs/core/policy-engine"
143
+ }
144
+ ]
145
+ },
146
+ {
147
+ "label": "Tools",
148
+ "items": [
149
+ {
150
+ "label": "Introduction",
151
+ "slug": "docs/tools"
152
+ },
153
+ {
154
+ "label": "File system",
155
+ "slug": "docs/tools/file-system"
156
+ },
157
+ {
158
+ "label": "Shell",
159
+ "slug": "docs/tools/shell"
160
+ },
161
+ {
162
+ "label": "Web fetch",
163
+ "slug": "docs/tools/web-fetch"
164
+ },
165
+ {
166
+ "label": "Web search",
167
+ "slug": "docs/tools/web-search"
168
+ },
169
+ {
170
+ "label": "Memory",
171
+ "slug": "docs/tools/memory"
172
+ },
173
+ {
174
+ "label": "Todos",
175
+ "slug": "docs/tools/todos"
176
+ },
177
+ {
178
+ "label": "MCP servers",
179
+ "slug": "docs/tools/mcp-server"
180
+ }
181
+ ]
182
+ },
183
+ {
184
+ "label": "Extensions",
185
+ "items": [
186
+ {
187
+ "label": "Introduction",
188
+ "slug": "docs/extensions"
189
+ },
190
+ {
191
+ "label": "Get started with extensions",
192
+ "slug": "docs/extensions/getting-started-extensions"
193
+ },
194
+ {
195
+ "label": "Extension releasing",
196
+ "slug": "docs/extensions/extension-releasing"
197
+ }
198
+ ]
199
+ },
200
+ {
201
+ "label": "Hooks",
202
+ "items": [
203
+ {
204
+ "label": "Introduction",
205
+ "slug": "docs/hooks"
206
+ },
207
+ {
208
+ "label": "Writing hooks",
209
+ "slug": "docs/hooks/writing-hooks"
210
+ },
211
+ {
212
+ "label": "Hooks reference",
213
+ "slug": "docs/hooks/reference"
214
+ },
215
+ {
216
+ "label": "Best practices",
217
+ "slug": "docs/hooks/best-practices"
218
+ }
219
+ ]
220
+ },
221
+ {
222
+ "label": "IDE integration",
223
+ "items": [
224
+ {
225
+ "label": "Introduction",
226
+ "slug": "docs/ide-integration"
227
+ },
228
+ {
229
+ "label": "IDE companion spec",
230
+ "slug": "docs/ide-integration/ide-companion-spec"
231
+ }
232
+ ]
233
+ },
234
+ {
235
+ "label": "Development",
236
+ "items": [
237
+ {
238
+ "label": "NPM",
239
+ "slug": "docs/npm"
240
+ },
241
+ {
242
+ "label": "Releases",
243
+ "slug": "docs/releases"
244
+ },
245
+ {
246
+ "label": "Integration tests",
247
+ "slug": "docs/integration-tests"
248
+ },
249
+ {
250
+ "label": "Issue and PR automation",
251
+ "slug": "docs/issue-and-pr-automation"
252
+ }
253
+ ]
254
+ },
255
+ {
256
+ "label": "Releases",
257
+ "items": [
258
+ {
259
+ "label": "Release notes",
260
+ "slug": "docs/changelogs/"
261
+ },
262
+ {
263
+ "label": "Latest release",
264
+ "slug": "docs/changelogs/latest"
265
+ },
266
+ {
267
+ "label": "Preview release",
268
+ "slug": "docs/changelogs/preview"
269
+ },
270
+ {
271
+ "label": "Changelog",
272
+ "slug": "docs/changelogs/releases"
273
+ }
274
+ ]
275
+ },
276
+ {
277
+ "label": "Support",
278
+ "items": [
279
+ {
280
+ "label": "FAQ",
281
+ "slug": "docs/faq"
282
+ },
283
+ {
284
+ "label": "Troubleshooting",
285
+ "slug": "docs/troubleshooting"
286
+ },
287
+ {
288
+ "label": "Quota and pricing",
289
+ "slug": "docs/quota-and-pricing"
290
+ },
291
+ {
292
+ "label": "Terms of service",
293
+ "slug": "docs/tos-privacy"
294
+ }
295
+ ]
296
+ }
297
+ ]
@@ -0,0 +1,217 @@
1
+ # Gemini CLI file system tools
2
+
3
+ The Gemini CLI provides a comprehensive suite of tools for interacting with the
4
+ local file system. These tools allow the Gemini model to read from, write to,
5
+ list, search, and modify files and directories, all under your control and
6
+ typically with confirmation for sensitive operations.
7
+
8
+ **Note:** All file system tools operate within a `rootDirectory` (usually the
9
+ current working directory where you launched the CLI) for security. Paths that
10
+ you provide to these tools are generally expected to be absolute or are resolved
11
+ relative to this root directory.
12
+
13
+ ## 1. `list_directory` (ReadFolder)
14
+
15
+ `list_directory` lists the names of files and subdirectories directly within a
16
+ specified directory path. It can optionally ignore entries matching provided
17
+ glob patterns.
18
+
19
+ - **Tool name:** `list_directory`
20
+ - **Display name:** ReadFolder
21
+ - **File:** `ls.ts`
22
+ - **Parameters:**
23
+ - `path` (string, required): The absolute path to the directory to list.
24
+ - `ignore` (array of strings, optional): A list of glob patterns to exclude
25
+ from the listing (e.g., `["*.log", ".git"]`).
26
+ - `respect_git_ignore` (boolean, optional): Whether to respect `.gitignore`
27
+ patterns when listing files. Defaults to `true`.
28
+ - **Behavior:**
29
+ - Returns a list of file and directory names.
30
+ - Indicates whether each entry is a directory.
31
+ - Sorts entries with directories first, then alphabetically.
32
+ - **Output (`llmContent`):** A string like:
33
+ `Directory listing for /path/to/your/folder:\n[DIR] subfolder1\nfile1.txt\nfile2.png`
34
+ - **Confirmation:** No.
35
+
36
+ ## 2. `read_file` (ReadFile)
37
+
38
+ `read_file` reads and returns the content of a specified file. This tool handles
39
+ text, images (PNG, JPG, GIF, WEBP, SVG, BMP), audio files (MP3, WAV, AIFF, AAC,
40
+ OGG, FLAC), and PDF files. For text files, it can read specific line ranges.
41
+ Other binary file types are generally skipped.
42
+
43
+ - **Tool name:** `read_file`
44
+ - **Display name:** ReadFile
45
+ - **File:** `read-file.ts`
46
+ - **Parameters:**
47
+ - `path` (string, required): The absolute path to the file to read.
48
+ - `offset` (number, optional): For text files, the 0-based line number to
49
+ start reading from. Requires `limit` to be set.
50
+ - `limit` (number, optional): For text files, the maximum number of lines to
51
+ read. If omitted, reads a default maximum (e.g., 2000 lines) or the entire
52
+ file if feasible.
53
+ - **Behavior:**
54
+ - For text files: Returns the content. If `offset` and `limit` are used,
55
+ returns only that slice of lines. Indicates if content was truncated due to
56
+ line limits or line length limits.
57
+ - For image, audio, and PDF files: Returns the file content as a
58
+ base64-encoded data structure suitable for model consumption.
59
+ - For other binary files: Attempts to identify and skip them, returning a
60
+ message indicating it's a generic binary file.
61
+ - **Output:** (`llmContent`):
62
+ - For text files: The file content, potentially prefixed with a truncation
63
+ message (e.g.,
64
+ `[File content truncated: showing lines 1-100 of 500 total lines...]\nActual file content...`).
65
+ - For image/audio/PDF files: An object containing `inlineData` with `mimeType`
66
+ and base64 `data` (e.g.,
67
+ `{ inlineData: { mimeType: 'image/png', data: 'base64encodedstring' } }`).
68
+ - For other binary files: A message like
69
+ `Cannot display content of binary file: /path/to/data.bin`.
70
+ - **Confirmation:** No.
71
+
72
+ ## 3. `write_file` (WriteFile)
73
+
74
+ `write_file` writes content to a specified file. If the file exists, it will be
75
+ overwritten. If the file doesn't exist, it (and any necessary parent
76
+ directories) will be created.
77
+
78
+ - **Tool name:** `write_file`
79
+ - **Display name:** WriteFile
80
+ - **File:** `write-file.ts`
81
+ - **Parameters:**
82
+ - `file_path` (string, required): The absolute path to the file to write to.
83
+ - `content` (string, required): The content to write into the file.
84
+ - **Behavior:**
85
+ - Writes the provided `content` to the `file_path`.
86
+ - Creates parent directories if they don't exist.
87
+ - **Output (`llmContent`):** A success message, e.g.,
88
+ `Successfully overwrote file: /path/to/your/file.txt` or
89
+ `Successfully created and wrote to new file: /path/to/new/file.txt`.
90
+ - **Confirmation:** Yes. Shows a diff of changes and asks for user approval
91
+ before writing.
92
+
93
+ ## 4. `glob` (FindFiles)
94
+
95
+ `glob` finds files matching specific glob patterns (e.g., `src/**/*.ts`,
96
+ `*.md`), returning absolute paths sorted by modification time (newest first).
97
+
98
+ - **Tool name:** `glob`
99
+ - **Display name:** FindFiles
100
+ - **File:** `glob.ts`
101
+ - **Parameters:**
102
+ - `pattern` (string, required): The glob pattern to match against (e.g.,
103
+ `"*.py"`, `"src/**/*.js"`).
104
+ - `path` (string, optional): The absolute path to the directory to search
105
+ within. If omitted, searches the tool's root directory.
106
+ - `case_sensitive` (boolean, optional): Whether the search should be
107
+ case-sensitive. Defaults to `false`.
108
+ - `respect_git_ignore` (boolean, optional): Whether to respect .gitignore
109
+ patterns when finding files. Defaults to `true`.
110
+ - **Behavior:**
111
+ - Searches for files matching the glob pattern within the specified directory.
112
+ - Returns a list of absolute paths, sorted with the most recently modified
113
+ files first.
114
+ - Ignores common nuisance directories like `node_modules` and `.git` by
115
+ default.
116
+ - **Output (`llmContent`):** A message like:
117
+ `Found 5 file(s) matching "*.ts" within src, sorted by modification time (newest first):\nsrc/file1.ts\nsrc/subdir/file2.ts...`
118
+ - **Confirmation:** No.
119
+
120
+ ## 5. `search_file_content` (SearchText)
121
+
122
+ `search_file_content` searches for a regular expression pattern within the
123
+ content of files in a specified directory. Can filter files by a glob pattern.
124
+ Returns the lines containing matches, along with their file paths and line
125
+ numbers.
126
+
127
+ - **Tool name:** `search_file_content`
128
+ - **Display name:** SearchText
129
+ - **File:** `grep.ts`
130
+ - **Parameters:**
131
+ - `pattern` (string, required): The regular expression (regex) to search for
132
+ (e.g., `"function\s+myFunction"`).
133
+ - `path` (string, optional): The absolute path to the directory to search
134
+ within. Defaults to the current working directory.
135
+ - `include` (string, optional): A glob pattern to filter which files are
136
+ searched (e.g., `"*.js"`, `"src/**/*.{ts,tsx}"`). If omitted, searches most
137
+ files (respecting common ignores).
138
+ - **Behavior:**
139
+ - Uses `git grep` if available in a Git repository for speed; otherwise, falls
140
+ back to system `grep` or a JavaScript-based search.
141
+ - Returns a list of matching lines, each prefixed with its file path (relative
142
+ to the search directory) and line number.
143
+ - **Output (`llmContent`):** A formatted string of matches, e.g.:
144
+ ```
145
+ Found 3 matches for pattern "myFunction" in path "." (filter: "*.ts"):
146
+ ---
147
+ File: src/utils.ts
148
+ L15: export function myFunction() {
149
+ L22: myFunction.call();
150
+ ---
151
+ File: src/index.ts
152
+ L5: import { myFunction } from './utils';
153
+ ---
154
+ ```
155
+ - **Confirmation:** No.
156
+
157
+ ## 6. `replace` (Edit)
158
+
159
+ `replace` replaces text within a file. By default, replaces a single occurrence,
160
+ but can replace multiple occurrences when `expected_replacements` is specified.
161
+ This tool is designed for precise, targeted changes and requires significant
162
+ context around the `old_string` to ensure it modifies the correct location.
163
+
164
+ - **Tool name:** `replace`
165
+ - **Display name:** Edit
166
+ - **File:** `edit.ts`
167
+ - **Parameters:**
168
+ - `file_path` (string, required): The absolute path to the file to modify.
169
+ - `old_string` (string, required): The exact literal text to replace.
170
+
171
+ **CRITICAL:** This string must uniquely identify the single instance to
172
+ change. It should include at least 3 lines of context _before_ and _after_
173
+ the target text, matching whitespace and indentation precisely. If
174
+ `old_string` is empty, the tool attempts to create a new file at `file_path`
175
+ with `new_string` as content.
176
+
177
+ - `new_string` (string, required): The exact literal text to replace
178
+ `old_string` with.
179
+ - `expected_replacements` (number, optional): The number of occurrences to
180
+ replace. Defaults to `1`.
181
+
182
+ - **Behavior:**
183
+ - If `old_string` is empty and `file_path` does not exist, creates a new file
184
+ with `new_string` as content.
185
+ - If `old_string` is provided, it reads the `file_path` and attempts to find
186
+ exactly one occurrence of `old_string`.
187
+ - If one occurrence is found, it replaces it with `new_string`.
188
+ - **Enhanced reliability (multi-stage edit correction):** To significantly
189
+ improve the success rate of edits, especially when the model-provided
190
+ `old_string` might not be perfectly precise, the tool incorporates a
191
+ multi-stage edit correction mechanism.
192
+ - If the initial `old_string` isn't found or matches multiple locations, the
193
+ tool can leverage the Gemini model to iteratively refine `old_string` (and
194
+ potentially `new_string`).
195
+ - This self-correction process attempts to identify the unique segment the
196
+ model intended to modify, making the `replace` operation more robust even
197
+ with slightly imperfect initial context.
198
+ - **Failure conditions:** Despite the correction mechanism, the tool will fail
199
+ if:
200
+ - `file_path` is not absolute or is outside the root directory.
201
+ - `old_string` is not empty, but the `file_path` does not exist.
202
+ - `old_string` is empty, but the `file_path` already exists.
203
+ - `old_string` is not found in the file after attempts to correct it.
204
+ - `old_string` is found multiple times, and the self-correction mechanism
205
+ cannot resolve it to a single, unambiguous match.
206
+ - **Output (`llmContent`):**
207
+ - On success:
208
+ `Successfully modified file: /path/to/file.txt (1 replacements).` or
209
+ `Created new file: /path/to/new_file.txt with provided content.`
210
+ - On failure: An error message explaining the reason (e.g.,
211
+ `Failed to edit, 0 occurrences found...`,
212
+ `Failed to edit, expected 1 occurrences but found 2...`).
213
+ - **Confirmation:** Yes. Shows a diff of the proposed changes and asks for user
214
+ approval before writing to the file.
215
+
216
+ These file system tools provide a foundation for the Gemini CLI to understand
217
+ and interact with your local project context.
@@ -0,0 +1,95 @@
1
+ # Gemini CLI tools
2
+
3
+ The Gemini CLI includes built-in tools that the Gemini model uses to interact
4
+ with your local environment, access information, and perform actions. These
5
+ tools enhance the CLI's capabilities, enabling it to go beyond text generation
6
+ and assist with a wide range of tasks.
7
+
8
+ ## Overview of Gemini CLI tools
9
+
10
+ In the context of the Gemini CLI, tools are specific functions or modules that
11
+ the Gemini model can request to be executed. For example, if you ask Gemini to
12
+ "Summarize the contents of `my_document.txt`," the model will likely identify
13
+ the need to read that file and will request the execution of the `read_file`
14
+ tool.
15
+
16
+ The core component (`packages/core`) manages these tools, presents their
17
+ definitions (schemas) to the Gemini model, executes them when requested, and
18
+ returns the results to the model for further processing into a user-facing
19
+ response.
20
+
21
+ These tools provide the following capabilities:
22
+
23
+ - **Access local information:** Tools allow Gemini to access your local file
24
+ system, read file contents, list directories, etc.
25
+ - **Execute commands:** With tools like `run_shell_command`, Gemini can run
26
+ shell commands (with appropriate safety measures and user confirmation).
27
+ - **Interact with the web:** Tools can fetch content from URLs.
28
+ - **Take actions:** Tools can modify files, write new files, or perform other
29
+ actions on your system (again, typically with safeguards).
30
+ - **Ground responses:** By using tools to fetch real-time or specific local
31
+ data, Gemini's responses can be more accurate, relevant, and grounded in your
32
+ actual context.
33
+
34
+ ## How to use Gemini CLI tools
35
+
36
+ To use Gemini CLI tools, provide a prompt to the Gemini CLI. The process works
37
+ as follows:
38
+
39
+ 1. You provide a prompt to the Gemini CLI.
40
+ 2. The CLI sends the prompt to the core.
41
+ 3. The core, along with your prompt and conversation history, sends a list of
42
+ available tools and their descriptions/schemas to the Gemini API.
43
+ 4. The Gemini model analyzes your request. If it determines that a tool is
44
+ needed, its response will include a request to execute a specific tool with
45
+ certain parameters.
46
+ 5. The core receives this tool request, validates it, and (often after user
47
+ confirmation for sensitive operations) executes the tool.
48
+ 6. The output from the tool is sent back to the Gemini model.
49
+ 7. The Gemini model uses the tool's output to formulate its final answer, which
50
+ is then sent back through the core to the CLI and displayed to you.
51
+
52
+ You will typically see messages in the CLI indicating when a tool is being
53
+ called and whether it succeeded or failed.
54
+
55
+ ## Security and confirmation
56
+
57
+ Many tools, especially those that can modify your file system or execute
58
+ commands (`write_file`, `edit`, `run_shell_command`), are designed with safety
59
+ in mind. The Gemini CLI will typically:
60
+
61
+ - **Require confirmation:** Prompt you before executing potentially sensitive
62
+ operations, showing you what action is about to be taken.
63
+ - **Utilize sandboxing:** All tools are subject to restrictions enforced by
64
+ sandboxing (see [Sandboxing in the Gemini CLI](../cli/sandbox.md)). This means
65
+ that when operating in a sandbox, any tools (including MCP servers) you wish
66
+ to use must be available _inside_ the sandbox environment. For example, to run
67
+ an MCP server through `npx`, the `npx` executable must be installed within the
68
+ sandbox's Docker image or be available in the `sandbox-exec` environment.
69
+
70
+ It's important to always review confirmation prompts carefully before allowing a
71
+ tool to proceed.
72
+
73
+ ## Learn more about Gemini CLI's tools
74
+
75
+ Gemini CLI's built-in tools can be broadly categorized as follows:
76
+
77
+ - **[File System Tools](./file-system.md):** For interacting with files and
78
+ directories (reading, writing, listing, searching, etc.).
79
+ - **[Shell Tool](./shell.md) (`run_shell_command`):** For executing shell
80
+ commands.
81
+ - **[Web Fetch Tool](./web-fetch.md) (`web_fetch`):** For retrieving content
82
+ from URLs.
83
+ - **[Web Search Tool](./web-search.md) (`google_web_search`):** For searching
84
+ the web.
85
+ - **[Memory Tool](./memory.md) (`save_memory`):** For saving and recalling
86
+ information across sessions.
87
+ - **[Todo Tool](./todos.md) (`write_todos`):** For managing subtasks of complex
88
+ requests.
89
+
90
+ Additionally, these tools incorporate:
91
+
92
+ - **[MCP servers](./mcp-server.md)**: MCP servers act as a bridge between the
93
+ Gemini model and your local environment or other services like APIs.
94
+ - **[Sandboxing](../cli/sandbox.md)**: Sandboxing isolates the model and its
95
+ changes from your environment to reduce potential risk.