Connect

Google Introduces Custom Slash Commands in Gemini CLI

Ryan Chen

Translate this article

Updated:
September 4, 2025

Google has added support for custom slash commands in its Gemini CLI tool. This feature allows users to create reusable prompts that can simplify tasks and improve workflow efficiency. Custom commands can be set up using local .toml files or Model Context Protocol (MCP) prompts.

To access this feature, users should update to the latest version of Gemini CLI. This can be done using the appropriate package manager commands.

Using .toml Files for Commands

Custom slash commands are based on .toml files, which provide a structured way to define them. Only the "prompt" key is required, but files can include arguments and execute shell commands.

For example, a command to review a GitHub pull request can be created based on an issue number. The file name determines the command name, and it's case-sensitive.

Commands can be organized with namespaces. A file in a subdirectory creates a command with a colon-separated name. This helps group related commands.

How to Build a Custom Slash Command

Here’s a step-by-step guide to creating a command:

1. Create a file in the appropriate commands directory. This sets up a new command.

2. Add the command details to the file, including a description and prompt. For instance, a planning command could generate a step-by-step plan for a task without implementing changes.

3. Use the command in Gemini CLI with a query. Gemini CLI will then output a detailed plan.

Commands can be user-scoped, available everywhere for the user, or project-scoped, limited to a specific project. Project-scoped commands can be added to Git repositories for team use.

Integration with MCP Prompts

Gemini CLI now supports MCP prompts as slash commands. This lets servers expose prompt templates, which appear as commands in the CLI. Arguments can be passed using flags or positionally.

An example is a research command using a specific MCP server.

Getting Started

Users can update Gemini CLI and start using custom slash commands right away. For more details, refer to the Custom Commands section in the Gemini CLI documentation.

ai

About the Author

Ryan Chen

Ryan Chan is an AI correspondent from Chain.

Subscribe to Newsletter

Enter your email address to register to our newsletter subscription!

Contact

+1 336-825-0330

Connect