Skip to content

Commit 363003d

Browse files
[mcp] document exported helper functions
1 parent e395444 commit 363003d

2 files changed

Lines changed: 10 additions & 16 deletions

File tree

mcp/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ type Named interface {
17811781
GetName() string
17821782
}
17831783

1784-
// MarshalJSON implements custom JSON marshaling for Content interface
1784+
// MarshalContent marshals MCP content as JSON.
17851785
func MarshalContent(content Content) ([]byte, error) {
17861786
return json.Marshal(content)
17871787
}

mcp/utils.go

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ func NewJSONRPCError(
167167
}
168168
}
169169

170-
// NewProgressNotification
171-
// Helper function for creating a progress notification
170+
// NewProgressNotification creates a progress notification.
172171
func NewProgressNotification(
173172
token ProgressToken,
174173
progress float64,
@@ -198,8 +197,7 @@ func NewProgressNotification(
198197
return notification
199198
}
200199

201-
// NewLoggingMessageNotification
202-
// Helper function for creating a logging message notification
200+
// NewLoggingMessageNotification creates a logging message notification.
203201
func NewLoggingMessageNotification(
204202
level LoggingLevel,
205203
logger string,
@@ -221,26 +219,23 @@ func NewLoggingMessageNotification(
221219
}
222220
}
223221

224-
// NewPromptMessage
225-
// Helper function to create a new PromptMessage
222+
// NewPromptMessage creates a prompt message.
226223
func NewPromptMessage(role Role, content Content) PromptMessage {
227224
return PromptMessage{
228225
Role: role,
229226
Content: content,
230227
}
231228
}
232229

233-
// NewTextContent
234-
// Helper function to create a new TextContent
230+
// NewTextContent creates text content.
235231
func NewTextContent(text string) TextContent {
236232
return TextContent{
237233
Type: ContentTypeText,
238234
Text: text,
239235
}
240236
}
241237

242-
// NewImageContent
243-
// Helper function to create a new ImageContent
238+
// NewImageContent creates image content.
244239
func NewImageContent(data, mimeType string) ImageContent {
245240
return ImageContent{
246241
Type: ContentTypeImage,
@@ -249,7 +244,7 @@ func NewImageContent(data, mimeType string) ImageContent {
249244
}
250245
}
251246

252-
// Helper function to create a new AudioContent
247+
// NewAudioContent creates audio content.
253248
func NewAudioContent(data, mimeType string) AudioContent {
254249
return AudioContent{
255250
Type: ContentTypeAudio,
@@ -258,7 +253,7 @@ func NewAudioContent(data, mimeType string) AudioContent {
258253
}
259254
}
260255

261-
// Helper function to create a new ResourceLink
256+
// NewResourceLink creates a resource link.
262257
func NewResourceLink(uri, name, description, mimeType string) ResourceLink {
263258
return ResourceLink{
264259
Type: ContentTypeLink,
@@ -269,7 +264,7 @@ func NewResourceLink(uri, name, description, mimeType string) ResourceLink {
269264
}
270265
}
271266

272-
// Helper function to create a new EmbeddedResource
267+
// NewEmbeddedResource creates an embedded resource.
273268
func NewEmbeddedResource(resource ResourceContents) EmbeddedResource {
274269
return EmbeddedResource{
275270
Type: ContentTypeResource,
@@ -551,8 +546,7 @@ func NewInitializeResult(
551546
}
552547
}
553548

554-
// FormatNumberResult
555-
// Helper for formatting numbers in tool results
549+
// FormatNumberResult formats a number as a tool result.
556550
func FormatNumberResult(value float64) *CallToolResult {
557551
return NewToolResultText(fmt.Sprintf("%.2f", value))
558552
}

0 commit comments

Comments
 (0)