Skip to content

feat: open content interface for users to freely implement #494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions mcp/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
"maps"
"strconv"

"github.com/yosida95/uritemplate/v3"
"net/http"

"github.com/yosida95/uritemplate/v3"
)

type MCPMethod string
Expand Down Expand Up @@ -859,7 +860,7 @@ type Annotated struct {
}

type Content interface {
isContent()
IsContent()
}

// TextContent represents text provided to or from an LLM.
Expand All @@ -871,7 +872,7 @@ type TextContent struct {
Text string `json:"text"`
}

func (TextContent) isContent() {}
func (TextContent) IsContent() {}

// ImageContent represents an image provided to or from an LLM.
// It must have Type set to "image".
Expand All @@ -884,7 +885,7 @@ type ImageContent struct {
MIMEType string `json:"mimeType"`
}

func (ImageContent) isContent() {}
func (ImageContent) IsContent() {}

// AudioContent represents the contents of audio, embedded into a prompt or tool call result.
// It must have Type set to "audio".
Expand All @@ -897,7 +898,7 @@ type AudioContent struct {
MIMEType string `json:"mimeType"`
}

func (AudioContent) isContent() {}
func (AudioContent) IsContent() {}

// ResourceLink represents a link to a resource that the client can access.
type ResourceLink struct {
Expand All @@ -913,7 +914,7 @@ type ResourceLink struct {
MIMEType string `json:"mimeType"`
}

func (ResourceLink) isContent() {}
func (ResourceLink) IsContent() {}

// EmbeddedResource represents the contents of a resource, embedded into a prompt or tool call result.
//
Expand All @@ -925,7 +926,7 @@ type EmbeddedResource struct {
Resource ResourceContents `json:"resource"`
}

func (EmbeddedResource) isContent() {}
func (EmbeddedResource) IsContent() {}

// ModelPreferences represents the server's preferences for model selection,
// requested of the client during sampling.
Expand Down