mcpToolUses property

List<AnthropicMCPToolUse>? get mcpToolUses

Get Anthropic MCP tool use blocks from the response

Implementation

List<AnthropicMCPToolUse>? get mcpToolUses {
  final content = _rawResponse['content'] as List?;
  if (content == null || content.isEmpty) return null;

  final mcpToolUseBlocks =
      content.where((block) => block['type'] == 'mcp_tool_use').toList();

  if (mcpToolUseBlocks.isEmpty) return null;

  return mcpToolUseBlocks
      .map((block) => AnthropicMCPToolUse.fromJson(block))
      .toList();
}