Tools reference
概要
ローカル環境との対話、情報アクセス、行動の実行に使うツール群。モデルのテキスト生成を超えて、ファイル読み取り・コマンド実行・web 検索を可能にする。
仕様
自動実行とセキュリティ
- ファイルを変更する、またはシェルコマンドを実行するツール(mutator)は手動承認が必要。 CLI は確認前に diff または実行されるコマンドそのものを表示する
- Sandboxing: ツール実行をコンテナ化された環境で走らせてホストから隔離できる
- Trusted folders: モデルがシステムツールを使えるディレクトリを設定できる
手動でのトリガー
@(ファイルアクセス): パスを続けると内容をプロンプトに含める。read_many_filesツールを起動する!(シェルコマンド): システムコマンドを直接実行する。run_shell_commandツールを起動する
ツールの確認と設定
/tools: 登録済みツールを表示名付きで一覧する/tools desc: 完全な説明付きで一覧する- 設定で個々のツールの有効・無効や挙動(シェル出力の pager、web 検索に使うブラウザなど)を変えられる
利用可能なツール
Execution
| ツール | Kind | 説明 |
|---|---|---|
run_shell_command | Execute | 任意のシェルコマンドを実行する。対話セッションとバックグラウンドプロセスに対応。手動確認が必要 |
File System
| ツール | Kind | 説明 |
|---|---|---|
glob | Search | ワークスペース全体で glob パターンに一致するファイルを探す |
grep_search | Search | ファイル内容を正規表現で検索する。legacy エイリアス: search_file_content |
list_directory | Read | 指定パス配下のファイルとサブディレクトリ名を一覧する |
read_file | Read | ファイルの内容を読む。テキスト、画像、音声、PDF に対応 |
read_many_files | Read | 複数ファイルの内容を読んで連結する。プロンプトの @ でよく起動される |
replace | Edit | ファイル内の正確なテキスト置換。手動確認が必要 |
write_file | Edit | ファイルを作成または上書きする。手動確認が必要 |
Interaction
| ツール | Kind | 説明 |
|---|---|---|
ask_user | Communicate | 対話ダイアログで確認や不足情報を求める |
write_todos | Other | サブタスクの内部リストを保持する |
Task Tracker(experimental)
活発に開発中の実験的機能。experimental.taskTracker で有効にする。
tracker_create_task / tracker_update_task / tracker_get_task / tracker_list_tasks / tracker_add_dependency / tracker_visualize
- 出典には Task Tracker(experimental、Kind は
Other)と Task Tracking(Kind はThink)の 2 つの表があり、同名のツールが両方に載っている。加えて Task Tracking にはupdate_topic(現在のトピックと状態を更新する)がある
MCP
| ツール | Kind | 説明 |
|---|---|---|
list_mcp_resources | Search | 接続中の MCP サーバーが公開するリソースを一覧する |
read_mcp_resource | Read | 特定の MCP リソースの内容を読む |
Memory
| ツール | Kind | 説明 |
|---|---|---|
activate_skill | Other | .gemini/skills から専門的な手順知識を読み込む |
get_internal_docs | Think | Gemini CLI 自身のドキュメントにアクセスする |
Planning
| ツール | Kind | 説明 |
|---|---|---|
enter_plan_mode | Plan | 安全な read-only の Plan Mode に切り替える |
exit_plan_mode | Plan | 計画を確定してレビューに提示し、実装開始の承認を求める |
System
| ツール | Kind | 説明 |
|---|---|---|
complete_task | Other | subagent のミッションを終えて親エージェントに結果を返す。ユーザーからは使えない |
Web
| ツール | Kind | 説明 |
|---|---|---|
google_web_search | Search | Google 検索で最新の情報を探す |
web_fetch | Fetch | 指定 URL の内容を取得・処理する。警告: このツールは localhost などのローカル/プライベートネットワークアドレスにアクセスでき、untrusted なプロンプトと組み合わせるとセキュリティリスクになりうる。Plan Mode では明示的なユーザー確認が必要 |
ツールの引数キー
policy engine の argsPattern を書くときに使う JSON 引数キー。
| ツール | キー |
|---|---|
run_shell_command | command, description, dir_path, is_background |
glob | pattern, dir_path, case_sensitive, respect_git_ignore, respect_gemini_ignore |
grep_search | pattern, dir_path, include_pattern, exclude_pattern, names_only, case_sensitive, fixed_strings, context, after, before, no_ignore, max_matches_per_file, total_max_matches |
list_directory | dir_path, ignore, file_filtering_options |
read_file | file_path, start_line, end_line |
read_many_files | include, exclude, recursive, useDefaultExcludes |
write_file | file_path, content |
replace | file_path, old_string, new_string, instruction, allow_multiple |
ask_user | questions(question, header, type, options の配列) |
write_todos | todos(description, status の配列) |
activate_skill | name |
get_internal_docs | path |
enter_plan_mode | reason |
exit_plan_mode | plan_path |
tracker_create_task | title, description, type |
tracker_update_task | id, title, description, status, dependencies |
tracker_get_task | id |
tracker_list_tasks | status, type, parentId |
tracker_add_dependency | taskId, dependencyId |
tracker_visualize | なし |
update_topic | title, summary, strategic_intent |
google_web_search | query |
web_fetch | prompt |
拡張
ToolRegistryクラスがすべてのツールを管理する- 設定の
tools.discoveryCommand、または MCP サーバーへの接続でカスタムツールを追加できる
設定
[[rule]]
toolName = "write_file"
argsPattern = '"file_path":".*\.env"'
decision = "deny"
priority = 100
denyMessage = "Writing to .env files is not allowed."
関連
facts/gemini-cli/policy-engine.mdfacts/gemini-cli/sandbox.mdfacts/gemini-cli/trusted-folders.mdfacts/gemini-cli/mcp-server.mdfacts/gemini-cli/commands.mdfacts/gemini-cli/configuration.mdfacts/gemini-cli/plan-mode.mdfacts/gemini-cli/skills.md