Overview
This node provides an interface to interact with the Gemini CLI tool through a stateful wrapper API. It allows users to manage work sessions, communicate with an assistant, and perform file system operations such as listing files, reading, writing, and searching file contents. The node is useful in automation workflows where command-line interactions with Gemini need to be integrated seamlessly, for example:
- Starting and ending persistent sessions to maintain context.
- Sending chat messages to an assistant for conversational automation.
- Managing files and directories programmatically within workflows.
- Searching file contents using regex patterns.
Practical examples include automating code reviews by searching files, managing session-based tasks, or integrating Gemini CLI capabilities into larger data processing pipelines.
Properties
Name | Meaning |
---|---|
Command | The action to execute. Options: Start Session, End Session, Chat, List Files, Read File, Write File, Search Content, List Sessions, End All Sessions. |
Session ID | The identifier of the active session to use; required for commands other than starting or listing sessions. |
Prompt | The message text sent to the assistant (used only with the Chat command). |
Path | The file or directory path to operate on (used with List Files, Read File, Write File, Search Content commands). |
Content | The content to write into a file (used only with the Write File command). |
Pattern | The regex pattern to search for inside files (used only with the Search Content command). |
Wrapper API URL | The URL endpoint of the Gemini CLI wrapper API that processes the commands. |
Output
The node outputs JSON data returned from the Gemini CLI wrapper API. The structure varies depending on the command executed but generally includes:
- For session commands: session identifiers or status information.
- For chat commands: assistant responses.
- For file operations: lists of files/directories, file contents, or search results.
No binary data output is indicated by the source code.
Dependencies
- Requires access to a Gemini CLI wrapper API, specified by the "Wrapper API URL" property.
- Needs an API key credential for authentication with the Gemini CLI wrapper API.
- The node expects the Gemini CLI wrapper API to be running and accessible at the provided URL.
- Proper configuration of credentials including API keys, working directory, and CLI path is necessary when starting a session.
Troubleshooting
Common issues:
- Incorrect or unreachable Wrapper API URL will cause HTTP request failures.
- Missing or invalid API key credentials will result in authentication errors.
- Providing an invalid or expired Session ID may cause session-related commands to fail.
- Improper file paths or permissions can cause file operation commands to error out.
Error messages:
- HTTP request errors typically indicate connectivity or API availability problems.
- Authentication errors suggest misconfigured or missing API credentials.
- Errors related to session management usually mean the session does not exist or has ended.
Resolutions:
- Verify the Wrapper API URL is correct and the service is running.
- Ensure API credentials are properly set up and valid.
- Confirm session IDs are correctly passed between nodes.
- Check file paths and permissions on the target system.
Links and References
- Gemini CLI official documentation (if available)
- n8n HTTP Request node documentation for understanding API calls
- Regex pattern syntax references for the Search Content command