namespace

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func New(name, description string, opts ...Opt) (*Namespace, error)

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

func (ns *Namespace) ConnectedTo(c *client.Client) bool

ConnectedTo returns true when the namespace has the tools of the server the client is connected to

func (*Namespace) Description

func (ns *Namespace) Description() string

Description returns what the namespace is, such as its server's title

func (*Namespace) Disconnect

func (ns *Namespace) Disconnect(c *client.Client)

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) Name

func (ns *Namespace) Name() string

Name returns the namespace's name

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

func (ns *Namespace) Refresh(ctx context.Context) error

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

func (ns *Namespace) SystemPrompt() string

SystemPrompt returns how to use the server, and its tools, as it said, when it was connected, or nothing, while it isn't

func (*Namespace) Tools

func (ns *Namespace) Tools() []llm.Tool

Tools returns the server's tools, as they were last listed, in order of their names, or none, while it isn't connected

func (*Namespace) Type

func (ns *Namespace) Type() string

Type returns that the namespace's tools are an MCP server's

type Opt

type Opt func(*opt) error

Opt is an option of a namespace

func WithTimeout

func WithTimeout(timeout time.Duration) Opt

WithTimeout is how long one of the server's tools has, as it's called, rather than the toolkit's default, which it has when it's zero

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL