Documentation
¶
Index ¶
- type Annotations
- type Audio
- type Content
- type CreateSpec
- type Image
- type Message
- type Option
- func WithHistory(msgs ...Message) Option
- func WithIncludeContext(kind string) Option
- func WithMaxTokens(n int) Option
- func WithMetadata(meta map[string]any) Option
- func WithModelPreferences(prefs *mcp.ModelPreferences) Option
- func WithStopSequences(stops ...string) Option
- func WithTemperature(t float64) Option
- type Role
- type Text
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotations ¶
type Annotations struct {
Audience []Role `json:"audience,omitempty"`
Priority *float64 `json:"priority,omitempty"`
LastModified string `json:"lastModified,omitempty"`
}
Annotations correspond to the MCP spec annotations object and are advisory hints.
type Audio ¶
type Audio struct {
Data []byte `json:"-"`
MIMEType string `json:"mimeType"`
Annotations *Annotations `json:"annotations,omitempty"`
}
Audio content block.
func (Audio) AsContentBlock ¶
func (a Audio) AsContentBlock() mcp.ContentBlock
type Content ¶
type Content interface {
AsContentBlock() mcp.ContentBlock
// contains filtered or unexported methods
}
Content represents exactly one content block in a sampling message.
type CreateSpec ¶
type CreateSpec struct {
History []Message
ModelPrefs *mcp.ModelPreferences
Temperature *float64
MaxTokens *int
StopSequences []string
Metadata map[string]any
IncludeContext string
}
CreateSpec is the compiled form of a CreateMessage invocation prior to translation into the wire request. It replaces the previous exported Options+Accumulate pattern while keeping the functional option surface. This lets the engine depend only on a stable value object without exposing intermediate accumulation APIs.
func (CreateSpec) Compile ¶
func (CreateSpec) Compile(opts ...Option) CreateSpec
Compile applies options to the receiver and returns a populated copy. Typical usage: spec := sampling.CreateSpec{}.Compile(opts...) The receiver is ignored other than its zero-ness; a new value is built.
type Image ¶
type Image struct {
Data []byte `json:"-"`
MIMEType string `json:"mimeType"`
Alt string `json:"alt,omitempty"`
Annotations *Annotations `json:"annotations,omitempty"`
}
Image content block (raw bytes encoded later at the transport adapter boundary).
func (Image) AsContentBlock ¶
func (i Image) AsContentBlock() mcp.ContentBlock
type Message ¶
Message represents a single role + single content block.
func AssistantText ¶
func NewMessage ¶
NewMessage constructs a Message with the given role and content.
func SystemText ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is the public handle for configuring a sampling CreateMessage request. It deliberately does not reference internal types to avoid import cycles.
func WithHistory ¶
WithHistory supplies prior conversation turns (excluding the current user message argument).
func WithIncludeContext ¶
WithIncludeContext requests the client include additional context (semantics defined by client impl).
func WithMaxTokens ¶
WithMaxTokens caps the number of tokens for the generated message.
func WithMetadata ¶
WithMetadata attaches arbitrary metadata (shallow copied).
func WithModelPreferences ¶
func WithModelPreferences(prefs *mcp.ModelPreferences) Option
WithModelPreferences supplies model names / capabilities preferences.
func WithStopSequences ¶
WithStopSequences replaces stop sequences.
func WithTemperature ¶
WithTemperature sets the sampling temperature.
type Text ¶
type Text struct {
Text string `json:"text"`
Annotations *Annotations `json:"annotations,omitempty"`
}
Text content block.
func (Text) AsContentBlock ¶
func (t Text) AsContentBlock() mcp.ContentBlock