Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTextContent ¶
ExtractTextContent returns the concatenated text from text content items in a raw MCP tool result map. Content items with a missing "type" are treated as text items for compatibility with older callers and tests.
func IsErrorResult ¶ added in v0.4.6
IsErrorResult reports whether a raw MCP tool result map is marked as an error result.
func NormalizeContentItems ¶ added in v0.3.26
NormalizeContentItems normalizes an MCP "content" field into a slice of item maps. It supports both []interface{} values produced by json.Unmarshal and []map[string]interface{} values produced by helper constructors.
Semantics: lenient — non-map items in []interface{} are silently skipped. This contrasts with the strict path in internal/mcp/tool_result.go (convertMapToCallToolResult) which returns an error for non-map content items. Use this function in contexts where partial results are acceptable (e.g. DIFC filtering, rate-limit detection); use the strict path when producing SDK-valid CallToolResult values where malformed items must surface as errors.
Both normalization paths handle the same wire format variations:
- []interface{} — produced by json.Unmarshal on the raw backend response
- []map[string]interface{} — produced by helper constructors (e.g. BuildMCPTextResponse)
When adding new content type variants, update both paths consistently.
Types ¶
This section is empty.