Documentation
¶
Overview ¶
Package filer is a workspace of a go-filer backend, such as a directory, or a bucket, which lists its folders and files, reads them, and watches them, when the backend can, and an MCP server of it
Index ¶
- Constants
- type Server
- type Workspace
- func (w *Workspace) List(ctx context.Context, req schema.ListRequest) (*schema.ListResponse, error)
- func (w *Workspace) Read(ctx context.Context, uri string) (llm.Resource, error)
- func (w *Workspace) Root() string
- func (w *Workspace) Tree() bool
- func (w *Workspace) WatchResources(ctx context.Context, ch chan<- schema.Change) error
Constants ¶
const ( // DefaultLimit is how many folders, and files, are listed, when it isn't // said, and MaxLimit the most DefaultLimit = 100 MaxLimit = 1000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
Server is an MCP server of a go-filer backend's folders, and files, as a workspace, whose name, and title, are its namespace's, which has no tools, yet
func NewServer ¶
NewServer returns an MCP server of the go-filer backend's folders, and files, with the name, which is an identifier, and the title, with the server's options, such as its version. Returns ErrBadParameter when the name isn't an identifier, or there's no backend.
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
Workspace is the workspace of a go-filer backend: its folders, and files, whose URIs are file:// and their paths, such as file:///notes/a.md, and file:///notes/, for a folder, which are percent-encoded
func New ¶
New returns the workspace of the go-filer backend, whose volume has the name. Returns ErrBadParameter when there's no backend.
func (*Workspace) List ¶
func (w *Workspace) List(ctx context.Context, req schema.ListRequest) (*schema.ListResponse, error)
List returns a page of the folders, and files, in the folder, or under it, in the order of their paths, from the cursor, which is the path of the last one of the page before, or, for a file's path, the file
func (*Workspace) Read ¶
Read returns the file with the URI, which is read as it's read. Returns ErrNotFound when there's none, and ErrBadParameter when it's a folder, or the URI isn't a file's.
func (*Workspace) Tree ¶
Tree returns true, as its folders are listed on their own, by their type, and have their paths
func (*Workspace) WatchResources ¶
WatchResources sends the folders, and files, which are created, updated, or deleted, and, without a URI, that they changed, but not which, as the backend says a folder's changes may have been missed, to the channel, until the context is cancelled, when it returns nil. It sends a change without a URI first, once it's watching. Returns ErrNotImplemented when the backend doesn't watch its objects, or doesn't say when it's watching, so a change made once it's said to be isn't missed.