chore: optimize mcp (#4866)

This commit is contained in:
Kevin Wan
2025-05-17 12:28:06 +08:00
committed by GitHub
parent 91ab1f6d2b
commit 292a8302a1
2 changed files with 3 additions and 8 deletions

View File

@@ -809,7 +809,7 @@ func (s *sseMcpServer) processResourcesRead(ctx context.Context, client *mcpClie
} }
// Ensure MimeType is set if available from the resource definition // Ensure MimeType is set if available from the resource definition
if len(content.MimeType) == 0 && resource.MimeType != "" { if len(content.MimeType) == 0 && len(resource.MimeType) > 0 {
content.MimeType = resource.MimeType content.MimeType = resource.MimeType
} }

View File

@@ -116,13 +116,8 @@ type FileContent struct {
// EmbeddedResource represents a resource embedded in a message // EmbeddedResource represents a resource embedded in a message
type EmbeddedResource struct { type EmbeddedResource struct {
Type string `json:"type"` // Always "resource" Type string `json:"type"` // Always "resource"
Resource struct { Resource ResourceContent `json:"resource"` // The resource data
URI string `json:"uri"` // Resource URI
MimeType string `json:"mimeType"` // MIME type of the resource
Text string `json:"text,omitempty"` // Text content (if available)
Blob string `json:"blob,omitempty"` // Base64 encoded blob data (if available)
} `json:"resource"` // The resource data
} }
// Annotations provides additional metadata for content // Annotations provides additional metadata for content