Skip to main content

Execution Types

MCI supports four powerful execution types: Text, File, CLI, and HTTP. Each type is designed for different use cases and provides specific capabilities for tool execution.

Text Execution

Return static or templated text directly. Perfect for simple messages, templates, or computed strings.

Basic Text Tool

Using Text Execution

Advanced Text Templates

Text execution supports complex templating with conditional logic:
Text execution is ideal for generating reports, email templates, configuration snippets, or any formatted text output.

File Execution

Read and return file contents with optional template substitution. Useful for loading configuration files, templates, or documentation.

Basic File Tool

Template File Content

Create a file configs/database.conf:
database.conf

Using File Execution

File Execution Options

string
required
Path to the file to load. Supports templating with {{props.name}} and {{env.VAR}}.
boolean
default:"false"
Whether to process template variables in the file content itself.
Ensure file paths are secure and don’t allow directory traversal attacks when using user input in path templates.

CLI Execution

Execute command-line programs and capture their output. Great for running system commands, scripts, or CLI tools.

Basic CLI Tool

Using CLI Execution

CLI Configuration Options

string
required
The command to execute (e.g., “grep”, “python”, “node”, “git”).
array
Fixed arguments passed to the command. Supports templating.
object
Dynamic flags based on input properties.
string
Working directory for command execution. Supports templating.
number
default:"30000"
Maximum execution time in milliseconds.

Advanced CLI Examples

HTTP Execution

Make HTTP requests to APIs with full support for authentication, headers, query parameters, and request bodies.

Basic GET Request

POST Request with JSON Body

Authentication Options

Request Body Types

Using HTTP Execution

HTTP Configuration Options

string
required
HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
string
required
Target URL. Supports templating for dynamic URLs.
object
HTTP headers as key-value pairs. Supports templating.
object
Query parameters as key-value pairs. Supports templating.
object
Request body configuration.
object
Authentication configuration.
number
default:"30000"
Request timeout in milliseconds.

Execution Type Comparison

Text Execution

Best for: Templates, reports, messagesPros: Simple, fast, no dependenciesCons: Static output only

File Execution

Best for: Configs, templates, documentation Pros: Supports templating, file system access Cons: Requires file system access

CLI Execution

Best for: System commands, scripts, tools Pros: Access to system utilities, flexible Cons: Platform-dependent, security considerations

HTTP Execution

Best for: API integration, web servicesPros: Rich protocol support, authenticationCons: Network dependency, API rate limits

Best Practices

Security

CLI Execution: Validate and sanitize all user/LLM inputs to prevent command injection attacks/errors.
File Execution: Use absolute paths or restrict file access to prevent directory traversal.
HTTP Execution: Always use HTTPS for sensitive data and store API keys in environment variables.

Performance

Set appropriate timeouts for each execution type to prevent tools from hanging indefinitely.
Use caching for expensive operations, especially for HTTP requests that return static data.

Error Handling

Always check result.isError before processing tool outputs, and provide meaningful error messages to users.

Next Steps

Advanced Features

Learn about environment management, filtering, and optimization

API Reference

Detailed documentation of all classes and methods