Documentation
¶
Index ¶
- Constants
- func AddRoomDropTools(s *mcp.Server, ...)
- func AddRoomPublishTool(s *mcp.Server, ...)
- func AttachmentHeader(name string) string
- func DescribeExport(req *mcp.CallToolRequest, in ExportInput, out ExportOutput) (string, string, bool)
- func DescribeGet(req *mcp.CallToolRequest, in GetInput, out GetOutput) (string, string, bool)
- func DescribePublish(req *mcp.CallToolRequest, in PublishInput, out PublishOutput) (string, string, bool)
- func DescribePut(req *mcp.CallToolRequest, in PutInput, out PutOutput) (string, string, bool)
- func ParseDocPath(p string) (slug string, n int, ok bool)
- type ExportInput
- type ExportOutput
- type FilesInput
- type FilesOutput
- type GetInput
- type GetOutput
- type MCP
- func (c *MCP) ExportHandler(ctx context.Context, req *mcp.CallToolRequest, in ExportInput) (*mcp.CallToolResult, ExportOutput, error)
- func (c *MCP) FilesHandler(ctx context.Context, req *mcp.CallToolRequest, in FilesInput) (*mcp.CallToolResult, FilesOutput, error)
- func (c *MCP) GetHandler(ctx context.Context, req *mcp.CallToolRequest, in GetInput) (*mcp.CallToolResult, GetOutput, error)
- func (c *MCP) PromptHandler(_ context.Context, _ *mcp.CallToolRequest, in PromptInput) (*mcp.CallToolResult, PromptOutput, error)
- func (c *MCP) PublishFor(ctx context.Context, agent, room, by string, in PublishInput) (*mcp.CallToolResult, PublishOutput, error)
- func (c *MCP) PublishHandler(ctx context.Context, req *mcp.CallToolRequest, in PublishInput) (*mcp.CallToolResult, PublishOutput, error)
- func (c *MCP) PutHandler(ctx context.Context, req *mcp.CallToolRequest, in PutInput) (*mcp.CallToolResult, PutOutput, error)
- func (c *MCP) RegisterDocs(s *mcp.Server, class ctl.Class)
- func (c *MCP) RegisterFiles(s *mcp.Server, class ctl.Class)
- func (c *MCP) RegisterPrompts(s *mcp.Server, class ctl.Class)
- type PromptInput
- type PromptOutput
- type PromptSummary
- type PublishInput
- type PublishOutput
- type PutInput
- type PutOutput
- type Refusal
- type Room
- type Service
Constants ¶
const ( DropFilesPath = "/_hub/drop/files" DropGetPath = "/_hub/drop/get" )
DropFilesPath and DropGetPath are relayed paths that are not HTTP endpoints of the hub: hubAsk answers them in process, for a room's stdio server.
const PromptSlugPrefix = "prompt-"
PromptSlugPrefix marks a hub document as a prompt.
const PublishPath = "/_hub/publish"
PublishPath is the one relayed path that is not an HTTP endpoint of the hub: hubAsk answers it in process.
const RealPathHeader = "X-Atrium-Real-Path"
RealPathHeader is the room's api.RealPathHeader. Spelled here because this package does not import the room's API.
Variables ¶
This section is empty.
Functions ¶
func AddRoomDropTools ¶ added in v0.0.6
func AddRoomDropTools(s *mcp.Server, call func(ctx context.Context, method, path string, body, out any) error)
AddRoomDropTools is atrium_files and atrium_get on a room's stdio server, asked of the hub over the room's link.
func AddRoomPublishTool ¶
func AddRoomPublishTool(s *mcp.Server, call func(ctx context.Context, method, path string, body, out any) error, by string)
AddRoomPublishTool is atrium_publish on a room's stdio server. The tool is the hub's: call asks the hub over the room's link (see hubAsk) and the hub names the caller from the link, never from here.
func AttachmentHeader ¶
AttachmentHeader is a Content-Disposition by RFC 6266: an ASCII `filename=` with CR, LF, `"` and `\` taken out, and `filename*=UTF-8”` carrying the real name percent-encoded.
A TITLE IS TEXT A MODEL WROTE. A raw CR or LF in it would end the header and start another, so both are removed from BOTH forms, and everything outside the unreserved set is percent-encoded in the second.
func DescribeExport ¶
func DescribeExport(req *mcp.CallToolRequest, in ExportInput, out ExportOutput) (string, string, bool)
func DescribeGet ¶
func DescribePublish ¶
func DescribePublish(req *mcp.CallToolRequest, in PublishInput, out PublishOutput) (string, string, bool)
func DescribePut ¶
Types ¶
type ExportInput ¶
type ExportOutput ¶
type ExportOutput struct {
Files []exportedFile `json:"files"`
Skipped []exportSkip `json:"skipped"`
}
type FilesInput ¶
type FilesInput struct {
Mine bool `json:"mine,omitempty" jsonschema:"list only the files your card put"`
}
type FilesOutput ¶
type FilesOutput struct {
Files []dropFile `json:"files"`
Usage dropUsage `json:"usage"`
}
type MCP ¶
type MCP struct {
ctl.Caller
// Docs is the hub's document store, read at each call so it may be wired later. Nil on a hub without one.
Docs func() *hubstore.Store
// Rooms lists the rooms the export reads. Nil in a test that does not read it.
Rooms func() []Room
// Board is the loopback base of the hub's own API, and Client reaches it under Timeout.
Board string
Client *http.Client
Timeout time.Duration
}
MCP is the document and file tools. The Caller is the hub's control server, and the rest is what it reads of the hub.
func (*MCP) ExportHandler ¶
func (c *MCP) ExportHandler(ctx context.Context, req *mcp.CallToolRequest, in ExportInput) ( *mcp.CallToolResult, ExportOutput, error)
func (*MCP) FilesHandler ¶
func (c *MCP) FilesHandler(ctx context.Context, req *mcp.CallToolRequest, in FilesInput) ( *mcp.CallToolResult, FilesOutput, error)
func (*MCP) GetHandler ¶
func (c *MCP) GetHandler(ctx context.Context, req *mcp.CallToolRequest, in GetInput) ( *mcp.CallToolResult, GetOutput, error)
func (*MCP) PromptHandler ¶
func (c *MCP) PromptHandler(_ context.Context, _ *mcp.CallToolRequest, in PromptInput) ( *mcp.CallToolResult, PromptOutput, error)
func (*MCP) PublishFor ¶
func (c *MCP) PublishFor(ctx context.Context, agent, room, by string, in PublishInput) ( *mcp.CallToolResult, PublishOutput, error)
PublishFor is atrium_publish for a caller already named: agent on room, by `by`. The HTTP control server names the caller from its headers and a room's stdio server from the link (hubAsk), and both end here.
func (*MCP) PublishHandler ¶
func (c *MCP) PublishHandler(ctx context.Context, req *mcp.CallToolRequest, in PublishInput) ( *mcp.CallToolResult, PublishOutput, error)
func (*MCP) PutHandler ¶
func (c *MCP) PutHandler(ctx context.Context, req *mcp.CallToolRequest, in PutInput) ( *mcp.CallToolResult, PutOutput, error)
type PromptInput ¶
type PromptOutput ¶
type PromptOutput struct {
Prompts []PromptSummary `json:"prompts,omitempty"`
Name string `json:"name,omitempty"`
Version int `json:"version,omitempty"`
// Builtin is a prompt that ships with atrium and has no hub document yet. It has no versions.
Builtin bool `json:"builtin,omitempty"`
Text string `json:"text,omitempty"`
}
type PromptSummary ¶
type PublishInput ¶
type PublishInput struct {
Title string `json:"title,omitempty" jsonschema:"the document's title. needed for a new document. a new version keeps the title it has"`
Content string `json:"content,omitempty" jsonschema:"the text to publish. give this or path, not both"`
Path string `json:"path,omitempty" jsonschema:"a file inside your own card's directory, read on your room. give this or content, not both"`
Slug string `json:"slug,omitempty" jsonschema:"to add a new version to the document with this slug. leave out for a new document"`
}
type PublishOutput ¶
type PutInput ¶
type PutInput struct {
Path string `json:"path,omitempty" jsonschema:"a file inside your own card's directory, read on your room. give this or content, not both"`
Content string `json:"content,omitempty" jsonschema:"the text to leave. give this or path, not both. needs a name"`
Name string `` /* 129-byte string literal not displayed */
Note string `json:"note,omitempty" jsonschema:"a line saying what it is and who it is for. at most 500 characters"`
TTLDays int `json:"ttl_days,omitempty" jsonschema:"days to keep it, 1 to 30. default 7"`
}
type Refusal ¶
Refusal is a refusal with the status the HTTP API would have given it, so the same rule reads the same on both doors. It is a refusedError underneath, for the audit line.
type Service ¶
type Service struct {
// RecordAudit writes one line in the hub's operational audit log.
RecordAudit func(room, kind, detail string)
// contains filtered or unexported fields
}
Service is the hub's document store and the HTTP half of the documents and the file drop. See mcp.go for the tools.
func (*Service) ServeFiles ¶
ServeFiles answers every /_hub/files route.