Documentation
¶
Overview ¶
Package toolruntime exposes an immutable provider-neutral Tool catalog over a process-wide, authenticated loopback gateway. MCP is deliberately confined to this internal package.
Index ¶
- Constants
- Variables
- type Endpoint
- type Runtime
- func (r *Runtime) BearerToken() (string, bool)
- func (r *Runtime) BearerTokenEnvVar() string
- func (r *Runtime) Close(ctx context.Context) error
- func (r *Runtime) Endpoint() (Endpoint, bool)
- func (r *Runtime) Fingerprint() string
- func (r *Runtime) GoString() string
- func (r *Runtime) Start(ctx context.Context) (Endpoint, error)
- func (r *Runtime) String() string
Constants ¶
const ( // ServerKey is the reserved MCP server key used by every in-process tool // catalog. A process-wide gateway lets concurrent Agents safely materialize // the same URL into a shared provider profile. ServerKey = toolidentity.ServerKey )
Variables ¶
var ( // ErrClosed means a registration can no longer be started or used. ErrClosed = errors.New("tool runtime is closed") // ErrInvalidCatalog means a Catalog cannot be represented by the internal // MCP server. The original SDK panic is deliberately not exposed because it // may contain descriptor or schema contents. ErrInvalidCatalog = errors.New("invalid tool catalog") )
Functions ¶
This section is empty.
Types ¶
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime is one Agent's immutable catalog registration in the process-wide gateway. Start is lazy so listener failures remain pre-launch run errors.
func New ¶
func New(definitions []tool.Definition) (*Runtime, error)
New validates and freezes the definitions' MCP projection without opening a socket. The tool package owns typed decoding, JSON Schema validation, and handler immutability; this package adds the sorted catalog fingerprint.
func (*Runtime) BearerToken ¶
BearerToken returns this registration's secret. It is intended only for subprocess SecretEnv injection and is excluded from Endpoint, errors, logs, results, and fingerprints.
func (*Runtime) BearerTokenEnvVar ¶
BearerTokenEnvVar returns this Agent registration's unpredictable, non-secret credential carrier name. It is available before Start so MCP declarations can be checked for aliasing before the listener is opened.
func (*Runtime) Close ¶
Close unregisters this Agent's token, drains its active calls, and shuts down the process-wide listener only when it was the final registration. It is idempotent and safe for concurrent callers.
func (*Runtime) Fingerprint ¶
Fingerprint returns the provider-neutral catalog compatibility identity. It never contains the bearer token or handler/closure addresses.