namespaces

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 10 Imported by: ? modules, 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.

README

Namespace catalog extension

These are optional ordinary MCP tools for namespace-focused discovery. The required interoperable resource path is standard MCP resources/list and resources/read with params.uri; neither resource/get nor resources/get is a standard MCP method.

Tool Request Response
namespaces/list cursor? namespaces: [{uri,name,description?}], nextCursor?
namespaces/get uri: ns://<id>, kind?, cursor? resources: [{uri,kind,name,description?,mimeType?}], nextCursor?, namespace?

Resource contents, including navigation://, window://, and mcp:// definitions, are published through resources/read. A namespace index may accelerate discovery, but clients must be able to read a listed resource with the standard method without calling these optional tools.

Omitting kind lists all accessible resource kinds in the namespace. The owning MCP applies authorization and kind filtering before pagination. It sorts summaries consistently (normally name, then URI). Clients treat cursors as opaque and stop when nextCursor is absent. Root discovery servers can implement only the two namespace tools; no windows/list or windows/get prerequisite exists.

Namespace IDs are opaque. URI and ParseURI preserve them without imposing a hexadecimal, UUID or DNS-name format. Collection HTTP paths such as /namespaces/<id>/<kind> are optional host adapters, not namespace references.

Paginate is an optional generic helper matching the existing skills catalog's snapshot/offset convention. Its input must already be the caller's accessible, filtered, ordered summaries. It adds no authorization or credential policy. Servers may supply their own opaque cursor implementation instead.

Resource schemes identify resource-defined contracts, for example skill://<namespace>/<path> and mcp://<namespace>/<name>. An MCP configuration resource can return JSON compatible with its consumer's configuration model; that model is deliberately not imported here. Publish authored credential references, never resolved tokens, passwords or key values.

Documentation

Overview

Package namespaces defines optional catalog tools shared by MCP applications. These are ordinary registered tools, not additions to the MCP wire schema.

Index

Constants

View Source
const (
	ListToolName = "namespaces/list"
	GetToolName  = "namespaces/get"
	// ResourceGetToolName is a legacy ordinary tool name. New publishers and
	// clients use the standard MCP resources/read method instead.
	ResourceGetToolName = "resource/get"
)

Variables

View Source
var ErrCursor = errors.New("invalid or stale namespace catalog cursor")
View Source
var ErrURI = errors.New("invalid namespace URI")

Functions

func Paginate

func Paginate[T any](entries []T, cursor *string, pageSize int) ([]T, *string, error)

Paginate follows the existing skills catalog's snapshot/offset cursor convention. The owner MUST authorize, filter and deterministically sort the collection before calling this helper. It neither grants access nor filters resources, and clients must treat returned cursors as opaque.

func ParseURI

func ParseURI(value string) (string, error)

ParseURI returns the exact opaque ID. Collection paths and resource URIs are distinct contracts and are not accepted as namespace references.

func URI

func URI(id string) (string, error)

URI encodes an opaque namespace identifier without imposing an application ID format (for example hexadecimal, UUID, DNS name, or case normalization).

Types

type GetRequest

type GetRequest struct {
	URI    string  `json:"uri" yaml:"uri"`
	Kind   string  `json:"kind,omitempty" yaml:"kind,omitempty"`
	Cursor *string `json:"cursor,omitempty" yaml:"cursor,omitempty"`
}

type GetResult

type GetResult struct {
	Resources  []Resource `json:"resources" yaml:"resources"`
	NextCursor *string    `json:"nextCursor,omitempty" yaml:"nextCursor,omitempty"`
	Namespace  *Namespace `json:"namespace,omitempty" yaml:"namespace,omitempty"`
}

GetResult contains resource summaries, not full definitions. Absence of NextCursor marks the end of this caller's accessible, filtered collection.

type ListRequest

type ListRequest struct {
	Cursor *string `json:"cursor,omitempty" yaml:"cursor,omitempty"`
}

type ListResult

type ListResult struct {
	Namespaces []Namespace `json:"namespaces" yaml:"namespaces"`
	NextCursor *string     `json:"nextCursor,omitempty" yaml:"nextCursor,omitempty"`
}

type Namespace

type Namespace struct {
	URI         string `json:"uri" yaml:"uri"`
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

type Resource

type Resource struct {
	URI         string `json:"uri" yaml:"uri"`
	Kind        string `json:"kind" yaml:"kind"`
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	MimeType    string `json:"mimeType,omitempty" yaml:"mimeType,omitempty"`
}

type ResourceGetRequest

type ResourceGetRequest struct {
	URI string `json:"uri" yaml:"uri"`
}

ResourceGetRequest is retained for legacy ordinary tool adapters. Standard MCP clients select resource contents with resources/read and params.uri.

Jump to

Keyboard shortcuts

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