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 writecontent(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 editold_string(string, required): Text to be replacednew_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 filespath(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 forpath(string, optional): File or directory to search intype(string, optional): File type to search (e.g., "ts", "js", "py")glob(string, optional): Glob pattern to filter filesoutput_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 executedescription(string, optional): Description of what the command doestimeout(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 taskprompt(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 fromprompt(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 querytime_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:
- Filesystem - Local file system access
- Git - Git repository operations
- Sequential Thinking - Step-by-step problem solving
- Fetch - Web content retrieval
- 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 askingask- Require user approval (default)deny- Block completely
Permissions can be configured for different command types:
bash- Shell commandsedit- File editing operationswrite- File creation operationswebfetch- Web content fetching
Error Handling
All tools can return errors that should be handled appropriately:
FileNotFoundError- When a file is not foundPermissionDeniedError- When a permission is deniedTimeoutError- When an operation times outInvalidInputError- When input parameters are invalid
Best Practices
When Using Tools
- Be Specific: Provide clear, specific parameters to tools
- Handle Errors: Always be prepared to handle potential errors
- Verify Results: Check the output of tools to ensure they worked as expected
- Use Appropriately: Choose the right tool for the task at hand
When Writing Prompts
- Be Clear: Clearly state what you want to accomplish
- Provide Context: Include relevant context for better results
- Break Down Complex Tasks: Use TodoWrite for multi-step tasks
- 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
- Use Appropriate Tools: Choose the most efficient tool for each task
- Limit Output: Use head_limit and other parameters to limit large outputs
- Parallel Execution: Run independent tools in parallel when possible
- Cache Results: Reuse results when appropriate to avoid redundant operations
Security Considerations
- Validate Inputs: Always validate inputs to tools
- Limit Permissions: Use the permission system to limit potentially dangerous operations
- Review Output: Review tool output before executing commands
- Avoid Sensitive Data: Don't pass sensitive data through tools unnecessarily
Troubleshooting
Common Issues
- Tool Not Found: Ensure you're using the correct tool name
- Permission Errors: Check your permission configuration
- Timeout Errors: Increase timeout values for slow operations
- Invalid Parameters: Verify all required parameters are provided
Debugging Tips
- Use Verbose Output: Enable debug logging for detailed information
- Test Tools Individually: Test each tool separately to isolate issues
- Check Documentation: Refer to tool-specific documentation for usage details
- 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
- Configuration Guide - Learn how to configure Glimx tools and permissions
- MCP Integration - Detailed information about MCP server integration
- API Documentation - Complete API reference
- Troubleshooting - Solutions to common issues