types

package
v0.0.92 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentTool             = "chat-with-"
	AgentToolDescription  = "Chat with the agent"
	AttachmentMetaKey     = "ai.nanobot.meta/attachment"
	SkipTruncationMetaKey = "ai.nanobot.meta/skip-truncation"
)
View Source
const (
	ConfigSessionKey                = "config"
	ConfigHashSessionKey            = "configHash"
	CurrentAgentSessionKey          = "currentAgent"
	SessionInitSessionKey           = "sessionInit"
	DefaultAgentSessionKey          = "defaultAgent"
	AccountIDSessionKey             = "accountID"
	DescriptionSessionKey           = "description"
	TaskURISessionKey               = "taskURI"
	ResourceSubscriptionsSessionKey = "resourceSubscriptions"
	PublicURLSessionKey             = "publicURL"
)
View Source
const (
	InternalLLMRequestTypeHeader = "X-Nanobot-Internal-Request-Type"
	ThreadTitleRequestType       = "nanobot.summary.thread_title"
)
View Source
const (
	MessageMimeType     = "application/vnd.nanobot.chat.message+json"
	HistoryMimeType     = "application/vnd.nanobot.chat.history+json"
	ToolResultMimeType  = "application/vnd.nanobot.tool.result+json"
	ErrorMimeType       = "application/vnd.nanobot.error+json"
	AgentMimeType       = "application/vnd.nanobot.agent+json"
	SessionMimeType     = "application/vnd.nanobot.session+json"
	ElicitationMimeType = "application/vnd.nanobot.elicitation+json"
	MetaNanobot         = "ai.nanobot"

	MessageURI     = "chat://message/%s"
	HistoryURI     = "chat://history"
	ProgressURI    = "chat://progress"
	ElicitationURI = "chat://elicitation"
)
View Source
const CompletionProgressMetaKey = "ai.nanobot.progress/completion"
View Source
const PreviousExecutionKey = "thread"

Variables

View Source
var (
	MetaPrefix          = "ai.nanobot.meta/"
	ToolCallConfirmType = "toolcall/confirm"

	AsyncMetaKey = "ai.nanobot.async"
)
View Source
var (
	ImageMimeTypes = map[string]struct{}{
		"image/png":  {},
		"image/jpeg": {},
		"image/webp": {},
	}
	TextMimeTypes = map[string]struct{}{
		"text/plain":             {},
		"text/markdown":          {},
		"text/html":              {},
		"text/csv":               {},
		"application/json":       {},
		"application/xml":        {},
		"application/javascript": {},
		"image/svg+xml":          {},
	}
	PDFMimeTypes = map[string]struct{}{
		"application/pdf": {},
	}
)
View Source
var ChatInputSchema = []byte(`{
  "type": "object",
  "required": ["prompt"],
  "properties": {
    "prompt": {
  	  "description": "The input prompt",
  	  "type": "string"
    },
    "attachments": {
	  "type": "array",
	  "items": {
	    "description": "An attachment to the prompt (optional)",
	    "type": "object",
	    "required": ["url"],
	    "properties": {
	      "name": {
	        "description": "The name of the resource, often the filename",
	        "type": "string"
	      },
	      "url": {
	        "description": "The URL of the attachment or data URI",
	        "type": "string"
	      },
	      "mimeType": {
	        "description": "The mime type of the content reference by the URL",
	        "type": "string"
	      }
	    }
	  }
    }
  }
}`)

Functions

func CurrentAgent added in v0.0.79

func CurrentAgent(ctx context.Context) string

func GetSessionAndAccountID added in v0.0.79

func GetSessionAndAccountID(ctx context.Context) (string, string)

func GetWorkspaceID added in v0.0.79

func GetWorkspaceID(ctx context.Context) string

func InternalLLMRequestType added in v0.0.79

func InternalLLMRequestType(ctx context.Context) string

func IsChatSession added in v0.0.79

func IsChatSession(ctx context.Context) bool

func IsModelTool added in v0.0.79

func IsModelTool(t mcp.Tool) bool

func IsUISession added in v0.0.79

func IsUISession(ctx context.Context) bool

func IsUITool added in v0.0.79

func IsUITool(t mcp.Tool) bool

func MarshalMeta added in v0.0.79

func MarshalMeta(obj any) ([]byte, error)

func Meta added in v0.0.79

func Meta(m map[string]any) map[string]any

func ResourceContentUseBlob added in v0.0.79

func ResourceContentUseBlob(mimeType string, content []byte) bool

ResourceContentUseBlob reports whether file bytes should be sent in MCP ResourceContent.blob (base64) rather than ResourceContent.text (UTF-8 string). Binary formats such as Office documents must use blob; interpreting them as Go strings corrupts the payload.

func UnmarshalMeta added in v0.0.79

func UnmarshalMeta[T any](data []byte, out *T) error

func WithConfig added in v0.0.79

func WithConfig(ctx context.Context, config Config) context.Context

func WithInternalLLMRequestType added in v0.0.79

func WithInternalLLMRequestType(ctx context.Context, requestType string) context.Context

func WithNanobotContext added in v0.0.79

func WithNanobotContext(ctx context.Context, nc Context) context.Context

func WithThreadTitleRequest added in v0.0.79

func WithThreadTitleRequest(ctx context.Context) context.Context

Types

type Agent

type Agent struct {
	HookAgent `json:",inline" yaml:",inline"`
	Output    *OutputSchema `json:"output,omitempty"`
}

func (Agent) ToDisplay added in v0.0.79

func (a Agent) ToDisplay(id string) AgentDisplay

type AgentConfigHook added in v0.0.79

type AgentConfigHook struct {
	Agent      *HookAgent                          `json:"agent,omitempty"`
	Meta       map[string]any                      `json:"_meta,omitempty"`
	SessionID  string                              `json:"sessionId,omitempty"`
	MCPServers map[string]AgentConfigHookMCPServer `json:"mcpServers,omitempty"`
}

AgentConfigHook is a hook that can be used to configure the agent. Hook Name = "config"

type AgentConfigHookMCPServer added in v0.0.79

type AgentConfigHookMCPServer struct {
	URL     string            `json:"url"`
	Headers map[string]string `json:"headers"`
}

func (AgentConfigHookMCPServer) ToMCPServer added in v0.0.79

func (a AgentConfigHookMCPServer) ToMCPServer() mcp.Server

type AgentDisplay added in v0.0.79

type AgentDisplay struct {
	ID              string   `json:"id"`
	Name            string   `json:"name"`
	ShortName       string   `json:"shortName"`
	Description     string   `json:"description"`
	Icon            string   `json:"icon"`
	IconDark        string   `json:"iconDark"`
	StarterMessages []string `json:"starterMessages"`
	Base            bool     `json:"base"`
	Current         bool     `json:"current"`
}

type AgentList added in v0.0.79

type AgentList struct {
	Agents []AgentDisplay `json:"agents"`
}

type AgentPermission added in v0.0.79

type AgentPermission string
const (
	AgentPermissionUnset AgentPermission = ""
	AgentPermissionAllow AgentPermission = "allow"
	AgentPermissionDeny  AgentPermission = "deny"
)

type AgentPermissions added in v0.0.79

type AgentPermissions struct {
	// contains filtered or unexported fields
}

func DenyAllPermissions added in v0.0.79

func DenyAllPermissions() *AgentPermissions

func (*AgentPermissions) Allowed added in v0.0.79

func (a *AgentPermissions) Allowed(from iter.Seq[string]) []string

Allowed returns a list of the allowed permissions from the input.

func (*AgentPermissions) IsAllowed added in v0.0.79

func (a *AgentPermissions) IsAllowed(perm string) bool

IsAllowed returns true if the permission is allowed.

func (AgentPermissions) MarshalJSON added in v0.0.79

func (a AgentPermissions) MarshalJSON() ([]byte, error)

func (AgentPermissions) MarshalYAML added in v0.0.79

func (a AgentPermissions) MarshalYAML() (any, error)

func (*AgentPermissions) UnmarshalJSON added in v0.0.79

func (a *AgentPermissions) UnmarshalJSON(data []byte) error

func (*AgentPermissions) UnmarshalYAML added in v0.0.79

func (a *AgentPermissions) UnmarshalYAML(value *yaml.Node) error

type AgentReasoning added in v0.0.79

type AgentReasoning struct {
	Effort  string `json:"effort,omitempty"`
	Summary string `json:"summary,omitempty"`
}

type AgentRequestHook added in v0.0.79

type AgentRequestHook struct {
	Request  *CompletionRequest  `json:"request,omitempty"`
	Response *CompletionResponse `json:"response,omitempty"`
}

AgentRequestHook is a hook that can be used to modify the request before it is sent to the MCP server. Hook Name = "request"

type AgentResponseHook added in v0.0.79

type AgentResponseHook = AgentRequestHook

AgentResponseHook is a hook that can be used to modify the response before it is returned to the agent. Hook Name = "response"

type AsyncCallResult added in v0.0.79

type AsyncCallResult struct {
	Meta             map[string]any `json:"_meta,omitzero"`
	IsError          bool           `json:"isError"`
	Content          []mcp.Content  `json:"content,omitzero"`
	InProgress       bool           `json:"inProgress,omitempty"`
	ToolName         string         `json:"toolName,omitempty"`
	ProgressToken    any            `json:"progressToken,omitempty"`
	InputReplacement string         `json:"inputReplacement,omitempty"`
}

type Attachment

type Attachment struct {
	Name     string `json:"name,omitempty"`
	URL      string `json:"url"`
	MimeType string `json:"mimeType,omitempty"`
}

func (*Attachment) UnmarshalJSON added in v0.0.79

func (a *Attachment) UnmarshalJSON(data []byte) error

type Auth added in v0.0.79

type Auth struct {
	OAuthClientID                    string         `json:"oauthClientId"`
	OAuthClientSecret                string         `json:"oauthClientSecret"`
	OAuthAuthorizeURL                string         `json:"oauthAuthorizeUrl"`
	OAuthScopes                      StringList     `json:"oauthScopes"`
	OAuthAuthorizationServerMetadata map[string]any `json:"oauthAuthorizationServerMetadata"`
	EncryptionKey                    string         `json:"encryptionKey"`
	APIKeyAuthURL                    string         `json:"apiKeyAuthUrl"`
}

type BuildToolMappingsOptions added in v0.0.79

type BuildToolMappingsOptions struct {
	DefaultAsToServer bool
}

func (BuildToolMappingsOptions) Merge added in v0.0.79

type CallResult added in v0.0.79

type CallResult struct {
	Meta              map[string]any `json:"_meta,omitzero"`
	Content           []mcp.Content  `json:"content,omitempty"`
	IsError           bool           `json:"isError,omitempty"`
	Agent             string         `json:"agent,omitempty"`
	Model             string         `json:"model,omitempty"`
	StopReason        string         `json:"stopReason,omitempty"`
	StructuredContent map[string]any `json:"structuredContent,omitempty"`
}

type Chat added in v0.0.79

type Chat struct {
	ID           string    `json:"id"`
	Title        string    `json:"title"`
	Created      time.Time `json:"created"`
	ReadOnly     bool      `json:"readonly,omitempty"`
	TaskURI      string    `json:"taskURI,omitempty"`
	WorkflowURIs []string  `json:"workflowURIs,omitempty"`
}

type ChatList added in v0.0.79

type ChatList struct {
	Chats []Chat `json:"chats"`
}

type Completer

type Completer interface {
	Complete(ctx context.Context, req CompletionRequest, opts ...CompletionOptions) (*CompletionResponse, error)
}

type CompletionItem added in v0.0.79

type CompletionItem struct {
	ID             string          `json:"id,omitempty"`
	Partial        bool            `json:"partial,omitempty"`
	HasMore        bool            `json:"hasMore,omitempty"`
	Content        *mcp.Content    `json:"content,omitempty"`
	ToolCall       *ToolCall       `json:"toolCall,omitempty"`
	ToolCallResult *ToolCallResult `json:"toolCallResult,omitempty"`
	Reasoning      *Reasoning      `json:"reasoning,omitempty"`
}

func (CompletionItem) MarshalJSON added in v0.0.79

func (c CompletionItem) MarshalJSON() ([]byte, error)

func (*CompletionItem) UnmarshalJSON added in v0.0.79

func (c *CompletionItem) UnmarshalJSON(data []byte) error

type CompletionOptions

type CompletionOptions struct {
	ProgressToken      any
	Chat               *bool
	ToolChoice         *mcp.ToolChoice
	Tools              []mcp.Tool
	ToolIncludeContext string
	ToolSource         string
}

func (CompletionOptions) Merge added in v0.0.79

func (c CompletionOptions) Merge(other CompletionOptions) (result CompletionOptions)

type CompletionProgress added in v0.0.79

type CompletionProgress struct {
	Model     string         `json:"model,omitempty"`
	Agent     string         `json:"agent,omitempty"`
	MessageID string         `json:"messageID,omitempty"`
	Role      string         `json:"role,omitempty"`
	Item      CompletionItem `json:"item,omitempty"`
}

type CompletionRequest

type CompletionRequest struct {
	Model            string               `json:"model,omitempty"`
	Agent            string               `json:"agent,omitempty"`
	ThreadName       string               `json:"threadName,omitempty"`
	NewThread        bool                 `json:"newThread,omitempty"`
	Input            []Message            `json:"input,omitzero"`
	ModelPreferences mcp.ModelPreferences `json:"modelPreferences,omitzero"`
	SystemPrompt     string               `json:"systemPrompt,omitzero"`
	MaxTokens        int                  `json:"maxTokens,omitempty"`
	ToolChoice       string               `json:"toolChoice,omitempty"`
	OutputSchema     *OutputSchema        `json:"outputSchema,omitempty"`
	Temperature      *json.Number         `json:"temperature,omitempty"`
	Truncation       string               `json:"truncation,omitempty"`
	TopP             *json.Number         `json:"topP,omitempty"`
	Metadata         map[string]any       `json:"metadata,omitempty"`
	Tools            []ToolUseDefinition  `json:"tools,omitzero"`
	Reasoning        *AgentReasoning      `json:"reasoning,omitempty"`
}

func (CompletionRequest) GetAgent added in v0.0.79

func (r CompletionRequest) GetAgent() string

func (CompletionRequest) Reset added in v0.0.79

type CompletionResponse

type CompletionResponse struct {
	Output           Message   `json:"output,omitempty"`
	InternalMessages []Message `json:"internalMessages,omitempty"`
	Agent            string    `json:"agent,omitempty"`
	Model            string    `json:"model,omitempty"`
	HasMore          bool      `json:"hasMore,omitempty"`
	Error            string    `json:"error,omitempty"`
	ProgressToken    any       `json:"progressToken,omitempty"`

	// InputReplacement, if set, indicates the last user message was replaced
	// by the LLM proxy due to a policy violation. The value is the replacement text.
	InputReplacement string `json:"inputReplacement,omitempty"`

	// ToolCallPolicyViolation, if set, indicates that the LLM's tool calls were blocked
	// by the proxy due to a policy violation. The value is the explanation to return as
	// error tool_results instead of executing the tools.
	ToolCallPolicyViolation string `json:"toolCallPolicyViolation,omitempty"`
}

func (*CompletionResponse) Deserialize added in v0.0.79

func (c *CompletionResponse) Deserialize(data any) (any, error)

func (*CompletionResponse) Serialize added in v0.0.79

func (c *CompletionResponse) Serialize() (any, error)

type Config

type Config struct {
	Auth             *Auth                  `json:"auth,omitempty"`
	Extends          StringList             `json:"extends,omitempty"`
	Env              map[string]EnvDef      `json:"env,omitempty"`
	Publish          Publish                `json:"publish,omitzero"`
	LLMProviders     map[string]LLMProvider `json:"llmProviders,omitempty"`
	Agents           map[string]Agent       `json:"agents,omitempty"`
	MCPServers       map[string]mcp.Server  `json:"mcpServers,omitempty"`
	Profiles         map[string]Config      `json:"profiles,omitempty"`
	Prompts          map[string]Prompt      `json:"prompts,omitempty"`
	Hooks            mcp.Hooks              `json:"hooks,omitempty"`
	WorkspaceID      string                 `json:"workspaceId,omitempty"`
	WorkspaceBaseURI string                 `json:"workspaceBaseUri,omitempty"`
}

func ConfigFromContext added in v0.0.79

func ConfigFromContext(ctx context.Context) (result Config)

func (Config) Redacted added in v0.0.79

func (c Config) Redacted() Config

func (Config) Validate added in v0.0.79

func (c Config) Validate(allowLocal bool) error

type ConfigFactory added in v0.0.79

type ConfigFactory func(ctx context.Context, profiles string) (Config, error)

type Context added in v0.0.79

type Context struct {
	User    mcp.User
	Config  ConfigFactory
	Profile []string
}

func NanobotContext added in v0.0.79

func NanobotContext(ctx context.Context) Context

type Dialect added in v0.0.79

type Dialect string
const (
	DialectAnthropicMessages     Dialect = "AnthropicMessages"
	DialectOpenAIResponses       Dialect = "OpenAIResponses"
	DialectOpenResponses         Dialect = "OpenResponses"
	DialectOpenAIChatCompletions Dialect = "OpenAIChatCompletions"
	DialectDefault                       = DialectOpenAIResponses
)

type DynamicInstructions

type DynamicInstructions struct {
	Instructions string            `json:"-"`
	MCPServer    string            `json:"mcpServer,omitempty"`
	Prompt       string            `json:"prompt,omitempty"`
	Args         map[string]string `json:"args,omitempty"`
}

func (DynamicInstructions) IsPrompt

func (a DynamicInstructions) IsPrompt() bool

func (DynamicInstructions) IsSet

func (a DynamicInstructions) IsSet() bool

func (DynamicInstructions) MarshalJSON

func (a DynamicInstructions) MarshalJSON() ([]byte, error)

func (*DynamicInstructions) UnmarshalJSON

func (a *DynamicInstructions) UnmarshalJSON(data []byte) error

type EnvDef added in v0.0.79

type EnvDef struct {
	Default        string     `json:"default,omitempty"`
	Description    string     `json:"description,omitempty"`
	Options        StringList `json:"options,omitempty"`
	Optional       bool       `json:"optional,omitempty"`
	Sensitive      *bool      `json:"sensitive,omitempty"`
	UseBearerToken bool       `json:"useBearerToken,omitempty"`
}

func (*EnvDef) UnmarshalJSON added in v0.0.79

func (e *EnvDef) UnmarshalJSON(data []byte) error

type Execution added in v0.0.79

type Execution struct {
	Request           CompletionRequest     `json:"request,omitempty"`
	Done              bool                  `json:"done,omitempty"`
	PopulatedRequest  *CompletionRequest    `json:"populatedRequest,omitempty"`
	ToolToMCPServer   ToolMappings          `json:"toolToMCPServer,omitempty"`
	Response          *CompletionResponse   `json:"response,omitempty"`
	ToolOutputs       map[string]ToolOutput `json:"toolOutputs,omitempty"`
	CompactedMessages []Message             `json:"compactedMessages,omitempty"`
}

func (*Execution) Deserialize added in v0.0.79

func (e *Execution) Deserialize(data any) (any, error)

func (*Execution) Serialize added in v0.0.79

func (e *Execution) Serialize() (any, error)

type Field added in v0.0.79

type Field struct {
	Description string           `json:"description,omitempty"`
	Fields      map[string]Field `json:"fields,omitempty"`
	Required    *bool            `json:"required,omitempty"`
}

func (Field) MarshalJSON added in v0.0.79

func (f Field) MarshalJSON() ([]byte, error)

func (*Field) UnmarshalJSON added in v0.0.79

func (f *Field) UnmarshalJSON(data []byte) error

type HookAgent added in v0.0.79

type HookAgent struct {
	Name            string                    `json:"name,omitempty"`
	ShortName       string                    `json:"shortName,omitempty"`
	Description     string                    `json:"description,omitempty"`
	Icon            string                    `json:"icon,omitempty"`
	IconDark        string                    `json:"iconDark,omitempty"`
	StarterMessages StringList                `json:"starterMessages,omitempty"`
	Instructions    DynamicInstructions       `json:"instructions,omitzero"`
	Model           string                    `json:"model,omitempty"`
	Permissions     *AgentPermissions         `json:"permissions,omitempty"`
	MCPServers      StringList                `json:"mcpServers,omitempty"`
	Tools           StringList                `json:"tools,omitempty"`
	Agents          StringList                `json:"agents,omitempty"`
	Prompts         StringList                `json:"prompts,omitzero"`
	Resources       StringList                `json:"resources,omitzero"`
	Reasoning       *AgentReasoning           `json:"reasoning,omitempty"`
	ThreadName      string                    `json:"threadName,omitempty"`
	Chat            *bool                     `json:"chat,omitempty"`
	ToolExtensions  map[string]map[string]any `json:"toolExtensions,omitempty"`
	ToolChoice      string                    `json:"toolChoice,omitempty"`
	Temperature     *json.Number              `json:"temperature,omitempty"`
	TopP            *json.Number              `json:"topP,omitempty"`
	Truncation      string                    `json:"truncation,omitempty"`
	MaxTokens       int                       `json:"maxTokens,omitempty"`
	ContextWindow   int                       `json:"contextWindow,omitempty"`
	MimeTypes       []string                  `json:"mimeTypes,omitempty"`
	Hooks           mcp.Hooks                 `json:"hooks,omitempty"`

	Aliases      []string `json:"aliases,omitempty"`
	Cost         float64  `json:"cost,omitempty"`
	Speed        float64  `json:"speed,omitempty"`
	Intelligence float64  `json:"intelligence,omitempty"`
}

type InputSchema added in v0.0.79

type InputSchema struct {
	Name        string           `json:"name,omitempty"`
	Description string           `json:"description,omitempty"`
	Schema      json.RawMessage  `json:"schema,omitzero"`
	Fields      map[string]Field `json:"fields,omitempty"`
}

func (InputSchema) ToSchema added in v0.0.79

func (i InputSchema) ToSchema() json.RawMessage

type LLMProvider added in v0.0.79

type LLMProvider struct {
	Dialect Dialect           `json:"dialect,omitempty"`
	APIKey  string            `json:"apiKey,omitempty"`
	BaseURL string            `json:"baseURL,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

type Message added in v0.0.79

type Message struct {
	ID      string           `json:"id,omitempty"`
	Created *time.Time       `json:"created,omitempty"`
	Role    string           `json:"role,omitempty"`
	Items   []CompletionItem `json:"items,omitempty"`
	HasMore bool             `json:"hasMore,omitempty"`
}

func ConsolidateTools added in v0.0.79

func ConsolidateTools(allMessages []Message) (result []Message)

type OutputSchema

type OutputSchema struct {
	Name        string           `json:"name,omitempty"`
	Description string           `json:"description,omitempty"`
	Schema      json.RawMessage  `json:"schema,omitzero"`
	Strict      bool             `json:"strict,omitempty"`
	Fields      map[string]Field `json:"fields,omitempty"`
}

func (OutputSchema) ToSchema added in v0.0.79

func (o OutputSchema) ToSchema() json.RawMessage

type Prompt added in v0.0.79

type Prompt struct {
	Description string           `json:"description,omitempty"`
	Input       map[string]Field `json:"input,omitempty"`
	Template    string           `json:"template,omitempty"`
}

func (Prompt) ToPrompt added in v0.0.79

func (p Prompt) ToPrompt(name string) mcp.Prompt

type PromptMappings

type PromptMappings map[string]TargetMapping[mcp.Prompt]

func (PromptMappings) Deserialize added in v0.0.79

func (p PromptMappings) Deserialize(data any) (any, error)

type Publish

type Publish struct {
	Name              string              `json:"name,omitempty"`
	Introduction      DynamicInstructions `json:"introduction,omitzero"`
	Version           string              `json:"version,omitempty"`
	Instructions      string              `json:"instructions,omitempty"`
	Tools             StringList          `json:"tools,omitzero"`
	Prompts           StringList          `json:"prompts,omitzero"`
	Resources         StringList          `json:"resources,omitzero"`
	ResourceTemplates StringList          `json:"resourceTemplates,omitzero"`
	MCPServers        StringList          `json:"mcpServers,omitzero"`
	Entrypoint        StringList          `json:"entrypoint,omitempty"`
	LazyInitialize    *bool               `json:"lazyInitialize,omitempty"`
}

func (Publish) IsLazyInitialize added in v0.0.92

func (p Publish) IsLazyInitialize() bool

func (Publish) IsSingleServerProxy added in v0.0.79

func (p Publish) IsSingleServerProxy() bool

type Reasoning added in v0.0.79

type Reasoning struct {
	EncryptedContent string        `json:"encryptedContent,omitempty"`
	Summary          []SummaryText `json:"summary,omitempty"`
}

type ResourceMappings

type ResourceMappings map[string]TargetMapping[mcp.Resource]

func (ResourceMappings) Deserialize added in v0.0.79

func (r ResourceMappings) Deserialize(data any) (any, error)

type ResourceTemplateMappings

type ResourceTemplateMappings map[string]TargetMapping[TemplateMatch]

func (ResourceTemplateMappings) Deserialize added in v0.0.79

func (r ResourceTemplateMappings) Deserialize(data any) (any, error)

type SampleCallRequest

type SampleCallRequest struct {
	Prompt      string       `json:"prompt"`
	Attachments []Attachment `json:"attachments,omitempty"`
}

type SampleConfirmRequest

type SampleConfirmRequest struct {
	ID     string `json:"id"`
	Accept bool   `json:"accept"`
}

type SessionInitHook added in v0.0.79

type SessionInitHook struct {
	URL       string         `json:"url"`
	SessionID string         `json:"sessionId"`
	Meta      map[string]any `json:"_meta,omitempty"`
}

func (*SessionInitHook) Deserialize added in v0.0.79

func (s *SessionInitHook) Deserialize(data any) (any, error)

func (*SessionInitHook) Serialize added in v0.0.79

func (s *SessionInitHook) Serialize() (any, error)

type StringList

type StringList []string

func (*StringList) UnmarshalJSON

func (s *StringList) UnmarshalJSON(data []byte) error

type SummaryText added in v0.0.79

type SummaryText struct {
	Text string `json:"text,omitempty"`
}

type TargetMapping

type TargetMapping[T any] struct {
	MCPServer  string `json:"mcpServer,omitempty"`
	TargetName string `json:"targetName,omitempty"`
	Target     T      `json:"target,omitempty"`
}

type TargetTool added in v0.0.79

type TargetTool struct {
	mcp.Tool
	External bool `json:"external,omitempty"`
}

type TemplateMatch added in v0.0.79

type TemplateMatch struct {
	Regexp           *regexp.Regexp
	ResourceTemplate mcp.ResourceTemplate
}

func (TemplateMatch) MarshalJSON added in v0.0.79

func (t TemplateMatch) MarshalJSON() ([]byte, error)

func (*TemplateMatch) UnmarshalJSON added in v0.0.79

func (t *TemplateMatch) UnmarshalJSON(data []byte) error

type ToolCall

type ToolCall struct {
	Arguments  string `json:"arguments,omitempty"`
	CallID     string `json:"callID,omitempty"`
	Name       string `json:"name,omitempty"`
	Target     string `json:"target,omitempty"`
	TargetType string `json:"targetType,omitempty"`
}

type ToolCallConfirm added in v0.0.79

type ToolCallConfirm struct {
	Type       string    `json:"type"`
	MCPServer  string    `json:"mcpServer,omitempty"`
	Tool       mcp.Tool  `json:"tool,omitempty"`
	Invocation *ToolCall `json:"invocation,omitempty"`
}

func (ToolCallConfirm) MarshalJSON added in v0.0.79

func (t ToolCallConfirm) MarshalJSON() ([]byte, error)

func (ToolCallConfirm) Message added in v0.0.79

func (t ToolCallConfirm) Message() string

func (*ToolCallConfirm) UnmarshalJSON added in v0.0.79

func (t *ToolCallConfirm) UnmarshalJSON(data []byte) error

type ToolCallResult

type ToolCallResult struct {
	CallID string     `json:"callID,omitempty"`
	Output CallResult `json:"output,omitzero"`
}

type ToolMappings

type ToolMappings map[string]TargetMapping[TargetTool]

func (*ToolMappings) Deserialize added in v0.0.79

func (t *ToolMappings) Deserialize(data any) (any, error)

type ToolOutput added in v0.0.79

type ToolOutput struct {
	Output Message `json:"output,omitempty"`
	Done   bool    `json:"done,omitempty"`
}

type ToolRef

type ToolRef struct {
	Server string
	Tool   string
	As     string
}

func ParseToolRef

func ParseToolRef(ref string) ToolRef

func (ToolRef) PublishedName

func (t ToolRef) PublishedName(name string) string

func (ToolRef) String added in v0.0.79

func (t ToolRef) String() string

type ToolUseDefinition

type ToolUseDefinition struct {
	Name        string          `json:"name,omitempty"`
	Parameters  json.RawMessage `json:"parameters,omitempty"`
	Description string          `json:"description,omitempty"`
	Attributes  map[string]any  `json:"-"`
}

type UIAction added in v0.0.79

type UIAction struct {
	Type   string
	Intent *UIIntent
	Tool   *UITool
	Prompt *UIPrompt
}

func (UIAction) MarshalJSON added in v0.0.79

func (u UIAction) MarshalJSON() ([]byte, error)

func (*UIAction) UnmarshalJSON added in v0.0.79

func (u *UIAction) UnmarshalJSON(data []byte) error

type UIIntent added in v0.0.79

type UIIntent struct {
	Intent string         `json:"intent"`
	Params map[string]any `json:"params"`
}

type UIPrompt added in v0.0.79

type UIPrompt struct {
	Prompt           string              `json:"prompt,omitempty"`
	PromptName       string              `json:"promptName,omitempty"`
	Params           map[string]string   `json:"params"`
	RenderedMessages []mcp.PromptMessage `json:"renderedMessages,omitempty"`
}

type UITool added in v0.0.79

type UITool struct {
	ToolName string         `json:"toolName"`
	Params   map[string]any `json:"params"`
}

type Workspace added in v0.0.79

type Workspace struct {
	ID         string                 `json:"id"`
	Name       string                 `json:"name"`
	Order      int                    `json:"order"`
	Color      string                 `json:"color,omitempty"`
	Icons      []mcp.Icon             `json:"icons,omitempty"`
	Attributes map[string]interface{} `json:"attributes,omitempty"`
}

Jump to

Keyboard shortcuts

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