Help us shape the future of Go! Take the 2026 Go Developer Survey

grpc

package
v0.1.157 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package grpc is the codefly gRPC toolbox — reflection-based introspection of any gRPC server, exposed as typed Tool RPCs.

This is the canonical replacement for `bash -c "grpcurl ..."`. Agents that need to discover what a gRPC service exposes call typed RPCs here; the Bash toolbox refuses every `grpcurl` invocation and routes callers via canonical_for: [grpcurl].

Why this is not just "shell out to grpcurl": the same way the git toolbox uses go-git, the grpc toolbox talks reflection directly over a gRPC connection. No external binary needed, no parsing of grpcurl's text output, structured results all the way through.

Phase 1 ships introspection only — the safe surface:

  • grpc.list_services — every service exposed by the target
  • grpc.describe_service — methods + their request/response types
  • grpc.describe_method — full type descriptor for one method

Phase 2 will add `grpc.call` (unary RPC invocation with JSON-shaped args + structured response). Calling requires JSON↔proto dynamic marshaling via protoreflect/dynamicpb — non-trivial but standard once we accept the dependency surface. Held back from Phase 1 so the introspection contract lands first and stabilizes.

Permissions: this toolbox declares `canonical_for: [grpcurl]`. Sandbox: deny most reads/writes, network ALLOWED to the target the agent is calling (one connection per Tool call; no persistent upstream).

Index

Constants

View Source
const DefaultDialTimeout = 10 * time.Second

DefaultDialTimeout caps any single dial+reflect call. gRPC dials otherwise wait forever for a connection. Configurable per-call via the timeout_ms argument.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*registry.Base
	// contains filtered or unexported fields
}

Server implements codefly.services.toolbox.v0.Toolbox for gRPC reflection-based introspection.

Construction is cheap; the toolbox holds no persistent connection. Each tool call dials the target, performs the reflection roundtrip, and tears the connection down. This is the safe-by- default position — connections are short-lived and there's no state for an attacker (or a buggy agent) to leak across calls.

func New

func New(version string) *Server

New returns a Server.

func (*Server) Identity

func (*Server) Tools

func (s *Server) Tools() []*registry.ToolDefinition

Tools is the source of truth — see git/server.go for convention.

Directories

Path Synopsis
cmd
grpc-toolbox command
Command grpc-toolbox is the standalone binary form of the codefly gRPC introspection toolbox.
Command grpc-toolbox is the standalone binary form of the codefly gRPC introspection toolbox.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL