Documentation
¶
Index ¶
- Constants
- Variables
- type AllBundles
- type BundlePageToken
- type DeleteToolBundleRequest
- type DeleteToolBundleResponse
- type DeleteToolRequest
- type DeleteToolResponse
- type GetToolRequest
- type GetToolResponse
- type GoToolImpl
- type HTTPAuth
- type HTTPBodyOutputMode
- type HTTPRequest
- type HTTPResponse
- type HTTPToolImpl
- type JSONRawString
- type JSONSchema
- type ListToolBundlesRequest
- type ListToolBundlesResponse
- type ListToolBundlesResponseBody
- type ListToolsRequest
- type ListToolsResponse
- type ListToolsResponseBody
- type PatchToolBundleRequest
- type PatchToolBundleRequestBody
- type PatchToolBundleResponse
- type PatchToolRequest
- type PatchToolRequestBody
- type PatchToolResponse
- type PutToolBundleRequest
- type PutToolBundleRequestBody
- type PutToolBundleResponse
- type PutToolRequest
- type PutToolRequestBody
- type PutToolResponse
- type SDKToolImpl
- type Tool
- type ToolBundle
- type ToolChoicePatch
- type ToolImplType
- type ToolListItem
- type ToolPageToken
- type ToolRef
- type ToolSelection
- type ToolStoreChoice
- type ToolStoreChoiceType
Constants ¶
const ( ToolBundlesMetaFileName = "tools.bundles.json" ToolDBFileName = "tools.fts.sqlite" ToolBuiltInOverlayDBFileName = "toolsbuiltin.overlay.sqlite" DefaultHTTPTimeoutMS = 10_000 JSONEncoding = "json" TextEncoding = "text" DefaultHTTPEncoding = JSONEncoding DefaultHTTPErrorMode = "fail" // SchemaVersion - Current on-disk schema version. SchemaVersion = "2025-07-01" )
Variables ¶
var ( ErrInvalidRequest = errors.New("invalid request") ErrInvalidDir = errors.New("invalid directory") ErrConflict = errors.New("resource already exists") ErrBuiltInBundleNotFound = errors.New("bundle not found in built-in data") ErrBundleNotFound = errors.New("bundle not found") ErrBundleDisabled = errors.New("bundle is disabled") ErrBundleDeleting = errors.New("bundle is being deleted") ErrBundleNotEmpty = errors.New("bundle still contains tools") ErrToolNotFound = errors.New("tool not found") ErrBuiltInReadOnly = errors.New("built-in resource is read-only") ErrFTSDisabled = errors.New("FTS is disabled") ErrToolDisabled = errors.New("tool is disabled") )
Functions ¶
This section is empty.
Types ¶
type AllBundles ¶
type AllBundles struct {
Bundles map[bundleitemutils.BundleID]ToolBundle `json:"bundles"`
}
type BundlePageToken ¶
type BundlePageToken struct {
BundleIDs []bundleitemutils.BundleID `json:"ids,omitempty"` //nolint:tagliatelle // Pagttoken Specific. // Optional bundle-ID filter.
IncludeDisabled bool `json:"d,omitempty"` //nolint:tagliatelle // Pagttoken Specific. // Include disabled bundles?
PageSize int `json:"s"` //nolint:tagliatelle // Pagttoken Specific. // Requested page-size.
CursorMod string `json:"t,omitempty"` //nolint:tagliatelle // Pagttoken Specific. // RFC-3339-nano modification timestamp.
CursorID bundleitemutils.BundleID `json:"id,omitempty"` //nolint:tagliatelle // Pagttoken Specific. // Tie-breaker for equal timestamps.
}
BundlePageToken is the opaque cursor used when paging over tool-bundles.
type DeleteToolBundleRequest ¶
type DeleteToolBundleRequest struct {
BundleID bundleitemutils.BundleID `path:"bundleID" required:"true"`
}
type DeleteToolBundleResponse ¶
type DeleteToolBundleResponse struct{}
type DeleteToolRequest ¶
type DeleteToolRequest struct {
BundleID bundleitemutils.BundleID `path:"bundleID" required:"true"`
ToolSlug bundleitemutils.ItemSlug `path:"toolSlug" required:"true"`
Version bundleitemutils.ItemVersion `path:"version" required:"true"`
}
type DeleteToolResponse ¶
type DeleteToolResponse struct{}
type GetToolRequest ¶
type GetToolRequest struct {
BundleID bundleitemutils.BundleID `path:"bundleID" required:"true"`
ToolSlug bundleitemutils.ItemSlug `path:"toolSlug" required:"true"`
Version bundleitemutils.ItemVersion `path:"version" required:"true"`
}
type GetToolResponse ¶
type GetToolResponse struct{ Body *Tool }
type GoToolImpl ¶
type GoToolImpl struct {
// Fully-qualified registration key, e.g.
// "github.com/acme/flexigpt/tools.Weather"
Func string `json:"func" validate:"required"`
}
GoToolImpl - Register-by-name pattern for Go tools.
type HTTPAuth ¶
type HTTPAuth struct {
Type string `json:"type"`
In string `json:"in,omitempty"` // "header" | "query" (apiKey only)
Name string `json:"name,omitempty"` // header/query key
ValueTemplate string `json:"valueTemplate"` // may contain ${SECRET}
}
HTTPAuth - Simple auth descriptor (can be extended later).
type HTTPBodyOutputMode ¶
type HTTPBodyOutputMode string
HTTPBodyOutputMode - how to map HTTP response body into tool outputs. "" / "auto" (default): infer from Content-Type. "text": always a single text block. "file": always a single file block. "image": always a single image block.
const ( HTTPBodyOutputModeAuto HTTPBodyOutputMode = "auto" HTTPBodyOutputModeText HTTPBodyOutputMode = "text" HTTPBodyOutputModeFile HTTPBodyOutputMode = "file" HTTPBodyOutputModeImage HTTPBodyOutputMode = "image" )
type HTTPRequest ¶
type HTTPRequest struct {
Method string `json:"method,omitempty"` // default "GET"
URLTemplate string `json:"urlTemplate"` // http(s)://… may contain ${var}
Query map[string]string `json:"query,omitempty"` // k:${var}
Headers map[string]string `json:"headers,omitempty"` // k:${var}
Body string `json:"body,omitempty"` // raw or template
Auth *HTTPAuth `json:"auth,omitempty"` // see below
TimeoutMS int `json:"timeoutMS,omitempty"` // default 10 000
}
type HTTPResponse ¶
type HTTPResponse struct {
SuccessCodes []int `json:"successCodes,omitempty"` // default: any 2xx
ErrorMode string `json:"errorMode,omitempty"` // "fail"(dflt) | "empty"
BodyOutputMode HTTPBodyOutputMode `json:"bodyOutputMode,omitempty"`
}
type HTTPToolImpl ¶
type HTTPToolImpl struct {
Request HTTPRequest `json:"request"`
Response HTTPResponse `json:"response"`
}
type JSONRawString ¶
type JSONRawString = string
type JSONSchema ¶
type JSONSchema = json.RawMessage
type ListToolBundlesRequest ¶
type ListToolBundlesRequest struct {
BundleIDs []bundleitemutils.BundleID `query:"bundleIDs"`
IncludeDisabled bool `query:"includeDisabled"`
PageSize int `query:"pageSize"`
PageToken string `query:"pageToken"`
}
type ListToolBundlesResponse ¶
type ListToolBundlesResponse struct {
Body *ListToolBundlesResponseBody
}
type ListToolBundlesResponseBody ¶
type ListToolBundlesResponseBody struct {
ToolBundles []ToolBundle `json:"toolBundles"`
NextPageToken *string `json:"nextPageToken,omitempty"`
}
type ListToolsRequest ¶
type ListToolsResponse ¶
type ListToolsResponse struct {
Body *ListToolsResponseBody
}
type ListToolsResponseBody ¶
type ListToolsResponseBody struct {
ToolListItems []ToolListItem `json:"toolListItems"`
NextPageToken *string `json:"nextPageToken,omitempty"`
}
type PatchToolBundleRequest ¶
type PatchToolBundleRequest struct {
BundleID bundleitemutils.BundleID `path:"bundleID" required:"true"`
Body *PatchToolBundleRequestBody
}
type PatchToolBundleRequestBody ¶
type PatchToolBundleRequestBody struct {
IsEnabled bool `json:"isEnabled" required:"true"`
}
type PatchToolBundleResponse ¶
type PatchToolBundleResponse struct{}
type PatchToolRequest ¶
type PatchToolRequest struct {
BundleID bundleitemutils.BundleID `path:"bundleID" required:"true"`
ToolSlug bundleitemutils.ItemSlug `path:"toolSlug" required:"true"`
Version bundleitemutils.ItemVersion `path:"version" required:"true"`
Body *PatchToolRequestBody
}
type PatchToolRequestBody ¶
type PatchToolRequestBody struct {
IsEnabled bool `json:"isEnabled" required:"true"`
}
type PatchToolResponse ¶
type PatchToolResponse struct{}
type PutToolBundleRequest ¶
type PutToolBundleRequest struct {
BundleID bundleitemutils.BundleID `path:"bundleID" required:"true"`
Body *PutToolBundleRequestBody
}
type PutToolBundleRequestBody ¶
type PutToolBundleRequestBody struct {
Slug bundleitemutils.BundleSlug `json:"slug" required:"true"`
DisplayName string `json:"displayName" required:"true"`
IsEnabled bool `json:"isEnabled" required:"true"`
Description string `json:"description,omitempty"`
}
type PutToolBundleResponse ¶
type PutToolBundleResponse struct{}
type PutToolRequest ¶
type PutToolRequest struct {
BundleID bundleitemutils.BundleID `path:"bundleID" required:"true"`
ToolSlug bundleitemutils.ItemSlug `path:"toolSlug" required:"true"`
Version bundleitemutils.ItemVersion `path:"version" required:"true"`
Body *PutToolRequestBody
}
type PutToolRequestBody ¶
type PutToolRequestBody struct {
DisplayName string `json:"displayName" required:"true"`
Description string `json:"description,omitempty"`
Tags []string `json:"tags,omitempty"`
IsEnabled bool `json:"isEnabled" required:"true"`
UserCallable bool `json:"userCallable" required:"true"`
LLMCallable bool `json:"llmCallable" required:"true"`
AutoExecReco bool `json:"autoExecReco" required:"true"`
// Take inputs as strings that we can then validate as a json object and put a tool.
ArgSchema JSONRawString `json:"argSchema" required:"true"`
Type ToolImplType `json:"type" required:"true"`
HTTPImpl *HTTPToolImpl `json:"httpImpl,omitempty" required:"true"`
}
type PutToolResponse ¶
type PutToolResponse struct{}
type SDKToolImpl ¶
type SDKToolImpl struct {
// SDKType can be ProviderSDKType.
SDKType string `json:"sdkType"`
}
SDKToolImpl describes how this tool is implemented using a provider SDK (e.g., OpenAI Responses, Anthropic Messages). It does not encode semantic kind (function/webSearch/etc.); that lives in Tool.LLMToolType.
type Tool ¶
type Tool struct {
SchemaVersion string `json:"schemaVersion"`
ID bundleitemutils.ItemID `json:"id"` // UUID-v7
Slug bundleitemutils.ItemSlug `json:"slug"`
Version bundleitemutils.ItemVersion `json:"version"` // opaque
DisplayName string `json:"displayName"`
Description string `json:"description,omitempty"`
Tags []string `json:"tags,omitempty"`
// UserCallable indicates whether the tool can be invoked directly by the user
// (e.g. from the composer UI before sending a message).
UserCallable bool `json:"userCallable"`
// LLMCallable indicates whether the model may call this tool as a function.
LLMCallable bool `json:"llmCallable"`
// AutoExecReco indicates whether the host/UI should consider it safe enough
// to auto-execute this tool without additional confirmation. Default: false.
AutoExecReco bool `json:"autoExecReco"`
// ArgSchema describes the JSON arguments that are passed when the tool is invoked (by the LLM or via InvokeTool).
// This is primarily used for Go/HTTP tools.
ArgSchema JSONSchema `json:"argSchema"`
// UserArgSchema, if present, describes an additional per-choice configuration object that the UI may collect when
// enabling the tool for a model.
// For SDK-backed server tools this typically encodes provider-specific options (e.g., web-search settings).
UserArgSchema JSONSchema `json:"userArgSchema,omitempty"`
// LLMToolType captures the semantic kind of this tool from the model's point of view, e.g. "function", "custom",
// "webSearch".
// This value should always be one of ToolStoreChoiceType values.
LLMToolType ToolStoreChoiceType `json:"llmToolType"`
Type ToolImplType `json:"type"`
GoImpl *GoToolImpl `json:"goImpl,omitempty"`
HTTPImpl *HTTPToolImpl `json:"httpImpl,omitempty"`
SDKImpl *SDKToolImpl `json:"sdkImpl,omitempty"`
IsEnabled bool `json:"isEnabled"`
IsBuiltIn bool `json:"isBuiltIn"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
}
type ToolBundle ¶
type ToolBundle struct {
SchemaVersion string `json:"schemaVersion"`
ID bundleitemutils.BundleID `json:"id"` // UUID-v7
Slug bundleitemutils.BundleSlug `json:"slug"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"`
IsEnabled bool `json:"isEnabled"`
IsBuiltIn bool `json:"isBuiltIn"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
SoftDeletedAt *time.Time `json:"softDeletedAt,omitempty"`
}
type ToolChoicePatch ¶ added in v0.0.85
type ToolChoicePatch struct {
AutoExecute *bool `json:"autoExecute,omitempty"`
UserArgSchemaInstance JSONRawString `json:"userArgSchemaInstance,omitempty"`
}
type ToolImplType ¶
type ToolImplType string
const ( ToolTypeGo ToolImplType = "go" ToolTypeHTTP ToolImplType = "http" ToolTypeSDK ToolImplType = "sdk" )
type ToolListItem ¶
type ToolListItem struct {
BundleID bundleitemutils.BundleID `json:"bundleID"`
BundleSlug bundleitemutils.BundleSlug `json:"bundleSlug"`
ToolSlug bundleitemutils.ItemSlug `json:"toolSlug"`
ToolVersion bundleitemutils.ItemVersion `json:"toolVersion"`
IsBuiltIn bool `json:"isBuiltIn"`
ToolDefinition Tool `json:"toolDefinition"`
}
type ToolPageToken ¶
type ToolPageToken struct {
RecommendedPageSize int `json:"ps,omitempty"` //nolint:tagliatelle // PageToken specific.
IncludeDisabled bool `json:"d,omitempty"` //nolint:tagliatelle // PageToken specific.
BundleIDs []bundleitemutils.BundleID `json:"ids,omitempty"` //nolint:tagliatelle // PageToken specific.
Tags []string `json:"tags,omitempty"` //nolint:tagliatelle // PageToken specific.
BuiltInDone bool `json:"bd,omitempty"` //nolint:tagliatelle // PageToken specific. // Built-ins already emitted?
DirTok string `json:"dt,omitempty"` //nolint:tagliatelle // PageToken specific. // Directory-store cursor.
}
ToolPageToken is the opaque cursor used when paging over individual tool versions (ListTools API).
type ToolRef ¶ added in v0.0.85
type ToolRef struct {
BundleID bundleitemutils.BundleID `json:"bundleID"`
ToolSlug bundleitemutils.ItemSlug `json:"toolSlug"`
ToolVersion bundleitemutils.ItemVersion `json:"toolVersion"`
}
type ToolSelection ¶ added in v0.0.86
type ToolSelection struct {
ToolRef ToolRef `json:"toolRef"`
ToolChoicePatch *ToolChoicePatch `json:"toolChoicePatch,omitempty"`
}
type ToolStoreChoice ¶
type ToolStoreChoice struct {
ChoiceID string `json:"choiceID"`
// BundleID, BundleSlug, ItemID, ItemSlug are string aliases.
BundleID bundleitemutils.BundleID `json:"bundleID"`
BundleSlug bundleitemutils.BundleSlug `json:"bundleSlug,omitempty"`
ToolID bundleitemutils.ItemID `json:"toolID,omitempty"`
ToolSlug bundleitemutils.ItemSlug `json:"toolSlug"`
ToolVersion string `json:"toolVersion"`
ToolType ToolStoreChoiceType `json:"toolType"`
Description string `json:"description,omitempty"`
DisplayName string `json:"displayName,omitempty"`
// AutoExecute flag tells whether the tool should be automatically invoked once a llm calls this.
AutoExecute bool `json:"autoExecute"`
// UserArgSchemaInstance is an optional per-choice configuration object.
//
// For SDK-backed tools (Tool.Type == "sdk"), this typically contains provider-specific options validated against
// Tool.UserArgSchema. The inferencewrapper interprets this JSON and maps it into the appropriate inference-go
// ToolChoice fields (e.g. WebSearchToolChoiceItem).
UserArgSchemaInstance JSONRawString `json:"userArgSchemaInstance,omitempty"`
}
type ToolStoreChoiceType ¶
type ToolStoreChoiceType string
const ( ToolStoreChoiceTypeFunction ToolStoreChoiceType = "function" ToolStoreChoiceTypeCustom ToolStoreChoiceType = "custom" ToolStoreChoiceTypeWebSearch ToolStoreChoiceType = "webSearch" )