draft

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package draft implements the latest draft version of the MCP specification.

This package contains all the types and utilities specific to the current draft version of the protocol. This implementation may change frequently as the draft evolves.

Index

Constants

View Source
const Version = "draft"

Version is the specification version implemented by this package

Variables

View Source
var ErrResourceNotFound = fmt.Errorf("resource not found")

ErrResourceNotFound represents a resource not found error

View Source
var ErrResourcePathMismatch = fmt.Errorf("resource path does not match pattern")

ErrResourcePathMismatch represents a path that doesn't match the pattern

Functions

func ExtractPathParams

func ExtractPathParams(pattern string, path string) (map[string]string, error)

ExtractPathParams extracts path parameters from a concrete path based on a pattern

func MatchResourcePath

func MatchResourcePath(pattern string, path string) (bool, map[string]string)

MatchResourcePath determines if a path matches a given resource pattern and extracts parameters

func UnmarshalRequest

func UnmarshalRequest(msg BaseMessage) (interface{}, error)

UnmarshalRequest unmarshals a BaseMessage into a specific request type

func UnmarshalResponse

func UnmarshalResponse(msg BaseMessage) (interface{}, error)

UnmarshalResponse unmarshals a BaseMessage into a specific response type

func ValidatePromptDefinition

func ValidatePromptDefinition(promptDef PromptDefinition) error

ValidatePromptDefinition validates a prompt definition

func ValidateResourceDefinition

func ValidateResourceDefinition(resource ResourceDefinition) error

ValidateResourceDefinition validates a resource definition

func ValidateToolDefinition

func ValidateToolDefinition(tool ToolDefinition) error

ValidateToolDefinition validates a tool definition

Types

type BaseMessage

type BaseMessage struct {
	Type     MessageType     `json:"type"`
	Version  string          `json:"version"`
	ID       string          `json:"id,omitempty"`
	Content  json.RawMessage `json:"content"`
	Metadata json.RawMessage `json:"metadata,omitempty"`
	TraceID  string          `json:"trace_id,omitempty"` // New in draft version for request tracing
}

BaseMessage represents a base MCP protocol message

type CacheInfo

type CacheInfo struct {
	Hit      bool   `json:"hit"`
	Age      int    `json:"age,omitempty"` // Age in seconds
	Source   string `json:"source,omitempty"`
	CacheKey string `json:"cache_key,omitempty"`
}

CacheInfo provides information about cache hits/misses

type CacheOptions

type CacheOptions struct {
	Enabled   bool   `json:"enabled"`
	TTL       int    `json:"ttl,omitempty"`       // Time-to-live in seconds
	CacheKey  string `json:"cache_key,omitempty"` // Custom cache key
	FreshRead bool   `json:"fresh_read,omitempty"`
}

CacheOptions defines caching behavior for tool calls

type Content

type Content interface {
	GetType() string
}

Content represents a prompt content block

func RenderPrompt

func RenderPrompt(promptDef PromptDefinition, parameters map[string]interface{}) ([]Content, error)

RenderPrompt renders a prompt with the given parameters

type DataLifecycle

type DataLifecycle struct {
	RetentionPeriod string `json:"retention_period,omitempty"` // e.g., "30d", "1y", "forever"
	ArchiveAfter    string `json:"archive_after,omitempty"`
	DeleteAfter     string `json:"delete_after,omitempty"`
	Immutable       bool   `json:"immutable,omitempty"`
	Versioning      bool   `json:"versioning,omitempty"`
}

DataLifecycle represents the lifecycle of resource data (new in draft)

type DeprecationInfo

type DeprecationInfo struct {
	Since       string `json:"since,omitempty"`        // Version or date when deprecated
	RemovalDate string `json:"removal_date,omitempty"` // When it will be removed
	Alternative string `json:"alternative,omitempty"`  // Recommended alternative
	Message     string `json:"message,omitempty"`      // Deprecation message
}

DeprecationInfo represents deprecation information for a tool (new in draft)

type ErrInvalidPromptDefinition

type ErrInvalidPromptDefinition string

ErrInvalidPromptDefinition represents an error for an invalid prompt definition

func (ErrInvalidPromptDefinition) Error

type ErrInvalidResourceDefinition

type ErrInvalidResourceDefinition string

ErrInvalidResourceDefinition represents an error for an invalid resource definition

func (ErrInvalidResourceDefinition) Error

type ErrInvalidToolDefinition

type ErrInvalidToolDefinition string

ErrInvalidToolDefinition represents an error for an invalid tool definition

func (ErrInvalidToolDefinition) Error

func (e ErrInvalidToolDefinition) Error() string

type ErrorCode

type ErrorCode string

ErrorCode defines the type of error

const (
	ErrorCodeInvalidRequest      ErrorCode = "invalid_request"
	ErrorCodeInvalidArguments    ErrorCode = "invalid_arguments"
	ErrorCodeToolNotFound        ErrorCode = "tool_not_found"
	ErrorCodeResourceNotFound    ErrorCode = "resource_not_found"
	ErrorCodePromptNotFound      ErrorCode = "prompt_not_found"
	ErrorCodeStreamNotFound      ErrorCode = "stream_not_found"
	ErrorCodeStreamUnavailable   ErrorCode = "stream_unavailable"
	ErrorCodeInternalServerError ErrorCode = "internal_server_error"
	ErrorCodeSubscriptionFailed  ErrorCode = "subscription_failed" // New in draft
	ErrorCodePermissionDenied    ErrorCode = "permission_denied"   // New in draft
	ErrorCodeRateLimitExceeded   ErrorCode = "rate_limit_exceeded" // New in draft
)

Error codes

type ErrorDetails

type ErrorDetails struct {
	RetryAfter    int                    `json:"retry_after,omitempty"`   // Seconds to wait before retry
	Field         string                 `json:"field,omitempty"`         // Field that caused the error
	Suggestion    string                 `json:"suggestion,omitempty"`    // Suggested fix
	Documentation string                 `json:"documentation,omitempty"` // Link to documentation
	Context       map[string]interface{} `json:"context,omitempty"`       // Additional error context
}

ErrorDetails provides additional error context (new in draft)

type ErrorResponse

type ErrorResponse struct {
	Code      ErrorCode     `json:"code"`
	Message   string        `json:"message"`
	RequestID string        `json:"request_id,omitempty"`
	Details   *ErrorDetails `json:"details,omitempty"` // New in draft version
}

ErrorResponse represents an MCP error message

func UnmarshalError

func UnmarshalError(msg BaseMessage) (*ErrorResponse, error)

UnmarshalError unmarshals a BaseMessage into an error response

type EventMessage

type EventMessage struct {
	Type      EventType       `json:"type"`
	Timestamp string          `json:"timestamp"`
	Source    string          `json:"source"`
	Content   json.RawMessage `json:"content"`
}

EventMessage represents an event message (new in draft)

func UnmarshalEvent

func UnmarshalEvent(msg BaseMessage) (*EventMessage, error)

UnmarshalEvent unmarshals a BaseMessage into an event message (new in draft)

type EventType

type EventType string

EventType defines the type of event (new in draft)

const (
	EventTypeToolExecution    EventType = "tool_execution"
	EventTypeResourceChange   EventType = "resource_change"
	EventTypeServerStatus     EventType = "server_status"
	EventTypeConnectionStatus EventType = "connection_status"
)

Event types

type ItemDefinition

type ItemDefinition struct {
	Type        string   `json:"type"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Streamable  bool     `json:"streamable,omitempty"`
	Cacheable   bool     `json:"cacheable,omitempty"`  // New in draft version
	Versioned   bool     `json:"versioned,omitempty"`  // New in draft version
	Tags        []string `json:"tags,omitempty"`       // New in draft version
	Category    string   `json:"category,omitempty"`   // New in draft version
	Updated     string   `json:"updated_at,omitempty"` // New in draft version
}

ItemDefinition represents an item in a list response

type ListRequest

type ListRequest struct {
	Type    string `json:"type"`
	Pattern string `json:"pattern,omitempty"` // New in draft version - glob pattern
	Filter  string `json:"filter,omitempty"`  // New in draft version - filter expression
}

ListRequest represents a list request

type ListResponse

type ListResponse struct {
	Items []ItemDefinition `json:"items"`
	Total int              `json:"total,omitempty"` // New in draft version - total items count
}

ListResponse represents a list response

type MessageType

type MessageType string

MessageType defines the type of MCP message

const (
	MessageTypeRequest  MessageType = "request"
	MessageTypeResponse MessageType = "response"
	MessageTypeError    MessageType = "error"
	MessageTypeEvent    MessageType = "event" // New in draft version
)

MCP message types

type PerformanceMetrics

type PerformanceMetrics struct {
	AvgLatency      int   `json:"avg_latency_ms,omitempty"`          // Average latency in milliseconds
	P95Latency      int   `json:"p95_latency_ms,omitempty"`          // 95th percentile latency in milliseconds
	MaxThroughput   int   `json:"max_throughput_qps,omitempty"`      // Maximum throughput in queries per second
	AvgResponseSize int64 `json:"avg_response_size_bytes,omitempty"` // New in draft
	CpuUsage        int   `json:"cpu_usage_pct,omitempty"`           // New in draft - CPU usage percentage
	MemoryUsage     int64 `json:"memory_usage_bytes,omitempty"`      // New in draft - Memory usage in bytes
}

PerformanceMetrics represents performance characteristics of a tool

type PromptContentResponse

type PromptContentResponse struct {
	Content []Content `json:"content"`
	Format  string    `json:"format,omitempty"` // New in draft version
}

PromptContentResponse represents a prompt content response

type PromptDefinition

type PromptDefinition struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Template    string          `json:"template"`
	Parameters  interface{}     `json:"parameters"`
	Metadata    interface{}     `json:"metadata,omitempty"`
	ContentType string          `json:"content_type,omitempty"` // New in draft - enables non-text templates
	Format      string          `json:"format,omitempty"`       // New in draft - "text", "markdown", "json", etc.
	Version     string          `json:"version,omitempty"`      // New in draft
	Deprecated  bool            `json:"deprecated,omitempty"`   // New in draft
	Category    string          `json:"category,omitempty"`     // New in draft
	Tags        []string        `json:"tags,omitempty"`         // New in draft
	Examples    []PromptExample `json:"examples,omitempty"`     // New in draft
}

PromptDefinition represents a prompt definition

type PromptExample

type PromptExample struct {
	Description string                 `json:"description"`
	Parameters  map[string]interface{} `json:"parameters"`
	Result      string                 `json:"result,omitempty"`
}

PromptExample represents an example prompt usage (new in draft)

type PromptMetadata

type PromptMetadata struct {
	Author      string   `json:"author,omitempty"`
	Version     string   `json:"version,omitempty"`
	Created     string   `json:"created,omitempty"`
	Modified    string   `json:"modified,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Category    string   `json:"category,omitempty"`
	License     string   `json:"license,omitempty"`
	Homepage    string   `json:"homepage,omitempty"`
	Repository  string   `json:"repository,omitempty"`
	InlineStyle bool     `json:"inline_style,omitempty"` // Whether styles should be inlined in the output
	MaxTokens   int      `json:"max_tokens,omitempty"`   // Recommended token limit
}

PromptMetadata represents metadata for a prompt (new in draft)

type PromptParameter

type PromptParameter struct {
	Name        string      `json:"name"`
	Type        string      `json:"type"` // "string", "number", "boolean", "array", "object"
	Description string      `json:"description,omitempty"`
	Required    bool        `json:"required,omitempty"`
	Default     interface{} `json:"default,omitempty"`
	Enum        []string    `json:"enum,omitempty"`   // Possible values
	Format      string      `json:"format,omitempty"` // Format hint (e.g., "date", "email", "uri")
}

PromptParameter represents a parameter for a prompt template (new in draft)

type PromptRenderRequest

type PromptRenderRequest struct {
	Name       string                 `json:"name"`
	Parameters map[string]interface{} `json:"parameters,omitempty"`
	Format     string                 `json:"format,omitempty"` // New in draft version (e.g., "text", "json", "markdown")
}

PromptRenderRequest represents a prompt render request

type PropertyDetail

type PropertyDetail struct {
	Type        string        `json:"type"`
	Description string        `json:"description,omitempty"`
	Enum        []interface{} `json:"enum,omitempty"`
	Format      string        `json:"format,omitempty"`
	Minimum     *float64      `json:"minimum,omitempty"`
	Maximum     *float64      `json:"maximum,omitempty"`
	MinLength   *int          `json:"minLength,omitempty"`
	MaxLength   *int          `json:"maxLength,omitempty"`
	Pattern     string        `json:"pattern,omitempty"`
	Default     interface{}   `json:"default,omitempty"`
	Examples    []interface{} `json:"examples,omitempty"`
	Deprecated  bool          `json:"deprecated,omitempty"`       // New in draft
	Sensitive   bool          `json:"sensitive,omitempty"`        // New in draft
	ReadOnly    bool          `json:"readOnly,omitempty"`         // New in draft
	WriteOnly   bool          `json:"writeOnly,omitempty"`        // New in draft
	ContentType string        `json:"contentMediaType,omitempty"` // New in draft - for binary/media data
}

PropertyDetail represents a JSON Schema property definition

type RequestMessage

type RequestMessage struct {
	Type     RequestType     `json:"type"`
	ID       string          `json:"id,omitempty"`
	Content  json.RawMessage `json:"content"`
	Metadata json.RawMessage `json:"metadata,omitempty"`
}

RequestMessage represents an MCP request message

type RequestType

type RequestType string

RequestType defines the type of request

const (
	RequestTypeToolCall      RequestType = "tool_call"
	RequestTypeResourceFetch RequestType = "resource_fetch"
	RequestTypePromptRender  RequestType = "prompt_render"
	RequestTypeList          RequestType = "list"
	RequestTypeStream        RequestType = "stream"
	RequestTypeSubscribe     RequestType = "subscribe" // New in draft version
)

Request types

type ResourceContentResponse

type ResourceContentResponse struct {
	Content    interface{} `json:"content"`
	Version    string      `json:"version,omitempty"`    // New in draft version
	Timestamp  string      `json:"timestamp,omitempty"`  // New in draft version
	Compressed bool        `json:"compressed,omitempty"` // New in draft version
	Partial    bool        `json:"partial,omitempty"`    // New in draft version for range requests
}

ResourceContentResponse represents a resource content response

type ResourceCost

type ResourceCost struct {
	Type     string  `json:"type"`               // e.g., "credits", "tokens", "api_calls"
	Amount   float64 `json:"amount"`             // Estimated cost amount
	Currency string  `json:"currency,omitempty"` // Optional currency code
	Free     bool    `json:"free,omitempty"`     // New in draft - indicates free usage
	Tier     string  `json:"tier,omitempty"`     // New in draft - pricing tier
}

ResourceCost represents the cost of using a resource or tool

type ResourceDefinition

type ResourceDefinition struct {
	Type        string      `json:"type"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	PathPattern string      `json:"path_pattern"`
	Metadata    interface{} `json:"metadata,omitempty"`
	Versioned   bool        `json:"versioned,omitempty"`
	Streamable  bool        `json:"streamable,omitempty"`
	Cacheable   bool        `json:"cacheable,omitempty"`  // New in draft
	Deprecated  bool        `json:"deprecated,omitempty"` // New in draft
	Category    string      `json:"category,omitempty"`   // New in draft
	Tags        []string    `json:"tags,omitempty"`       // New in draft
	Format      string      `json:"format,omitempty"`     // New in draft - e.g., "text", "json", "binary"
	Schema      interface{} `json:"schema,omitempty"`     // New in draft - for data validation
	Permission  string      `json:"permission,omitempty"` // New in draft - "read", "write", "read-write"
}

ResourceDefinition represents an MCP resource definition

type ResourceFetchRequest

type ResourceFetchRequest struct {
	Path        string         `json:"path"`
	Version     string         `json:"version,omitempty"`     // New in draft version
	Compression string         `json:"compression,omitempty"` // New in draft version
	Range       *ResourceRange `json:"range,omitempty"`       // New in draft version
}

ResourceFetchRequest represents a resource fetch request

type ResourceMatch

type ResourceMatch struct {
	Definition ResourceDefinition
	Params     map[string]string
}

ResourceMatch represents a successful resource pattern match

func FindMatchingResource

func FindMatchingResource(resources []ResourceDefinition, path string) (*ResourceMatch, error)

FindMatchingResource finds the first resource definition that matches a given path

type ResourceMetadata

type ResourceMetadata struct {
	Author         string                 `json:"author,omitempty"`
	Version        string                 `json:"version,omitempty"`
	Created        string                 `json:"created,omitempty"`
	Modified       string                 `json:"modified,omitempty"`
	Tags           []string               `json:"tags,omitempty"`
	Category       string                 `json:"category,omitempty"`
	ContentType    string                 `json:"content_type,omitempty"`
	Encoding       string                 `json:"encoding,omitempty"`
	MaxSize        int64                  `json:"max_size,omitempty"`
	Cost           *ResourceCost          `json:"cost,omitempty"`
	Security       *SecurityInfo          `json:"security,omitempty"`
	Support        *SupportInfo           `json:"support,omitempty"`
	DataLifecycle  *DataLifecycle         `json:"data_lifecycle,omitempty"`
	CustomMetadata map[string]interface{} `json:"custom_metadata,omitempty"`
}

ResourceMetadata represents metadata for a resource (new in draft)

type ResourceRange

type ResourceRange struct {
	Start int64 `json:"start,omitempty"`
	End   int64 `json:"end,omitempty"`
}

ResourceRange specifies a range of data to fetch from a resource

type ResponseMessage

type ResponseMessage struct {
	Type     ResponseType    `json:"type"`
	ID       string          `json:"id,omitempty"`
	Content  json.RawMessage `json:"content"`
	Metadata json.RawMessage `json:"metadata,omitempty"`
}

ResponseMessage represents an MCP response message

type ResponseType

type ResponseType string

ResponseType defines the type of response

const (
	ResponseTypeToolResult      ResponseType = "tool_result"
	ResponseTypeResourceContent ResponseType = "resource_content"
	ResponseTypePromptContent   ResponseType = "prompt_content"
	ResponseTypeList            ResponseType = "list"
	ResponseTypeStreamUpdate    ResponseType = "stream_update"
	ResponseTypeSubscription    ResponseType = "subscription" // New in draft version
)

Response types

type RichContent

type RichContent struct {
	Type    string                 `json:"type"`
	Content interface{}            `json:"content"`
	Formats map[string]interface{} `json:"formats,omitempty"` // Different format representations
}

RichContent represents a rich content block with multiple formats (new in draft)

func (RichContent) GetType

func (rc RichContent) GetType() string

GetType returns the content type

type SecurityInfo

type SecurityInfo struct {
	RequiresAuth   bool     `json:"requires_auth"`
	AuthMethods    []string `json:"auth_methods,omitempty"`
	DataEncrypted  bool     `json:"data_encrypted,omitempty"`
	DataResidency  []string `json:"data_residency,omitempty"`
	Certifications []string `json:"certifications,omitempty"` // e.g., "SOC2", "GDPR"
	DataRetention  string   `json:"data_retention,omitempty"` // e.g., "30d", "90d", "forever"
	PrivacyPolicy  string   `json:"privacy_policy,omitempty"`
	TermsOfService string   `json:"terms_of_service,omitempty"`
}

SecurityInfo represents security information for a tool (new in draft)

type StreamRequest

type StreamRequest struct {
	ID    string `json:"id"`
	State string `json:"state"` // start, stop, pause, resume
}

StreamRequest represents a stream request

type StreamUpdateResponse

type StreamUpdateResponse struct {
	ID      string      `json:"id"`
	State   string      `json:"state"` // running, paused, stopped, completed, error
	Update  interface{} `json:"update,omitempty"`
	Partial bool        `json:"partial,omitempty"` // New in draft version
}

StreamUpdateResponse represents a stream update response

type StructuredContent

type StructuredContent struct {
	Type    string      `json:"type"`
	Content interface{} `json:"content"`
}

StructuredContent represents a structured content block

func (StructuredContent) GetType

func (sc StructuredContent) GetType() string

GetType returns the content type

type SubscribeRequest

type SubscribeRequest struct {
	EventType string                 `json:"event_type"`
	Filter    map[string]interface{} `json:"filter,omitempty"`
}

SubscribeRequest represents an event subscription request (new in draft)

type SubscriptionResponse

type SubscriptionResponse struct {
	SubscriptionID string `json:"subscription_id"`
	EventType      string `json:"event_type"`
	Status         string `json:"status"`
}

SubscriptionResponse represents a subscription response (new in draft)

type SupportInfo

type SupportInfo struct {
	Email     string   `json:"email,omitempty"`
	URL       string   `json:"url,omitempty"`
	Docs      string   `json:"docs,omitempty"`
	Status    string   `json:"status,omitempty"` // "stable", "beta", "alpha", "experimental"
	Languages []string `json:"languages,omitempty"`
}

SupportInfo represents support information for a tool (new in draft)

type TextContent

type TextContent struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

TextContent represents a text content block

func (TextContent) GetType

func (tc TextContent) GetType() string

GetType returns the content type

type ToolCallRequest

type ToolCallRequest struct {
	Name      string          `json:"name"`
	Arguments json.RawMessage `json:"arguments"`
	Stream    bool            `json:"stream,omitempty"`
	Cache     *CacheOptions   `json:"cache,omitempty"` // New in draft version
}

ToolCallRequest represents a tool call request

type ToolDefinition

type ToolDefinition struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Schema      json.RawMessage `json:"schema"`
	Metadata    ToolMetadata    `json:"metadata,omitempty"`
	Streamable  bool            `json:"streamable,omitempty"`
	Cacheable   bool            `json:"cacheable,omitempty"`  // New in draft
	Versioned   bool            `json:"versioned,omitempty"`  // New in draft
	Deprecated  bool            `json:"deprecated,omitempty"` // New in draft
	Category    string          `json:"category,omitempty"`   // New in draft
	Tags        []string        `json:"tags,omitempty"`       // New in draft
}

ToolDefinition represents an MCP tool definition

type ToolExample

type ToolExample struct {
	Description string                 `json:"description"`
	Arguments   map[string]interface{} `json:"arguments"` // Example input arguments
	Result      interface{}            `json:"result,omitempty"`
}

ToolExample represents an example of tool usage (new in draft)

type ToolInputSchema

type ToolInputSchema struct {
	Type                 string                    `json:"type"`
	Properties           map[string]PropertyDetail `json:"properties"`
	Required             []string                  `json:"required"`
	AdditionalProperties *bool                     `json:"additionalProperties,omitempty"` // New in draft
	OneOf                []json.RawMessage         `json:"oneOf,omitempty"`                // New in draft
	AnyOf                []json.RawMessage         `json:"anyOf,omitempty"`                // New in draft
	AllOf                []json.RawMessage         `json:"allOf,omitempty"`                // New in draft
}

ToolInputSchema represents a JSON Schema for tool input

type ToolMetadata

type ToolMetadata struct {
	Version     string                 `json:"version,omitempty"`
	Author      string                 `json:"author,omitempty"`
	Tags        []string               `json:"tags,omitempty"`
	Category    string                 `json:"category,omitempty"`
	Properties  map[string]interface{} `json:"properties,omitempty"`
	Annotations map[string]interface{} `json:"annotations,omitempty"`
	Cost        *ResourceCost          `json:"cost,omitempty"`
	Performance *PerformanceMetrics    `json:"performance,omitempty"`
	Security    *SecurityInfo          `json:"security,omitempty"`   // New in draft
	Support     *SupportInfo           `json:"support,omitempty"`    // New in draft
	License     string                 `json:"license,omitempty"`    // New in draft
	Homepage    string                 `json:"homepage,omitempty"`   // New in draft
	Repository  string                 `json:"repository,omitempty"` // New in draft
	Deprecated  *DeprecationInfo       `json:"deprecated,omitempty"` // New in draft
	Examples    []ToolExample          `json:"examples,omitempty"`   // New in draft
}

ToolMetadata represents metadata for a tool

type ToolResultResponse

type ToolResultResponse struct {
	Result     interface{}     `json:"result"`
	Streaming  bool            `json:"streaming,omitempty"`
	CacheInfo  *CacheInfo      `json:"cache_info,omitempty"` // New in draft version
	Statistics *ToolStatistics `json:"statistics,omitempty"` // New in draft version
}

ToolResultResponse represents a tool result response

type ToolStatistics

type ToolStatistics struct {
	ExecutionTime   int64  `json:"execution_time_ms"`
	MemoryUsed      int64  `json:"memory_used_bytes,omitempty"`
	CPUTime         int64  `json:"cpu_time_ms,omitempty"`
	InvocationCount int    `json:"invocation_count,omitempty"`
	Status          string `json:"status,omitempty"`
}

ToolStatistics provides execution statistics

Jump to

Keyboard shortcuts

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