Documentation
¶
Index ¶
- Constants
- func CanonicalFromModelToolName(name string) string
- func CanonicalToolName(namespace, name string) string
- func IsModelToolPart(name string) bool
- func ModelToolName(namespace, name string) string
- type CallToolRequest
- type ErrorEvent
- type LogEvent
- type Namespace
- type NamespaceList
- type ProgressEvent
- type ResourceLink
- type ResourcesResult
- type ResultEvent
- type Tool
- type ToolList
- type ToolListRequest
Constants ¶
const ( NamespaceBuiltin = "builtin" NamespaceMCP = "mcp" NamespaceAgent = "agent" )
The types of namespaces: those which are built in, those of MCP servers, and the agents'
const ( // ToolSeparator separates the namespace and name in a tool's canonical // name ToolSeparator = ":" // The events of a stream of a tool which is called: a log event for // each line it logs, a progress event for how it's getting on, and then // a result event, with its result, or an error event EventLog = "log" EventProgress = "progress" EventResult = "result" EventError = "error" // ModelToolSeparator separates the namespace and name in the name a // model calls a tool by, which a namespace, or a tool's name, can't // have, so it's separated where it is ModelToolSeparator = "__" )
Variables ¶
This section is empty.
Functions ¶
func CanonicalFromModelToolName ¶ added in v0.6.0
CanonicalFromModelToolName returns the canonical name of the tool which a model calls by the name, such as homeassistant:call_service for homeassistant__call_service, or the name, when it isn't a tool in a namespace, such as respond
func CanonicalToolName ¶
CanonicalToolName returns the canonical name of a tool in a namespace, which is the namespace and tool name separated by a colon
func IsModelToolPart ¶ added in v0.6.0
IsModelToolPart returns true when the name, of a namespace, or of a tool in one, can be part of the name a model calls a tool by, so it's separated where it is: it doesn't have two underscores, and doesn't start, or end, with one, which would be next to the separator
func ModelToolName ¶ added in v0.6.0
ModelToolName returns the name a model calls a tool in a namespace by, which is the namespace and tool name separated by two underscores, as a model's tool names can't have a colon, such as homeassistant__call_service
Types ¶
type CallToolRequest ¶
type CallToolRequest struct {
Input json.RawMessage `` /* 127-byte string literal not displayed */
}
CallToolRequest is a request to run a tool with its input
func (CallToolRequest) String ¶
func (t CallToolRequest) String() string
type ErrorEvent ¶ added in v0.6.0
type ErrorEvent struct {
Error string `json:"error" help:"Error of the tool, as it would be without a stream"`
}
ErrorEvent is the data of an error event, which ends a stream when the tool fails
type LogEvent ¶ added in v0.6.0
type LogEvent struct {
Text string `json:"text" help:"Line which the tool logged"`
}
LogEvent is the data of a log event, of a line which a tool logs, as it runs, when it's called with a stream
type Namespace ¶ added in v1.0.0
type Namespace struct {
Name string `json:"name" readonly:"" help:"Name of the namespace" example:"weatherapi"`
Type string `` /* 150-byte string literal not displayed */
Description string `` /* 147-byte string literal not displayed */
Tools uint64 `json:"tools" readonly:"" help:"How many tools the namespace has" example:"3"`
}
Namespace is a namespace of tools: its name, a line which describes it, which can be empty, and how many tools it has
type NamespaceList ¶ added in v1.0.0
NamespaceList is the namespaces, with their number
func (NamespaceList) String ¶ added in v1.0.0
func (n NamespaceList) String() string
type ProgressEvent ¶ added in v0.6.0
type ProgressEvent struct {
Status string `json:"status" help:"What the tool is doing, which is its message"`
Percent float64 `json:"percent" help:"Percentage which is complete, from 0 to 100, or zero when it isn't known"`
Progress float64 `json:"progress,omitempty" help:"How far the tool has got, which increases each time"`
Total float64 `json:"total,omitempty" help:"How far the tool has to go, when it's known"`
Message string `json:"message,omitempty" help:"What the tool is doing"`
}
ProgressEvent is the data of a progress event, of how a tool is getting on, as it runs, when it's called with a stream, as MCP's progress notification is, with its status and percent, as a model's download is
type ResourceLink ¶ added in v1.3.0
type ResourceLink struct {
URI string `` /* 170-byte string literal not displayed */
Name string `json:"name,omitempty" help:"Name of the resource, such as its file's name" example:"speech.wav"`
Title string `json:"title,omitempty" help:"Title of the resource, for people, which is its description" example:"Ode to David"`
Type string `json:"type,omitempty" help:"MIME type of the resource" example:"audio/wav"`
Size int64 `json:"size,omitempty" help:"Size of the resource's content, in bytes" example:"103724"`
}
ResourceLink is a resource which a tool returned, as its result has it, which is kept, and referred to by its URI, such as resource:///<hash>, rather than its content, as MCP's resource links are
type ResourcesResult ¶ added in v1.3.0
type ResourcesResult struct {
Result any `json:"result,omitempty" help:"What the tool returned with the resources, when it did"`
Resources []ResourceLink `json:"resources" help:"The resources the tool returned, as links to them"`
}
ResourcesResult is the result of a tool which returned resources: the value it returned with them, when it did, and the links to them
type ResultEvent ¶ added in v0.6.0
type ResultEvent struct {
Result json.RawMessage `json:"result,omitempty" help:"Result of the tool, as JSON, which is left out when it has none"`
}
ResultEvent is the data of a result event, which ends a stream when the tool returns: its result, which is left out when it has none, so a result which is JSON null is told apart from none
type Tool ¶
type Tool struct {
Name string `json:"name" readonly:"" help:"Tool name" example:"current"`
Canonical string `` /* 150-byte string literal not displayed */
Type string `` /* 157-byte string literal not displayed */
Title string `` /* 163-byte string literal not displayed */
Description string `` /* 127-byte string literal not displayed */
Input json.RawMessage `json:"input,omitempty" readonly:"" help:"JSON schema of the tool's input"`
Output json.RawMessage `json:"output,omitempty" readonly:"" help:"JSON schema of the tool's output, if it has one"`
}
Tool is a tool which models can call
type ToolList ¶
type ToolList struct {
ToolListRequest
Count uint64 `json:"count"`
Body []*Tool `json:"body,omitempty"`
}
ToolList is the tools, with their number
type ToolListRequest ¶
type ToolListRequest struct {
Namespace string `json:"namespace,omitempty" help:"Returns only the tools in this namespace" example:"weatherapi" optional:""`
Type string `` /* 136-byte string literal not displayed */
}
ToolListRequest filters a list of tools
func (ToolListRequest) Query ¶
func (t ToolListRequest) Query() url.Values
Query returns the request as URL query parameters
func (ToolListRequest) String ¶
func (t ToolListRequest) String() string