Skip to content

gRPC

recon grpc compiles your .proto files in-process, so you do not need protoc installed. It can list the services and methods they define, or call one method: it turns a JSON payload into a protobuf message, sends it over HTTP/2, and prints the reply messages as JSON. Use it to poke at a gRPC service from a terminal or a CI job without generating client code.

Given this file at proto/echo.proto, which imports proto/common/types.proto:

syntax = "proto3";
package test.v1;
import "common/types.proto";
message EchoRequest {
string message = 1;
int64 student_id = 2;
}
message EchoReply {
string message = 1;
string email = 2;
common.v1.Program program = 3;
}
service EchoService {
rpc Echo (EchoRequest) returns (EchoReply);
rpc GzipEcho (EchoRequest) returns (EchoReply);
rpc StreamEcho (EchoRequest) returns (stream EchoReply);
rpc Collect (stream EchoRequest) returns (EchoReply);
rpc Chat (stream EchoRequest) returns (stream EchoReply);
rpc Fail (EchoRequest) returns (EchoReply);
rpc Slow (EchoRequest) returns (EchoReply);
}

List what it defines. This does not touch the network:

Terminal window
recon grpc --inspect --proto proto/echo.proto
Protobuf Schema (zero-protoc): 1 services, 7 methods
/test.v1.EchoService/Echo [unary] (test.v1.EchoRequest) -> (test.v1.EchoReply)
/test.v1.EchoService/GzipEcho [unary] (test.v1.EchoRequest) -> (test.v1.EchoReply)
/test.v1.EchoService/StreamEcho [stream] (test.v1.EchoRequest) -> (test.v1.EchoReply)
/test.v1.EchoService/Collect [unary] (test.v1.EchoRequest) -> (test.v1.EchoReply)
/test.v1.EchoService/Chat [stream] (test.v1.EchoRequest) -> (test.v1.EchoReply)
/test.v1.EchoService/Fail [unary] (test.v1.EchoRequest) -> (test.v1.EchoReply)
/test.v1.EchoService/Slow [unary] (test.v1.EchoRequest) -> (test.v1.EchoReply)

Call a method on a plaintext server:

Terminal window
recon grpc http://127.0.0.1:4602 --proto proto/echo.proto \
--service EchoService --method Echo \
--data '{"message":"ping","studentId":"42"}' \
--header 'Authorization: Bearer {{DEV_API_TOKEN}}'

In human format the output is a summary line, gRPC <path> -> <status code> (<status name>) in <ms>ms (messages=<n>, airlock=<bool>), followed by the reply messages as a JSON array.

  • --proto <FILE> is required on every run, including calls. Repeat it for several files.
  • Relative paths for --proto and --include are resolved against the workspace directory (--workspace, default .), not the current directory.
  • Each file must exist, or the command fails with io error at <path>: proto file not found.
  • Import search paths are the directory of every --proto file plus every --include <DIR>.

If an import is not under one of those directories, compilation fails:

Terminal window
recon grpc --inspect --proto proto/svc/s.proto
error E_CLI_RUNTIME: proto compilation error: import 'common/types.proto' not found
hint: Check workspace `.recon.toml`, arguments, or network connectivity.

Add the import root with --include:

Terminal window
recon grpc --inspect --proto proto/svc/s.proto --include proto
Protobuf Schema (zero-protoc): 1 services, 1 methods
/svc.v1.S/Get [unary] (svc.v1.Req) -> (svc.v1.Req)

--inspect compiles the files and lists every service and method, then exits 0. It needs no endpoint and does not load the workspace configuration.

In human format each method is shown as <path> [unary|stream] (<input type>) -> (<output type>). The label is stream when the method is server-streaming and unary otherwise, so a client-streaming method such as Collect above is labelled unary. The JSON output has both flags:

Terminal window
recon --format json grpc --inspect --proto proto/svc/s.proto --include proto
{
"services": [
"svc.v1.S"
],
"methods": [
{
"service": "svc.v1.S",
"method": "Get",
"full_path": "/svc.v1.S/Get",
"input_type": "svc.v1.Req",
"output_type": "svc.v1.Req",
"client_streaming": false,
"server_streaming": false
}
]
}

A call needs <ENDPOINT>, --service and --method. If any is missing, the command fails with E_INVALID_ARGS and exit code 2.

  • --service matches a fully qualified name such as test.v1.EchoService exactly. If that fails, Recon takes the first service whose full name or short name (EchoService) matches without regard to case. A leading / is ignored.
  • --method matches the method name exactly, or without regard to case.
  • The request path is /<package.Service>/<Method>, appended to the endpoint with any trailing / removed.
Method kind Support
Unary Supported.
Server streaming Supported. Recon reads until the server ends the stream, then decodes every message. Each message gets its own arrival time in stream_frames. Messages are printed after the call ends, not as they arrive.
Client streaming Not rejected, but Recon always sends exactly one request message and then ends its side of the stream.
Bidirectional streaming Same as client streaming: one request message, then Recon reads every reply until the server ends the stream.

--data (default {}) must be valid JSON. It is converted into the method’s input message using the protobuf JSON mapping:

  • Field names can be the proto name (student_id) or the JSON name (studentId).
  • 64-bit integers can be given as numbers or strings.
  • A field that is not in the message fails the call before anything is sent, for example failed encoding JSON into test.v1.EchoRequest: unrecognized field name 'nope' at line 1 column 7.
  • A JSON null payload is treated as {}.

Replies are converted back to JSON the same way: field names use the JSON name (contact_email becomes contactEmail), enums are printed by name ("MA"), 64-bit integers are printed as strings ("2"), and fields set to their default value are left out.

--header 'Key: Value' adds a metadata entry. Repeat it for more entries. The text is split at the first : and both sides are trimmed. A value without : fails with invalid `--header` format.

  • {{variables}} in metadata values are resolved from the selected environment.
  • Any content-type entry you pass is replaced by content-type: application/grpc.
  • Recon always adds te: trailers.
  • Host, Connection, Keep-Alive and Transfer-Encoding are dropped.
  • The request message is sent as one uncompressed gRPC frame. Recon sends no grpc-timeout, grpc-encoding or user-agent header.
  • Reply frames with the compression flag set are decompressed with gzip. Any other compression flag fails the call with unsupported gRPC compression flag.
  • grpc-status and grpc-message are read from the trailers, or from the response headers for a trailers-only reply. grpc-message is URL-decoded, and a + in it becomes a space.
  • If the reply has no grpc-status at all, the status is taken as 0 (OK). The HTTP status is not checked.
grpc_status grpc_status_name
0 OK
1 CANCELLED
2 UNKNOWN
3 INVALID_ARGUMENT
4 DEADLINE_EXCEEDED
5 NOT_FOUND
6 ALREADY_EXISTS
7 PERMISSION_DENIED
8 RESOURCE_EXHAUSTED
9 FAILED_PRECONDITION
10 ABORTED
11 OUT_OF_RANGE
12 UNIMPLEMENTED
13 INTERNAL
14 UNAVAILABLE
15 DATA_LOSS
16 UNAUTHENTICATED
other UNKNOWN_STATUS
Exit Code When
0 --inspect succeeded, or the call returned grpc-status 0.
1 The call returned a non-zero grpc-status. The reply is still printed.
1 E_FIREWALL_BLOCKED The secret firewall blocked the call.
2 E_INVALID_ARGS Endpoint, --service or --method missing.
2 --proto missing (argument parser error).
2 E_CLI_RUNTIME Any other failure: compile errors, unknown service or method, invalid --data or --header, JSON that does not fit the message, transport errors, malformed reply frames, or the deadline.

--timeout-ms (default 15000, minimum effective value 500) is a client-side deadline around the whole call: connecting, sending and reading the full reply. When it passes, the command fails with protocol operation timed out after <ms> ms. The deadline is not sent to the server; there is no grpc-timeout header.

json and agent format print the full response. The fields are:

Field Meaning
endpoint The endpoint you passed, with secret values replaced.
full_path /<package.Service>/<Method>.
grpc_status, grpc_status_name See Status codes.
grpc_message Decoded grpc-message, or null.
total_ms Time for the whole call, including compilation.
messages Reply messages as JSON. One for unary, any number for streaming.
stream_frames[] index, offset_ms (arrival time of the network read that completed the message, measured from the start of the call) and payload, one per message.
response_headers HTTP/2 response headers.
response_trailers HTTP/2 trailers.
airlocked true when --airlock was passed.
compliance_receipt The PII Airlock receipt for the messages and headers. Produced on every call.

With --airlock, the reply messages and response headers are masked by the PII Airlock before they are printed. stream_frames carries the masked messages too. If the masked messages cannot be parsed back as a JSON array, Recon falls back to the unmasked messages.

Server reflection is available through the Studio and the HTTP API only. The CLI always needs --proto.

When asked to reflect an endpoint, Recon:

  1. Calls grpc.reflection.v1.ServerReflection/ServerReflectionInfo with a list-services request.
  2. If that call returns UNIMPLEMENTED, repeats it on grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo and uses v1alpha from then on.
  3. Drops services whose names start with grpc.reflection..
  4. Requests the file that contains each remaining service, then requests every imported file by name until all dependencies are loaded.
  5. Builds a descriptor set from those files and returns the service list, the protocol version used (v1 or v1alpha) and the descriptor set as base64 (descriptor_set_base64).

Each reflection request is sent as a separate call and only the first reply message of each is read. Every reflection call passes through the secret firewall and uses the same metadata and auth as the call itself.

A later call can use the reflected schema in two ways:

  • pass descriptor_set_base64 back, which skips reflection; or
  • set use_reflection: true with an empty proto_files list, which reflects again before the call.
  • Secret firewall. The call (and every reflection call) is resolved and passed through the Outbound Secret Firewall before the connection opens:

    Terminal window
    recon grpc http://127.0.0.1:4602 --proto proto/echo.proto --service EchoService --method Echo \
    --header 'Authorization: Bearer {{PROD_STRIPE_KEY}}'
    error E_FIREWALL_BLOCKED: Blocked secret `PROD_STRIPE_KEY` bound for `api.stripe.com` from being sent to unauthorized host `127.0.0.1`.
    hint: Switch environment or update secret allowed_hosts.
  • Auth and signing. The CLI sends no auth block; put credentials in --header with {{variables}}. The HTTP API takes an auth block with the schemes on Auth & Request Signing.

  • Transport.

    • http:// endpoints use HTTP/2 over plaintext (h2c) with prior knowledge. There is no HTTP/1.1 upgrade step.
    • https:// endpoints use TLS with the bundled Mozilla root certificates, then HTTP/2.
    • Any other scheme fails with unsupported gRPC endpoint scheme.
    • Only the first address returned by DNS is tried.
    • The global --proxy, --no-proxy, --ca-cert, --client-cert, --client-key, --insecure, --cookies and --cookie-jar flags, and .recon/network.json, have no effect. There is no proxy support, no custom CA, no client certificate and no way to accept a self-signed certificate.

recon grpc does not write to the Flight Recorder.

Flag Default Description
[ENDPOINT] none http://host:port or https://host:port. Required unless --inspect.
--proto <FILE> required .proto file to compile. Repeatable.
--include <DIR> none Extra import search directory. Repeatable.
--service <NAME> none package.Service or bare Service.
--method <NAME> none RPC method name.
--data <JSON> {} Request message as JSON.
--header <'Key: Value'> none Metadata entry. Repeatable.
--inspect off List services and methods without a network call.
--env <ENV> workspace default_env Environment used for variables and secrets.
--timeout-ms <MS> 15000 Client-side deadline. Minimum effective value 500.
--airlock off Mask PII in reply messages and response headers.

Global flags such as --workspace, --format and --salt also apply. See the CLI Reference.

Surface Name Notes
MCP tool recon_grpc_call Takes proto_files (required), endpoint, service, method, request_json, inspect_only, env. No include directories, metadata or reflection. Airlock is always on and the timeout is 15000 ms. Every call is checked by agent policy as a POST, so a workspace that requires approval for mutations holds every gRPC call for approval. inspect_only skips the policy check.
HTTP API POST /api/v1/grpc/inspect Body: proto_files, optional include_dirs. Returns { "schema": ... }.
HTTP API POST /api/v1/grpc/reflect Body: endpoint, optional metadata, auth, env, timeout_ms (default 10000, clamped to 500 to 60000). Returns { "reflection": ... }.
HTTP API POST /api/v1/grpc/call Body: call (endpoint, proto_files, include_dirs, service, method, request_json, metadata, auth, timeout_ms, airlock, use_reflection, descriptor_set_base64) and optional env. Relative paths resolve against the workspace. Returns { "response": ... }. See HTTP API.
Web Studio Protocols, tab gRPC (No-protoc) Comma-separated proto files (default proto/greeter.proto), endpoint (default http://127.0.0.1:50051), Inspect .proto, Reflect, service and method pickers, a JSON payload box and Invoke RPC. After Reflect, calls reuse the reflected descriptor set. If the proto files box is empty, the call reflects first. Streaming replies are shown frame by frame with offsets. Also opened from the command palette entry “Open Zero-protoc gRPC Client”.