Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServeStdio ¶
func WithCredential ¶ added in v0.5.0
WithCredential returns ctx carrying the Share2Us credential used by tool handlers. The hosted transport resolves the request bearer to a credential and sets it here before each CallTool.
Types ¶
type Client ¶
type Client interface {
CreateUpload(context.Context, clicore.UploadCreateRequest) (clicore.UploadCreateResponse, error)
PutUpload(context.Context, clicore.PresignedUpload, io.Reader, int64) error
CompleteUpload(context.Context, string) (clicore.UploadCompleteResponse, error)
ExtendExpiry(context.Context, string, time.Duration) (clicore.Share, error)
Usage(context.Context) (clicore.UsageResponse, error)
}
type ClientFactory ¶
type ClientFactory func(clicore.Credential) Client
type CredentialLoader ¶
type CredentialLoader func() (clicore.Credential, error)
type HTTPCredentialResolver ¶
type HTTPCredentialResolver func(*http.Request) (clicore.Credential, error)
type Option ¶
type Option func(*Server)
func WithClientFactory ¶
func WithClientFactory(factory ClientFactory) Option
func WithCredentialLoader ¶
func WithCredentialLoader(loader CredentialLoader) Option
func WithDisabledTools ¶
func WithHTTPCredentialResolver ¶
func WithHTTPCredentialResolver(resolver HTTPCredentialResolver) Option
func WithPreviewBuilder ¶
func WithPreviewBuilder(builder PreviewBuilder) Option
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) CallTool ¶ added in v0.5.0
CallTool invokes a registered tool by name with raw JSON arguments and returns the tool's result value (or an error). The caller MUST place the Share2Us credential in ctx with WithCredential first; tool handlers read it to call share2us-api.
func (*Server) Tools ¶ added in v0.5.0
func (s *Server) Tools() []ToolDescriptor
Tools returns the enabled tools' descriptors in stable registration order, for a transport that needs to answer tools/list itself.
type Tool ¶
type Tool struct {
Descriptor ToolDescriptor
Handler func(context.Context, json.RawMessage) (any, error)
}