Testing with the CLI
The Python vgi-rpc CLI is the primary tool for testing vgi-rpc-typescript servers. It can discover methods, call them, and display results in various formats.
Installation
pip install vgi-rpc[cli]Subprocess mode
The CLI can launch your server as a subprocess, communicating over stdin/stdout:
vgi-rpc --cmd "bun run server.ts" <command>Describe a service
vgi-rpc --cmd "bun run examples/calculator.ts" describeThis calls the __describe__ method and displays all available methods, their parameters, result schemas, and documentation.
Call a unary method
vgi-rpc --cmd "bun run examples/calculator.ts" call add a=2.0 b=3.0# {"result": 5.0}Parameters are passed as key=value pairs. The CLI infers types from the parameter schema.
Call a producer stream
vgi-rpc --cmd "bun run examples/streaming.ts" call count limit=5 --format tableThe --format table flag renders streaming results as a formatted table.
Output formats
| Flag | Format |
|---|---|
| (default) | JSON lines |
--format table | Formatted table |
--format csv | CSV |
HTTP mode
The CLI also supports HTTP transport:
# Start your serverbun run server.ts & # or use Bun.serve()
# Describe via HTTPvgi-rpc --url http://localhost:8080 describe
# Call via HTTPvgi-rpc --url http://localhost:8080 call add a=1.0 b=2.0Tips
- Use
describefirst to discover available methods and their parameter types - Parameter types are inferred — the CLI handles type coercion automatically
- Producer streams output results incrementally as they arrive
- Exchange streams require piped input (see
vgi-rpc --helpfor details)