From f25dd6d9e6f3aea13f1b7465951fa8d2aae3109c Mon Sep 17 00:00:00 2001 From: PratikDhanave Date: Fri, 24 Jul 2026 08:47:15 +0530 Subject: [PATCH 1/3] Document message.Message.String and Usage accessors Add godoc to the exported String and Usage methods, matching their documented neighbors NewText and Clone. String satisfies fmt.Stringer; both delegate to the already-documented Contents.Text and Contents.Usage helpers, so the comments make the Message-level API self-describing in go doc. --- message/message.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/message/message.go b/message/message.go index aad9ca73..9194ae37 100644 --- a/message/message.go +++ b/message/message.go @@ -61,10 +61,14 @@ func NewText(text string) *Message { return New(&TextContent{Text: text}) } +// String implements fmt.Stringer, returning the concatenated text of all +// TextContent in the message (delegating to Contents.Text). func (m *Message) String() string { return m.Contents.Text() } +// Usage returns the aggregated UsageDetails carried by the message's +// UsageContent (delegating to Contents.Usage). func (m *Message) Usage() UsageDetails { return m.Contents.Usage() } From 6a0274bd6ba281f98db1a8cb56fd4d57b71c10a5 Mon Sep 17 00:00:00 2001 From: PratikDhanave Date: Fri, 24 Jul 2026 14:51:31 +0530 Subject: [PATCH 2/3] Fix stale Contents.Text godoc to describe concatenation --- message/content.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/message/content.go b/message/content.go index e535c292..d6ac80a3 100644 --- a/message/content.go +++ b/message/content.go @@ -90,7 +90,8 @@ func unmarshalRawContent(data json.RawMessage) (Content, error) { return &raw, nil } -// Text returns the first text content in the response, or empty string. +// Text returns the concatenated text of all TextContent in the response, +// or empty string if there is none. func (cs Contents) Text() string { var sb strings.Builder for _, c := range cs { From 5b3ed5ff04096af950aad4fb45f76b66ee0f06e9 Mon Sep 17 00:00:00 2001 From: PratikDhanave Date: Tue, 4 Aug 2026 11:38:11 +0530 Subject: [PATCH 3/3] Remove duplicate Contents.Text godoc after upstream documented it --- message/content.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/message/content.go b/message/content.go index 25e27413..712f866b 100644 --- a/message/content.go +++ b/message/content.go @@ -91,8 +91,6 @@ func unmarshalRawContent(data json.RawMessage) (Content, error) { return &raw, nil } -// Text returns the concatenated text of all TextContent in the response, -// or empty string if there is none. // Text returns the concatenation of the Text of all [TextContent] items in the // Contents, or the empty string if there are none. func (cs Contents) Text() string {