ExtractToolCalls returns all tool call parts as content blocks.
(parts []fantasy.MessagePart)
| 632 | |
| 633 | // ExtractToolCalls returns all tool call parts as content blocks. |
| 634 | func ExtractToolCalls(parts []fantasy.MessagePart) []fantasy.ToolCallContent { |
| 635 | toolCalls := make([]fantasy.ToolCallContent, 0, len(parts)) |
| 636 | for _, part := range parts { |
| 637 | toolCall, ok := safeAsToolCallPart(part) |
| 638 | if !ok { |
| 639 | continue |
| 640 | } |
| 641 | toolCalls = append(toolCalls, fantasy.ToolCallContent{ |
| 642 | ToolCallID: toolCall.ToolCallID, |
| 643 | ToolName: toolCall.ToolName, |
| 644 | Input: toolCall.Input, |
| 645 | ProviderExecuted: toolCall.ProviderExecuted, |
| 646 | }) |
| 647 | } |
| 648 | return toolCalls |
| 649 | } |
| 650 | |
| 651 | // MarshalContent encodes message content blocks in legacy fantasy |
| 652 | // envelope format. Retained for backward-compatible test fixtures |