Skip to main content

Glimx Tools and Commands API

This document provides detailed information about all the tools and commands available in Glimx CLI, including their usage, parameters, and examples.

File System Tools​

Read Tool​

Reads content from files in the local filesystem.

Usage:

[Read(file_path="path/to/file")]

Parameters:

  • file_path (string, required): Path to the file to read

Examples:

[Read(file_path="src/index.ts")]
[Read(file_path="./package.json")]

Write Tool​

Writes content to a file in the local filesystem.

Usage:

[Write(file_path="path/to/file", content="file content")]

Parameters:

  • file_path (string, required): Path to the file to write
  • content (string, required): Content to write to the file

Examples:

[Write(file_path="src/index.ts", content="console.log('Hello, World!');")]
[Write(file_path="README.md", content="# My Project\n\nDescription here.")]

Edit Tool​

Edits content in an existing file by replacing specific text.

Usage:

[Edit(file_path="path/to/file", old_string="text to replace", new_string="replacement text")]

Parameters:

  • file_path (string, required): Path to the file to edit
  • old_string (string, required): Text to be replaced
  • new_string (string, required): Replacement text

Examples:

[Edit(file_path="src/index.ts", old_string="console.log('Hello');", new_string="console.log('Hello, World!');")]

Glob Tool​

Finds files matching a glob pattern.

Usage:

[Glob(pattern="**/*.ts")]

Parameters:

  • pattern (string, required): Glob pattern to match files
  • path (string, optional): Directory to search in (defaults to current directory)

Examples:

[Glob(pattern="src/**/*.ts")]
[Glob(pattern="**/*.json", path="./config")]

Search Tools​

Grep Tool​

Searches for patterns in files using regular expressions.

Usage:

[Grep(pattern="search term")]

Parameters:

  • pattern (string, required): Regular expression pattern to search for
  • path (string, optional): File or directory to search in
  • type (string, optional): File type to search (e.g., "ts", "js", "py")
  • glob (string, optional): Glob pattern to filter files
  • output_mode (string, optional): Output mode ("content", "files_with_matches", "count")
  • -i (boolean, optional): Case insensitive search
  • -n (boolean, optional): Show line numbers

Examples:

[Grep(pattern="function\\s+\\w+", type="ts")]
[Grep(pattern="TODO", glob="src/**/*.ts", output_mode="content")]

Execution Tools​

Bash Tool​

Executes bash commands in the terminal.

Usage:

[Bash(command="ls -la")]

Parameters:

  • command (string, required): Bash command to execute
  • description (string, optional): Description of what the command does
  • timeout (number, optional): Timeout in milliseconds

Examples:

[Bash(command="npm install", description="Install dependencies")]
[Bash(command="git status", description="Check git status")]

Task Tool​

Launches specialized agents to handle complex tasks.

Usage:

[Task(subagent_type="code-reviewer", description="Review code", prompt="Review this code for best practices")]

Parameters:

  • subagent_type (string, required): Type of agent to launch ("code-reviewer", "design-agent", "general-purpose", "task-executor")
  • description (string, required): Short description of the task
  • prompt (string, required): Detailed task prompt for the agent

Examples:

[Task(subagent_type="code-reviewer", description="Review code", prompt="Review this React component for performance issues")]

Web Tools​

WebFetch Tool​

Fetches and processes content from URLs.

Usage:

[WebFetch(url="https://example.com", prompt="Summarize this page")]

Parameters:

  • url (string, required): URL to fetch content from
  • prompt (string, required): Prompt to process the fetched content

Examples:

[WebFetch(url="https://react.dev", prompt="Find documentation about React hooks")]

WebSearch Tool​

Searches the web for information.

Usage:

[WebSearch(query="React best practices 2025")]

Parameters:

  • query (string, required): Search query
  • time_range (string, optional): Time range ("OneDay", "OneWeek", "OneMonth", "OneYear", "NoLimit")

Examples:

[WebSearch(query="TypeScript generics tutorial", time_range="OneYear")]

Project Management Tools​

TodoWrite Tool​

Creates and manages task lists for complex projects.

Usage:

[TodoWrite(todos=[{"content": "Implement feature", "status": "pending"}])]

Parameters:

  • todos (array, required): Array of todo items with content and status

Examples:

[TodoWrite(todos=[
{"content": "Create database schema", "status": "pending"},
{"content": "Implement API endpoints", "status": "in_progress"}
])]

MCP Tools​

MCP Integration​

Glimx includes 5 default MCP servers that provide additional capabilities:

  1. Filesystem - Local file system access
  2. Git - Git repository operations
  3. Sequential Thinking - Step-by-step problem solving
  4. Fetch - Web content retrieval
  5. Memory - Knowledge graph persistence

These servers are automatically available and don't require specific tool calls.

Session Management Commands​

These commands are available during interactive sessions:

/compact​

Summarizes the current session to reduce token usage.

Usage:

/compact

/undo​

Undoes the last message or action.

Usage:

/undo

/redo​

Redoes the last undone message or action.

Usage:

/redo

/help​

Shows all available commands.

Usage:

/help

/exit​

Exits the current session.

Usage:

/exit

Configuration Commands​

Theme Management​

Manage the terminal theme.

Usage:

/theme list          # List available themes
/theme set glimx # Set theme to glimx

Model Management​

Manage AI models.

Usage:

/model list          # List available models
/model set groq/qwen-32b # Set model to Qwen 32B on Groq

Permission System​

Glimx uses a smart permission system that validates commands before execution:

  • allow - Auto-execute without asking
  • ask - Require user approval (default)
  • deny - Block completely

Permissions can be configured for different command types:

  • bash - Shell commands
  • edit - File editing operations
  • write - File creation operations
  • webfetch - Web content fetching

Error Handling​

All tools can return errors that should be handled appropriately:

  • FileNotFoundError - When a file is not found
  • PermissionDeniedError - When a permission is denied
  • TimeoutError - When an operation times out
  • InvalidInputError - When input parameters are invalid

Best Practices​

When Using Tools​

  1. Be Specific: Provide clear, specific parameters to tools
  2. Handle Errors: Always be prepared to handle potential errors
  3. Verify Results: Check the output of tools to ensure they worked as expected
  4. Use Appropriately: Choose the right tool for the task at hand

When Writing Prompts​

  1. Be Clear: Clearly state what you want to accomplish
  2. Provide Context: Include relevant context for better results
  3. Break Down Complex Tasks: Use TodoWrite for multi-step tasks
  4. Validate Output: Always verify that tool output meets your requirements

Examples​

Reading and Analyzing Code​

[Read(file_path="src/index.ts")]
[Grep(pattern="function\\s+\\w+", type="ts")]
[Task(subagent_type="code-reviewer", description="Review code", prompt="Review this code for performance issues")]

Creating a New Feature​

[TodoWrite(todos=[
{"content": "Design feature API", "status": "pending"},
{"content": "Implement backend logic", "status": "pending"},
{"content": "Create frontend components", "status": "pending"}
])]
[Task(subagent_type="design-agent", description="Design feature", prompt="Design a user authentication feature with login and signup")]

Debugging an Issue​

[Bash(command="npm run test", description="Run tests to identify issues")]
[Read(file_path="logs/error.log")]
[WebSearch(query="Node.js ECONNREFUSED error solution")]

Tool Chaining​

Tools can be chained together for complex workflows:

[Glob(pattern="src/**/*.ts")]
[Grep(pattern="TODO", glob="src/**/*.ts")]
[TodoWrite(todos=[
{"content": "Implement TODO items", "status": "pending"}
])]

Performance Considerations​

  1. Use Appropriate Tools: Choose the most efficient tool for each task
  2. Limit Output: Use head_limit and other parameters to limit large outputs
  3. Parallel Execution: Run independent tools in parallel when possible
  4. Cache Results: Reuse results when appropriate to avoid redundant operations

Security Considerations​

  1. Validate Inputs: Always validate inputs to tools
  2. Limit Permissions: Use the permission system to limit potentially dangerous operations
  3. Review Output: Review tool output before executing commands
  4. Avoid Sensitive Data: Don't pass sensitive data through tools unnecessarily

Troubleshooting​

Common Issues​

  1. Tool Not Found: Ensure you're using the correct tool name
  2. Permission Errors: Check your permission configuration
  3. Timeout Errors: Increase timeout values for slow operations
  4. Invalid Parameters: Verify all required parameters are provided

Debugging Tips​

  1. Use Verbose Output: Enable debug logging for detailed information
  2. Test Tools Individually: Test each tool separately to isolate issues
  3. Check Documentation: Refer to tool-specific documentation for usage details
  4. Review Examples: Look at examples for proper usage patterns

Extending Glimx​

Custom Tools​

You can create custom tools by extending the base Tool class:

class CustomTool extends Tool {
name = 'custom-tool';
description = 'Description of what this tool does';

async execute(params: any) {
// Implementation here
return { result: 'success' };
}
}

Custom Agents​

Create specialized agents for specific tasks:

class CustomAgent extends Agent {
name = 'custom-agent';

async process(prompt: string) {
// Custom processing logic
}
}

Next Steps​