Documentation
¶
Overview ¶
Package namespace is the namespace of a connector's tools, in a toolkit: the tools of its MCP server, which are called with its client
Index ¶
- type Namespace
- func (ns *Namespace) Connect(ctx context.Context, c *client.Client, description string, ...) error
- func (ns *Namespace) ConnectedTo(c *client.Client) bool
- func (ns *Namespace) Description() string
- func (ns *Namespace) Disconnect(c *client.Client)
- func (ns *Namespace) Name() string
- func (ns *Namespace) Notify(fn func(eventschema.EventAction, string))
- func (ns *Namespace) Refresh(ctx context.Context) error
- func (ns *Namespace) SystemPrompt() string
- func (ns *Namespace) Tools() []llm.Tool
- func (ns *Namespace) Type() string
- type Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace is the namespace of a connector's tools, in a toolkit, which it has for as long as the connector exists: its MCP server's tools, as they were last listed, once it's connected, and none, while it isn't, which are listed again with Refresh, such as when the server says they changed
func New ¶
New returns the namespace, with the name, such as one schema.Namespace returns, and the description, such as the connector's URL, until its server says its title, which has no tools, until it's connected, with the options, such as how long its tools have, with WithTimeout. Returns ErrBadParameter when the name is empty.
func (*Namespace) Connect ¶
func (ns *Namespace) Connect(ctx context.Context, c *client.Client, description string, match func(string) bool, serial uint64) error
Connect lists the tools of the server the client is connected to, which are included, by the match, which includes every one when it's nil, and says each which was created, updated, or deleted, since they were last listed, with the description, such as the server's title, when it isn't empty, for the connector with the serial, unless it's been connected for a later one, such as once its patterns changed, when it does nothing. When they can't be listed, it has none, and that's the error.
func (*Namespace) ConnectedTo ¶
ConnectedTo returns true when the namespace has the tools of the server the client is connected to
func (*Namespace) Description ¶
Description returns what the namespace is, such as its server's title
func (*Namespace) Disconnect ¶
Disconnect clears the tools, as the client is disconnected from its server, and says each was deleted, so the namespace has none, until it's connected again, unless it's connected with another client, such as one which replaced it, when it does nothing
func (*Namespace) Notify ¶
func (ns *Namespace) Notify(fn func(eventschema.EventAction, string))
Notify sets the function which is called, once the namespace is added to a toolkit, when one of its tools is created, updated, or deleted, as they're listed again, or cleared
func (*Namespace) Refresh ¶
Refresh lists the tools again, of the server it's connected to, such as when it says they changed, or does nothing, while it isn't connected. When they can't be listed, they're as they were, and that's the error.
func (*Namespace) SystemPrompt ¶
SystemPrompt returns how to use the server, and its tools, as it said, when it was connected, or nothing, while it isn't