組み込みツール

Gemini CLI が提供する強力な組み込みツールの完全なリファレンス

ファイルシステムシェルコマンドWebツール

ツールカテゴリ

様々なタスクを達成するのに役立つ、機能別に整理された組み込みツール

ファイルシステムツール

ファイルとディレクトリの読み取り、書き込み、管理用ツール

read_file

ファイルの内容を読み取る

パラメータ:
path(string)必須

読み取るファイルのパス

戻り値:

string - ファイルの内容

使用例:
AI: I'll read the package.json file for you.

Tool call: read_file
Parameters: {"path": "./package.json"}

Result: {
  "name": "my-project",
  "version": "1.0.0",
  "dependencies": {
    "express": "^4.18.0"
  }
}

write_file

ファイルにコンテンツを書き込む

パラメータ:
path(string)必須

ファイルを書き込むパス

content(string)必須

ファイルに書き込むコンテンツ

戻り値:

string - 成功確認

使用例:
AI: I'll create a new README file for you.

Tool call: write_file
Parameters: {
  "path": "./README.md",
  "content": "# My Project\n\nThis is a sample project."
}

Result: File written successfully to ./README.md

list_files

指定されたパスのファイルとディレクトリを一覧表示

パラメータ:
path(string)必須

一覧表示するディレクトリパス

recursive(boolean)

再帰的に一覧表示するかどうか

戻り値:

array - ファイルとディレクトリのリスト

使用例:
AI: Let me list the files in the src directory.

Tool call: list_files
Parameters: {"path": "./src", "recursive": false}

Result: [
  "index.js",
  "utils.js",
  "components/",
  "styles/"
]

シェルツール

シェルコマンドとスクリプトを実行するためのツール

run_shell_command

シェルコマンドを実行

パラメータ:
command(string)必須

実行するシェルコマンド

cwd(string)

コマンドの作業ディレクトリ

戻り値:

object - stdout、stderr、終了コードを含むコマンド結果

使用例:
AI: I'll check the current Git status.

Tool call: run_shell_command
Parameters: {"command": "git status --porcelain"}

Result: {
  "stdout": " M src/index.js\n?? new-file.txt",
  "stderr": "",
  "exitCode": 0
}

run_script

スクリプトファイルを実行

パラメータ:
script_path(string)必須

スクリプトファイルのパス

args(array)

スクリプトに渡す引数

戻り値:

object - スクリプト実行結果

使用例:
AI: I'll run the build script with production flag.

Tool call: run_script
Parameters: {
  "script_path": "./scripts/build.sh",
  "args": ["--production"]
}

Result: {
  "stdout": "Building for production...\nBuild completed successfully!",
  "stderr": "",
  "exitCode": 0
}

Webツール

Webリクエスト、検索、オンラインコンテンツ用ツール

web_fetch

URLからコンテンツを取得

パラメータ:
url(string)必須

コンテンツを取得するURL

headers(object)

リクエストヘッダー

戻り値:

object - コンテンツ、ステータス、ヘッダーを含むレスポンス

使用例:
AI: I'll fetch data from the API endpoint.

Tool call: web_fetch
Parameters: {"url": "https://api.github.com/repos/google-gemini/gemini-cli"}

Result: {
  "status": 200,
  "content": "{\"name\": \"gemini-cli\", \"description\": \"...\"}"
}

web_search

ウェブ上で情報を検索

パラメータ:
query(string)必須

検索クエリ

num_results(number)

返す結果の数

戻り値:

array - 検索結果のリスト

使用例:
AI: I'll search for information about Gemini CLI.

Tool call: web_search
Parameters: {"query": "Gemini CLI documentation", "num_results": 5}

Result: [
  {
    "title": "Gemini CLI Official Documentation",
    "url": "https://docs.geminicli.cloud",
    "snippet": "Complete documentation for Gemini CLI..."
  }
]

メモリツール

セッション情報を保存・取得するためのツール

remember

後で使用するために情報を保存

パラメータ:
key(string)必須

情報を保存するキー

value(string)必須

保存する値

戻り値:

string - 保存確認

使用例:
AI: I'll remember your preference.

Tool call: remember
Parameters: {"key": "user_preference", "value": "prefer TypeScript for development"}

Result: Information stored under key 'user_preference'

recall

以前に保存された情報を取得

パラメータ:
key(string)必須

情報を取得するキー

戻り値:

string - 保存された値

使用例:
AI: Let me retrieve your preference.

Tool call: recall
Parameters: {"key": "user_preference"}

Result: "prefer TypeScript for development"

ディレクトリツール

ディレクトリ操作とナビゲーション用ツール

create_directory

新しいディレクトリを作成

パラメータ:
path(string)必須

作成するディレクトリのパス

recursive(boolean)

親ディレクトリを再帰的に作成するかどうか

戻り値:

string - 作成確認

使用例:
AI: I'll create a new project directory.

Tool call: create_directory
Parameters: {"path": "./src/components", "recursive": true}

Result: Directory './src/components' created successfully

get_current_directory

現在の作業ディレクトリを取得

パラメータ:

パラメータなし

戻り値:

string - 現在のディレクトリパス

使用例:
AI: Let me check the current working directory.

Tool call: get_current_directory
Parameters: {}

Result: "/Users/username/projects/my-app"

ツール設定

ツールの動作と権限を設定

ツールの有効/無効

gemini config set tools-enabled truegemini config set file-tools-enabled falsegemini config set web-tools-enabled true

ツールタイムアウト

gemini config set tool-timeout 30gemini config set web-timeout 10gemini config set shell-timeout 60

関連リソース

ツールとカスタマイズについて詳しく学ぶ