โก CLI Testing & Query Command
Interactive Model Context Protocol Testing
Real-Time MCP Server Testing
Test MCP servers interactively with the aegis query command. Features dual parameter formats for maximum CLI usability and comprehensive debugging capabilities.
๐ Quick Examples
Get started immediately with these common CLI testing patterns. The query command supports multiple formats for maximum flexibility.
๐ Pipe Format (Recommended)
# Basic pipe format
aegis query calculator 'operation:add|a:5|b:3' --config config.json
# Nested objects with dot notation
aegis query api_client 'config.host:localhost|config.port:8080|timeout:30' --config config.json
# Mixed data types (auto-inferred)
aegis query tool 'text:hello|count:42|active:true|data:null' --config config.jsonโ CLI-friendly, no quote escaping needed
๐ JSON Format (Traditional)
# Traditional JSON format
aegis query calculator '{"operation": "add", "a": 5, "b": 3}' --config config.json
# Complex nested structures
aegis query complex_tool '{"config": {"host": "localhost"}, "data": [1,2,3]}' --config config.jsonโ Full JSON power for complex structures
โ๏ธ Method Syntax
# Method syntax with pipe format
aegis query --method tools/call --params 'name:read_file|arguments.path:/tmp/test.txt' --config config.json
# Method syntax with JSON format
aegis query --method tools/call --params '{"name": "read_file", "arguments": {"path": "/tmp/test.txt"}}' --config config.json
# List all available tools
aegis query --method tools/list --config config.jsonUse --method for direct JSON-RPC method calls
๐ง Pipe Format Guide
The pipe-separated parameter format provides a CLI-friendly alternative to JSON with automatic type inference and nested object support.
Basic Syntax
key:value|other:123|nested.field:testBasic parameter
Separator
Dot notation
Automatic Type Inference
| Input | Interpreted As | JavaScript Type |
|---|---|---|
text:hello | "hello" | string |
count:42 | 42 | number |
active:true | true | boolean |
data:null | null | null |
score:3.14 | 3.14 | number |
Advanced Features
# JSON values within pipe format
aegis query complex_tool 'metadata:{"version":"1.0"}|tags:["test","demo"]|count:5' --config config.json
# Escaped pipes for literal pipe characters
aegis query text_processor 'message:hello\|world|separator:value' --config config.json
# Complex nested configuration
aegis query service 'database.host:localhost|database.port:5432|cache.enabled:true|cache.ttl:300' --config config.jsonJSON Values
Embed JSON objects and arrays within pipe format
Escaped Pipes
Use \\| for literal pipe characters
Nested Objects
Create nested structures with dot notation
๐ Format Comparison
Choose the right format for your use case. Both formats are fully supported and can be mixed as needed.
| Feature | Pipe Format | JSON Format |
|---|---|---|
| CLI Friendly | โ Excellent | โ ๏ธ Quote Escaping |
| Simple Parameters | โ Very Easy | โ ๏ธ Verbose |
| Nested Objects | โ Dot Notation | โ Native |
| Data Types | โ Auto-Inferred | โ Explicit |
| Complex Structures | โ Mixed JSON/Pipe | โ Full JSON Power |
๐ Debugging & Testing Commands
Use these commands for comprehensive MCP server testing and debugging.
Basic Testing Commands
# Basic tool testing
aegis query read_file 'path:test.txt' --config config.json
# Debug with verbose output
aegis query read_file 'path:test.txt' --config config.json --verbose
# JSON output for automation
aegis query calculator 'operation:add|a:5|b:3' --config config.json --jsonCommand Line Options
Debug Options
--verbose- Show detailed execution information--debug- Enable MCP communication logging--timing- Display operation timing information--json- Output results in JSON format
Output Options
--quiet- Suppress non-essential output--config path- Specify config file path--method method- Call specific JSON-RPC method--params params- Method parameters
Help & Documentation
$ aegis query --help
Usage: aegis query [options] [tool-name] [tool-args]
Query an MCP server tool directly for debugging
Parameter formats supported:
โข JSON format: '{"key": "value", "num": 42}'
โข Pipe format: 'key:value|num:42|nested.field:test'
Examples:
aegis query read_file '{"path": "/tmp/file.txt"}'
aegis query read_file 'path:/tmp/file.txt|encoding:utf8'
aegis query --method tools/call --params 'name:read_file|arguments.path:/tmp/file.txt'Run aegis query --help anytime to see the latest command syntax and examples.
๐ฏ Common Usage Patterns
Learn these common patterns to become productive quickly with the query command.
๐ Server Discovery
# List all available tools
aegis query --config config.json
# Get detailed tool information
aegis query --method tools/list --config config.json --verboseStart here to understand what tools your MCP server provides.
โก Quick Tool Testing
# Test file operations
aegis query read_file 'path:test.txt' --config config.json
# Test calculator with multiple parameters
aegis query calculator 'operation:multiply|a:7|b:6' --config config.json
# Test API calls with complex config
aegis query api_request 'url:https://api.example.com|method:GET|headers.Authorization:Bearer token123' --config config.jsonRapidly test tools during development with minimal typing.
๐งช Error Testing
# Test error handling
aegis query read_file 'path:nonexistent.txt' --config config.json
# Test validation with invalid parameters
aegis query calculator 'operation:divide|a:10|b:0' --config config.json
# Test authentication failures
aegis query api_request 'url:https://api.example.com|headers.Authorization:invalid' --config config.jsonVerify your error handling works correctly.
๐ค Automation Integration
# JSON output for scripts
aegis query status_check --config config.json --json
# Combine with jq for processing
aegis query get_metrics --config config.json --json | jq '.result.data'
# Use in CI/CD pipelines
aegis query health_check 'timeout:30' --config config.json --quietIntegrate with scripts and automation workflows.
๐ก Best Practices
Follow these guidelines for effective CLI testing and debugging.
โ Do
- โขUse pipe format for simple parameters to avoid quote escaping
- โขStart with
aegis query --config config.jsonto list available tools - โขUse
--verboseto understand what's happening - โขTest error scenarios to verify proper error handling
- โขUse dot notation for nested configuration:
config.host:localhost
โ Don't
- โขDon't use JSON format for simple parameters when pipe format is cleaner
- โขDon't forget to escape pipes in values: use
\\| - โขDon't assume all servers implement all standard methods
- โขDon't skip testing with real data and edge cases
- โขDon't rely solely on CLI testing - combine with automated tests
๐ Next Steps
Now that you understand CLI testing, explore these related topics to build comprehensive testing strategies.
๐ YAML Testing
Create declarative test suites with YAML files for automated testing and CI/CD integration.
Learn YAML Testing โ๐ป Programmatic Testing
Build advanced test suites with JavaScript/TypeScript for complex testing scenarios.
Learn Programmatic Testing โ๐ฏ Examples
Explore real-world examples and working MCP servers with complete test suites.
View Examples โ