schema

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 13 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 schema has the types of workspaces: what's listed of their folders and resources, with their metadata and artwork

Index

Constants

View Source
const (
	// Capability is the experimental capability of an MCP server which is a
	// workspace, which lists its resources by folder, as the _meta of
	// resources/list says
	Capability = "workspace"

	// MetaPrefix is the prefix of the keys of the _meta of a workspace's
	// requests and resources
	MetaPrefix = "go-llm.workspace/"

	// The keys of the _meta of resources/list: the folder which is listed,
	// whether everything under it is, and the most resources which are
	// returned, which a server which isn't a workspace ignores
	MetaPath      = MetaPrefix + "path"
	MetaRecursive = MetaPrefix + "recursive"
	MetaLimit     = MetaPrefix + "limit"
	MetaType      = MetaPrefix + "type"

	// MetaCount is the key of the _meta of the result of resources/list,
	// which is how many there are, of every page, when the workspace knows
	MetaCount = MetaPrefix + "count"

	// CapabilityTree is the key of the workspace capability, whose value is
	// true when its folders are listed on their own, by their type, and
	// have their paths, so they're shown as a tree
	CapabilityTree = "tree"

	// The keys of the _meta of a resource: its metadata, and artwork
	MetaMeta    = MetaPrefix + "meta"
	MetaArtwork = MetaPrefix + "artwork"

	// The keys of the _meta of resources/read: the byte of the content to
	// read from, and the most bytes to read, so a large resource is read in
	// chunks, and, of its result, the offset of the chunk, which says it's
	// one, and the size of the whole content, when it's known, which a
	// server which isn't a workspace ignores, and leaves out
	MetaOffset = MetaPrefix + "offset"
	MetaLength = MetaPrefix + "length"
	MetaSize   = MetaPrefix + "size"
)
View Source
const FolderType = "inode/directory"

FolderType is the type of a folder, which is listed as a resource, as it's the MIME type of a directory

View Source
const URIScheme = "resource"

URIScheme is the scheme of a workspace's resources' URIs, as a registry has them: resource://<workspace>/<uri>, whose host is the workspace's name, and whose path is the resource's own URI, as the workspace has it, or its path under the workspace's root, which a resource on its own, resource:///<hash>, which has no host, isn't

Variables

This section is empty.

Functions

func ChunkOf

func ChunkOf(result *sdkmcp.ReadResourceResult) bool

ChunkOf returns true when the result is a chunk of the resource's content, as a workspace's server returns, which may be all of it, or false, when it's all of it, as a server which isn't a workspace returns

func CountOf

func CountOf(result *sdkmcp.ListResourcesResult) *uint64

CountOf returns how many resources there are, of every page, which the result of resources/list says, or nil, when it doesn't

func OriginalURI

func OriginalURI(root, rest string) string

OriginalURI returns the resource's own URI, of the rest of a URI which ParseURI returns: its root, and the rest, when it's a path, or the rest, when it's a URI, which has ://, such as artwork's, or the workspace has no root

func ParseURI

func ParseURI(uri string) (workspace, rest string, ok bool)

ParseURI returns the workspace, and the rest of a URI which URIOf returns, which is the resource's path, under the workspace's root, or its own URI, which OriginalURI returns the resource's own URI of, and true, or false, when it isn't one, such as a resource's own URI, or a resource on its own, resource:///<hash>

func ReadParams

func ReadParams(uri string, offset, length int64) *sdkmcp.ReadResourceParams

ReadParams returns the params of resources/read of the resource with the URI, of the chunk of its content from the offset, of at most the length, in its _meta

func ReadRangeOf

func ReadRangeOf(params *sdkmcp.ReadResourceParams) (offset, length int64, ok bool)

ReadRangeOf returns the offset, and length, of the chunk the params of resources/read ask for, and true, or false, when they ask for the whole content, as a client which isn't a workspace's does

func RootOf

func RootOf(templates []*sdkmcp.ResourceTemplate) string

RootOf returns the root of the resources of an MCP server, of its resource templates: the prefix of its one template which is a prefix, and one variable, such as file:///{+path}, whose prefix is file:///, or nothing, when it has none, or more than one

func RootTemplate

func RootTemplate(root string) string

RootTemplate returns the resource template of the root, such as file:///{+path}, of file:///

func SizeOf

func SizeOf(result *sdkmcp.ReadResourceResult) (int64, bool)

SizeOf returns the size of the whole content of the resource, which a chunk of it is, and true, or false, when the result doesn't say, as a server which isn't a workspace's doesn't

func URIOf

func URIOf(workspace, root, uri string) string

URIOf returns the URI of the workspace's resource, with its own URI, as a registry has it: resource://<workspace>/<path>, without the workspace's root, when it's under it, such as resource://files/notes/a.md, of file:///notes/a.md, with the root file:///, or otherwise with all of its own URI, such as resource://github/ui://github/get-me

Types

type Artwork

type Artwork struct {
	// Key is what the image is, such as cover, or thumbnail, as go-metadata's
	// artwork keys are
	Key string `json:"key"`

	// Type is the image's MIME type, such as image/jpeg
	Type string `json:"type,omitempty"`

	// Width and Height are the image's size, in pixels, or zero, when it
	// isn't known
	Width  int `json:"width,omitempty"`
	Height int `json:"height,omitempty"`

	// URI is where the image is read from
	URI string `json:"uri"`
}

Artwork is an image of a resource, with what it is, such as its cover, or a thumbnail, which is read by its URI

type Change

type Change struct {
	// Action is what happened: create, update, or delete
	Action eventschema.ChangeAction `json:"action"`

	// URI is the folder's, or resource's, or empty, when it isn't known
	URI string `json:"uri,omitempty"`
}

Change is a folder, or resource, of a workspace which was created, updated, or deleted, or, without a URI, that its folders, and resources, changed, but not which, so they're listed again, as an MCP server's list_changed says

type ListRequest

type ListRequest struct {
	// Path is the folder whose folders and resources are listed, such as
	// "notes/2026", or empty, for the workspace's top
	Path string `` /* 155-byte string literal not displayed */

	// Recursive lists every folder and resource under the folder, rather
	// than only those in it
	Recursive bool `` /* 136-byte string literal not displayed */

	// Cursor is where the list continues from, which is a response's Next,
	// or empty, to start
	Cursor string `` /* 162-byte string literal not displayed */

	// Limit is the most folders and resources which are returned, or zero, for the
	// workspace's own page size
	Limit uint `json:"limit,omitempty" help:"Most folders and resources to return, or zero, for the workspace's own page size" optional:""`

	// Type is the type of the folders, or resources, which are listed, such
	// as FolderType, for its folders alone, or empty, for all of them
	Type string `` /* 148-byte string literal not displayed */
}

ListRequest is which of a workspace's folders and resources are listed: those in a folder, or under it, from a cursor, and at most a limit of them

func ListRequestOf

func ListRequestOf(params *sdkmcp.ListResourcesParams) ListRequest

ListRequestOf returns the params of resources/list as a request, with the folder, whether it's recursive, and the limit, from its _meta, which are left out when they aren't there, or aren't valid

func (ListRequest) MCP

MCP returns the request as the params of resources/list, with the folder, whether it's recursive, and the limit, in its _meta

func (ListRequest) Query

func (r ListRequest) Query() url.Values

Query returns the request as the query of a URL, without its fields which aren't set, and with its folder, and cursor, as they are, as a folder's name can have spaces, and a cursor is the workspace's own

func (ListRequest) String

func (r ListRequest) String() string

type ListResponse

type ListResponse struct {
	// Body is the page's folders and resources
	Body []ResourceMeta `json:"body"`

	// Next is the cursor of the next page, or empty, when there isn't one
	Next string `json:"next,omitempty"`

	// Count is how many there are, of every page, when the workspace knows,
	// or nil
	Count *uint64 `json:"count,omitempty"`
}

ListResponse is a page of a workspace's folders and resources, and the cursor of the next page

func (ListResponse) String

func (r ListResponse) String() string

type Markdown

type Markdown struct {
	URI    string            `json:"uri" help:"URI of the resource"`
	Type   string            `json:"type,omitempty" help:"MIME type of the resource"`
	Body   string            `json:"body" help:"The part's Markdown"`
	Offset uint64            `json:"offset" help:"The byte of the Markdown the part starts at"`
	Next   *uint64           `json:"next,omitempty" help:"The offset of the next part, or none, at the end"`
	Length *uint64           `` /* 135-byte string literal not displayed */
	Meta   map[string]string `json:"meta,omitempty" help:"The resource's metadata, with the first part, by namespace and key, such as dc:title"`
	Note   string            `json:"note,omitempty" help:"Why the part has no text, such as a page which is rendered by its scripts"`
}

Markdown is a part of a resource, read as Markdown: its body, from the byte of its Markdown at the offset, the offset of the next part, which is left out at its end, and, with the first part, its metadata, by namespace and key, such as dc:title

func (Markdown) Document

func (m Markdown) Document() string

Document returns the part as a Markdown document, whose front matter, in YAML, has its URI, type, offset, the offset of the next part, when there is one, its note, and its metadata, and whose body is its Markdown

type Meta

type Meta struct {
	// NS is the namespace of the key, such as exif
	NS string `json:"ns"`

	// Key is the key, in the namespace, such as DateTimeOriginal
	Key string `json:"key"`

	// Text is the value, as text, to show
	Text string `json:"text"`

	// Value is the value, as JSON, such as a number, a date, or a list
	Value json.RawMessage `json:"value,omitempty"`
}

Meta is a value of a resource's metadata, by its namespace and key, such as exif:DateTimeOriginal, as text, to show, and as JSON

func MetaOf

func MetaOf(md []metadata.Metadata) []Meta

MetaOf returns go-metadata's metadata as a resource's, apart from its artwork, whose images are the resource's Artwork, with its value as text, and as JSON, which is the text, as a JSON string, when its value can't be encoded as JSON

type ReadRequest

type ReadRequest struct {
	URI      string `json:"uri" help:"URI of the resource, as it's listed, resource://<workspace>/<uri>, or its own"`
	Format   string `` /* 184-byte string literal not displayed */
	Offset   uint64 `json:"offset,omitempty" help:"With markdown, the byte of its Markdown the part starts at, which is a part's next" optional:""`
	Limit    uint64 `json:"limit,omitempty" help:"With markdown, the most bytes of its Markdown which are read" optional:""`
	Download bool   `` /* 146-byte string literal not displayed */
}

ReadRequest is how a workspace's resource is read: by its URI, which is the workspace's, resource://<workspace>/<uri>, or its own, as it is, or as a Markdown document, a part at a time, and whether it's downloaded

func (ReadRequest) Query

func (r ReadRequest) Query() url.Values

Query returns the request as the query of a URL, without its fields which aren't set

type ResourceMeta

type ResourceMeta struct {
	// URI is the resource's URI, such as file:///notes/2026/meeting.md
	URI string `json:"uri"`

	// Name is the resource's name, such as meeting.md
	Name string `json:"name"`

	// Title is the resource's title, for people, or nothing
	Title string `json:"title,omitempty"`

	// Description is what the resource is, or nothing
	Description string `json:"description,omitempty"`

	// Type is the MIME type of the resource's content, or FolderType, for a
	// folder, or nothing, when it isn't known
	Type string `json:"type,omitempty"`

	// Path is the resource's path, under the workspace's top, such as
	// notes/2026, which a folder is listed by, or nothing, when it isn't
	// known
	Path string `json:"path,omitempty"`

	// Size is the length of the resource's content, in bytes, or zero, when
	// it isn't known
	Size int64 `json:"size,omitempty"`

	// Modified is when the resource was last changed, or zero, when it isn't
	// known
	Modified time.Time `json:"modified,omitzero"`

	// Meta is the resource's metadata, of which a key can have more than one
	// value
	Meta []Meta `json:"meta,omitempty"`

	// Artwork is the resource's images, such as its cover, or thumbnail
	Artwork []Artwork `json:"artwork,omitempty"`
}

ResourceMeta is a folder, or a resource, of a workspace, as it's listed: what it is, rather than its content

func ResourceMetaOf

func ResourceMetaOf(resource *sdkmcp.Resource) ResourceMeta

ResourceMetaOf returns MCP's resource as a workspace's, with its modified time, metadata, and artwork, when it has them, as a workspace's do, which are left out when they aren't valid

func (ResourceMeta) Cell

func (r ResourceMeta) Cell(col int) tui.CellText

Cell returns the resource's name, or title, which a folder ends with a slash, its type, size, when it was modified, and its URI

func (ResourceMeta) Header

func (ResourceMeta) Header() []string

func (ResourceMeta) IsFolder

func (r ResourceMeta) IsFolder() bool

IsFolder returns true when the resource is a folder, as its type says

func (ResourceMeta) MCP

func (r ResourceMeta) MCP() *sdkmcp.Resource

MCP returns the resource as MCP's, with its modified time as its annotations' lastModified, and its metadata, and artwork, in its _meta

func (ResourceMeta) String

func (r ResourceMeta) String() string

func (ResourceMeta) Width

func (ResourceMeta) Width(int) int

type Workspace

type Workspace struct {
	Name        string `json:"name" help:"Name of the workspace, which is its namespace's"`
	Title       string `json:"title,omitempty" help:"Title of the workspace, such as its MCP server's"`
	Description string `json:"description,omitempty" help:"What the workspace has, as its namespace says"`
	Version     string `json:"version,omitempty" help:"Version of the workspace, such as its MCP server's"`
	Read        bool   `json:"read,omitempty" help:"Whether its resources' content is read, by their URIs, rather than only listed"`
	Watch       bool   `json:"watch,omitempty" help:"Whether its changes are followed, and published as events, now"`
	Tree        bool   `` /* 154-byte string literal not displayed */
}

Workspace is a workspace in a registry: its name, and whether its resources are read, and its changes are watched

func (Workspace) Cell

func (w Workspace) Cell(col int) tui.CellText

Cell returns the workspace's name, title, version, features, and its description

func (Workspace) Features

func (w Workspace) Features() []string

Features returns what the workspace does, besides listing its folders and resources: read, when its resources' content is read, by their URIs, watch, when its changes are followed, and published, now, and tree, when its folders are listed on their own, so they're shown as a tree

func (Workspace) Header

func (Workspace) Header() []string

func (Workspace) String

func (w Workspace) String() string

func (Workspace) Width

func (Workspace) Width(int) int

type WorkspaceList

type WorkspaceList struct {
	Count uint        `json:"count" help:"How many workspaces there are"`
	Body  []Workspace `json:"body" help:"The workspaces"`
}

WorkspaceList is the workspaces, in order of their names, and how many there are

func (WorkspaceList) String

func (w WorkspaceList) String() string

Jump to

Keyboard shortcuts

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