Documentation
¶
Index ¶
- Constants
- func NewToolboxHandler(svc ToolboxHandler, opts ...connect.HandlerOption) (string, http.Handler)
- type ToolboxClient
- type ToolboxHandler
- type UnimplementedToolboxHandler
- func (UnimplementedToolboxHandler) CallTool(context.Context, *connect.Request[v0.CallToolRequest]) (*connect.Response[v0.CallToolResponse], error)
- func (UnimplementedToolboxHandler) DescribeTool(context.Context, *connect.Request[v0.DescribeToolRequest]) (*connect.Response[v0.DescribeToolResponse], error)
- func (UnimplementedToolboxHandler) GetPrompt(context.Context, *connect.Request[v0.GetPromptRequest]) (*connect.Response[v0.GetPromptResponse], error)
- func (UnimplementedToolboxHandler) Identity(context.Context, *connect.Request[v0.IdentityRequest]) (*connect.Response[v0.IdentityResponse], error)
- func (UnimplementedToolboxHandler) ListPrompts(context.Context, *connect.Request[v0.ListPromptsRequest]) (*connect.Response[v0.ListPromptsResponse], error)
- func (UnimplementedToolboxHandler) ListResources(context.Context, *connect.Request[v0.ListResourcesRequest]) (*connect.Response[v0.ListResourcesResponse], error)
- func (UnimplementedToolboxHandler) ListToolSummaries(context.Context, *connect.Request[v0.ListToolSummariesRequest]) (*connect.Response[v0.ListToolSummariesResponse], error)
- func (UnimplementedToolboxHandler) ListTools(context.Context, *connect.Request[v0.ListToolsRequest]) (*connect.Response[v0.ListToolsResponse], error)
- func (UnimplementedToolboxHandler) ReadResource(context.Context, *connect.Request[v0.ReadResourceRequest]) (*connect.Response[v0.ReadResourceResponse], error)
Constants ¶
const ( // ToolboxIdentityProcedure is the fully-qualified name of the Toolbox's Identity RPC. ToolboxIdentityProcedure = "/codefly.services.toolbox.v0.Toolbox/Identity" // ToolboxListToolsProcedure is the fully-qualified name of the Toolbox's ListTools RPC. ToolboxListToolsProcedure = "/codefly.services.toolbox.v0.Toolbox/ListTools" // ToolboxListToolSummariesProcedure is the fully-qualified name of the Toolbox's ListToolSummaries // RPC. ToolboxListToolSummariesProcedure = "/codefly.services.toolbox.v0.Toolbox/ListToolSummaries" // ToolboxDescribeToolProcedure is the fully-qualified name of the Toolbox's DescribeTool RPC. ToolboxDescribeToolProcedure = "/codefly.services.toolbox.v0.Toolbox/DescribeTool" // ToolboxCallToolProcedure is the fully-qualified name of the Toolbox's CallTool RPC. ToolboxCallToolProcedure = "/codefly.services.toolbox.v0.Toolbox/CallTool" // ToolboxListResourcesProcedure is the fully-qualified name of the Toolbox's ListResources RPC. ToolboxListResourcesProcedure = "/codefly.services.toolbox.v0.Toolbox/ListResources" // ToolboxReadResourceProcedure is the fully-qualified name of the Toolbox's ReadResource RPC. ToolboxReadResourceProcedure = "/codefly.services.toolbox.v0.Toolbox/ReadResource" // ToolboxListPromptsProcedure is the fully-qualified name of the Toolbox's ListPrompts RPC. ToolboxListPromptsProcedure = "/codefly.services.toolbox.v0.Toolbox/ListPrompts" // ToolboxGetPromptProcedure is the fully-qualified name of the Toolbox's GetPrompt RPC. ToolboxGetPromptProcedure = "/codefly.services.toolbox.v0.Toolbox/GetPrompt" )
These constants are the fully-qualified names of the RPCs defined in this package. They're exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
Note that these are different from the fully-qualified method names used by google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to reflection-formatted method names, remove the leading slash and convert the remaining slash to a period.
const (
// ToolboxName is the fully-qualified name of the Toolbox service.
ToolboxName = "codefly.services.toolbox.v0.Toolbox"
)
Variables ¶
This section is empty.
Functions ¶
func NewToolboxHandler ¶
func NewToolboxHandler(svc ToolboxHandler, opts ...connect.HandlerOption) (string, http.Handler)
NewToolboxHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.
By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.
Types ¶
type ToolboxClient ¶
type ToolboxClient interface {
// Identity returns the toolbox's manifest-derived metadata.
Identity(context.Context, *connect.Request[v0.IdentityRequest]) (*connect.Response[v0.IdentityResponse], error)
// ListTools returns every tool this toolbox exposes WITH FULL
// SPECS (schemas, descriptions). Heavy. Kept for transitional
// consumers and for MCP transcoding; new code should prefer the
// two-phase pair below — ListToolSummaries (catalog) +
// DescribeTool (per-tool spec on demand) — which keeps the LLM's
// routing context small while making per-call descriptions richer.
//
// Deprecated: do not use.
ListTools(context.Context, *connect.Request[v0.ListToolsRequest]) (*connect.Response[v0.ListToolsResponse], error)
// ListToolSummaries returns lightweight catalog entries — enough
// for the LLM to pick a tool, but no schemas or examples. The
// load-bearing routing surface: with N toolboxes and M tools each,
// every LLM turn pays only the catalog cost (~50 bytes/tool); the
// heavy spec is fetched per-tool via DescribeTool right before
// invoking it, then drops out of context.
//
// Optional tags_filter pre-selects (e.g. ["read-only"]) so the
// LLM doesn't even see destructive tools when the goal is read.
ListToolSummaries(context.Context, *connect.Request[v0.ListToolSummariesRequest]) (*connect.Response[v0.ListToolSummariesResponse], error)
// DescribeTool returns the full spec for ONE tool — input/output
// schemas, multi-paragraph description, examples, error modes.
// Called on-demand: the LLM picks a tool from the summary catalog,
// the host fetches DescribeTool for that one, injects it into the
// next prompt only, then drops it.
DescribeTool(context.Context, *connect.Request[v0.DescribeToolRequest]) (*connect.Response[v0.DescribeToolResponse], error)
// CallTool invokes a tool by name with structured arguments.
// The result carries either a Content payload, an error, or both
// (e.g. partial success + warnings).
CallTool(context.Context, *connect.Request[v0.CallToolRequest]) (*connect.Response[v0.CallToolResponse], error)
// ListResources returns every addressable resource the toolbox
// exposes for read-only context.
ListResources(context.Context, *connect.Request[v0.ListResourcesRequest]) (*connect.Response[v0.ListResourcesResponse], error)
// ReadResource fetches a resource's content by URI.
ReadResource(context.Context, *connect.Request[v0.ReadResourceRequest]) (*connect.Response[v0.ReadResourceResponse], error)
// ListPrompts returns every parametric prompt template the toolbox
// exposes.
ListPrompts(context.Context, *connect.Request[v0.ListPromptsRequest]) (*connect.Response[v0.ListPromptsResponse], error)
// GetPrompt renders a prompt with the supplied arguments.
GetPrompt(context.Context, *connect.Request[v0.GetPromptRequest]) (*connect.Response[v0.GetPromptResponse], error)
}
ToolboxClient is a client for the codefly.services.toolbox.v0.Toolbox service.
func NewToolboxClient ¶
func NewToolboxClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ToolboxClient
NewToolboxClient constructs a client for the codefly.services.toolbox.v0.Toolbox service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.
The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).
type ToolboxHandler ¶
type ToolboxHandler interface {
// Identity returns the toolbox's manifest-derived metadata.
Identity(context.Context, *connect.Request[v0.IdentityRequest]) (*connect.Response[v0.IdentityResponse], error)
// ListTools returns every tool this toolbox exposes WITH FULL
// SPECS (schemas, descriptions). Heavy. Kept for transitional
// consumers and for MCP transcoding; new code should prefer the
// two-phase pair below — ListToolSummaries (catalog) +
// DescribeTool (per-tool spec on demand) — which keeps the LLM's
// routing context small while making per-call descriptions richer.
//
// Deprecated: do not use.
ListTools(context.Context, *connect.Request[v0.ListToolsRequest]) (*connect.Response[v0.ListToolsResponse], error)
// ListToolSummaries returns lightweight catalog entries — enough
// for the LLM to pick a tool, but no schemas or examples. The
// load-bearing routing surface: with N toolboxes and M tools each,
// every LLM turn pays only the catalog cost (~50 bytes/tool); the
// heavy spec is fetched per-tool via DescribeTool right before
// invoking it, then drops out of context.
//
// Optional tags_filter pre-selects (e.g. ["read-only"]) so the
// LLM doesn't even see destructive tools when the goal is read.
ListToolSummaries(context.Context, *connect.Request[v0.ListToolSummariesRequest]) (*connect.Response[v0.ListToolSummariesResponse], error)
// DescribeTool returns the full spec for ONE tool — input/output
// schemas, multi-paragraph description, examples, error modes.
// Called on-demand: the LLM picks a tool from the summary catalog,
// the host fetches DescribeTool for that one, injects it into the
// next prompt only, then drops it.
DescribeTool(context.Context, *connect.Request[v0.DescribeToolRequest]) (*connect.Response[v0.DescribeToolResponse], error)
// CallTool invokes a tool by name with structured arguments.
// The result carries either a Content payload, an error, or both
// (e.g. partial success + warnings).
CallTool(context.Context, *connect.Request[v0.CallToolRequest]) (*connect.Response[v0.CallToolResponse], error)
// ListResources returns every addressable resource the toolbox
// exposes for read-only context.
ListResources(context.Context, *connect.Request[v0.ListResourcesRequest]) (*connect.Response[v0.ListResourcesResponse], error)
// ReadResource fetches a resource's content by URI.
ReadResource(context.Context, *connect.Request[v0.ReadResourceRequest]) (*connect.Response[v0.ReadResourceResponse], error)
// ListPrompts returns every parametric prompt template the toolbox
// exposes.
ListPrompts(context.Context, *connect.Request[v0.ListPromptsRequest]) (*connect.Response[v0.ListPromptsResponse], error)
// GetPrompt renders a prompt with the supplied arguments.
GetPrompt(context.Context, *connect.Request[v0.GetPromptRequest]) (*connect.Response[v0.GetPromptResponse], error)
}
ToolboxHandler is an implementation of the codefly.services.toolbox.v0.Toolbox service.
type UnimplementedToolboxHandler ¶
type UnimplementedToolboxHandler struct{}
UnimplementedToolboxHandler returns CodeUnimplemented from all methods.
func (UnimplementedToolboxHandler) CallTool ¶
func (UnimplementedToolboxHandler) CallTool(context.Context, *connect.Request[v0.CallToolRequest]) (*connect.Response[v0.CallToolResponse], error)
func (UnimplementedToolboxHandler) DescribeTool ¶
func (UnimplementedToolboxHandler) DescribeTool(context.Context, *connect.Request[v0.DescribeToolRequest]) (*connect.Response[v0.DescribeToolResponse], error)
func (UnimplementedToolboxHandler) GetPrompt ¶
func (UnimplementedToolboxHandler) GetPrompt(context.Context, *connect.Request[v0.GetPromptRequest]) (*connect.Response[v0.GetPromptResponse], error)
func (UnimplementedToolboxHandler) Identity ¶
func (UnimplementedToolboxHandler) Identity(context.Context, *connect.Request[v0.IdentityRequest]) (*connect.Response[v0.IdentityResponse], error)
func (UnimplementedToolboxHandler) ListPrompts ¶
func (UnimplementedToolboxHandler) ListPrompts(context.Context, *connect.Request[v0.ListPromptsRequest]) (*connect.Response[v0.ListPromptsResponse], error)
func (UnimplementedToolboxHandler) ListResources ¶
func (UnimplementedToolboxHandler) ListResources(context.Context, *connect.Request[v0.ListResourcesRequest]) (*connect.Response[v0.ListResourcesResponse], error)
func (UnimplementedToolboxHandler) ListToolSummaries ¶
func (UnimplementedToolboxHandler) ListToolSummaries(context.Context, *connect.Request[v0.ListToolSummariesRequest]) (*connect.Response[v0.ListToolSummariesResponse], error)
func (UnimplementedToolboxHandler) ListTools ¶
func (UnimplementedToolboxHandler) ListTools(context.Context, *connect.Request[v0.ListToolsRequest]) (*connect.Response[v0.ListToolsResponse], error)
func (UnimplementedToolboxHandler) ReadResource ¶
func (UnimplementedToolboxHandler) ReadResource(context.Context, *connect.Request[v0.ReadResourceRequest]) (*connect.Response[v0.ReadResourceResponse], error)