Gemini CLI icon

Gemini CLI

Use Google Gemini CLI to execute AI-powered coding tasks with multimodal capabilities

Overview

The "Generate Plan" operation of the Gemini CLI node creates a detailed, structured execution plan for a given task prompt without executing it. It leverages an AI assistant to break down complex tasks into clear, actionable steps with descriptions, optional commands, involved files, and estimated durations.

This operation is beneficial when you want to:

  • Automatically generate step-by-step plans for software development or project tasks.
  • Obtain a clear roadmap before starting execution or coding.
  • Use AI to assist in planning complex workflows or automation sequences.

Example use case:
You provide a prompt like "Create a Python function to parse CSV files," and the node returns a JSON plan outlining each step needed to implement this function, including file operations and commands if applicable.

Properties

Name Meaning
Prompt The instruction or task description sent to Gemini CLI to generate the plan. Required. Example: "Create a Python function to parse CSV files"
Model The Gemini AI model to use for generating the plan. Options: Gemini 2.5 Pro (most capable, large context window), Gemini 2.5 Flash (faster, efficient)
Max Turns Maximum number of conversation turns allowed during interaction (not directly used in plan generation but configurable)
Timeout Maximum time in seconds to wait for Gemini CLI completion before aborting
Project Path Directory path where Gemini CLI runs, allowing access to project files and commands. If empty, uses current working directory
Output Format How to format the output data. Options include: Messages (raw message array), Plan (execution plan structure), Plan Status (progress/status), Structured (object with messages, summary, result, metrics), Text (final text only)
Additional Options Collection of extra settings:
• API Key (Gemini API key if not set via environment variable)
• Use Vertex AI (boolean to switch backend)
• System Prompt (extra instructions/context for Gemini CLI)
• Debug Mode (enable debug logs)
Tools Configuration Configure built-in tools and integrations:
• Enable Built-in Tools (filesystem, shell commands, web fetch, web search)
• Security Mode (safe, auto-approve, sandbox)
• Enable Checkpointing (save session state)
MCP Servers Configure external MCP servers for extended functionality, including connection type, commands, environment variables, tool inclusion/exclusion, trust level, and working directory

Output

The output JSON structure depends on the selected Output Format:

  • Plan: Returns the full execution plan object containing:

    • id: Unique plan identifier
    • title: Brief title of the task
    • description: Detailed description of the task
    • steps: Array of step objects, each with:
      • id: Step identifier
      • description: What the step does
      • command: Optional command to run
      • files: Optional list of files involved
      • estimated_duration: Estimated time in seconds
      • status: Current status (e.g., "pending")
    • created_at, modified_at: Timestamps
    • status: Plan status (e.g., "draft")
    • original_prompt: The original user prompt
    • configuration: Settings used for generation (model, project path, tools config)
  • Structured: Includes the plan plus additional metadata such as messages exchanged, summary counts, success flag, and metrics.

  • Messages: Raw array of all messages exchanged with Gemini CLI during generation.

  • Text: Only the final textual result from Gemini CLI.

  • Plan Status: Not typically relevant for generate_plan but available for other operations.

The node does not output binary data for this operation.

Dependencies

  • Requires the Gemini CLI installed and accessible in the system PATH (gemini command).
  • Optionally requires a valid API key credential for Gemini API or Vertex AI if used.
  • Node may require filesystem access permissions if a project path is specified.
  • External MCP servers can be configured for extended capabilities.
  • Environment variables can be used to supply API keys if not provided explicitly.

Troubleshooting

  • Gemini CLI not found or not installed: Ensure the Gemini CLI is installed globally (npm install -g @google/gemini-cli) and accessible in the system PATH.
  • Invalid project path: The specified project directory must exist, be a directory, and have read/write permissions.
  • Empty prompt error: For generate_plan, the prompt cannot be empty; provide a meaningful task description.
  • Timeouts: Increase the timeout property if the Gemini CLI takes longer than expected.
  • Plan parsing errors: If the response from Gemini CLI does not contain valid JSON matching the expected plan structure, check the prompt and system prompt for clarity and correctness.
  • API key issues: Provide a valid API key either via node parameters or environment variables to avoid authentication failures.
  • Security mode caution: Using "Auto-Approve" security mode can lead to unsafe operations; prefer "Safe Mode" unless fully trusted.

Links and References

Discussion