MCP

Aegisv1

โšก 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.

Pipe FormatJSON SupportReal-time TestingAuto Type Inference

๐Ÿš€ Quick Examples

Get started immediately with these common CLI testing patterns. The query command supports multiple formats for maximum flexibility.

๐Ÿ†• Pipe Format (Recommended)

bash
# 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)

bash
# 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

bash
# 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.json

Use --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:test
key:value

Basic parameter

|

Separator

nested.field

Dot notation

Automatic Type Inference

InputInterpreted AsJavaScript Type
text:hello"hello"string
count:4242number
active:truetrueboolean
data:nullnullnull
score:3.143.14number

Advanced Features

bash
# 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.json

JSON 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.

FeaturePipe FormatJSON 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

bash
# 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 --json

Command 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

bash
$ 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

bash
# List all available tools
aegis query --config config.json

# Get detailed tool information
aegis query --method tools/list --config config.json --verbose

Start here to understand what tools your MCP server provides.

โšก Quick Tool Testing

bash
# 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.json

Rapidly test tools during development with minimal typing.

๐Ÿงช Error Testing

bash
# 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.json

Verify your error handling works correctly.

๐Ÿค– Automation Integration

bash
# 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 --quiet

Integrate 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.json to list available tools
  • โ€ขUse --verbose to 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.