Repository: confident-ai/deepeval
Issue: ZeroDivisionError in `MultiTurnMCPUseMetric` when no tasks are generated
Root cause: Validation Gap

**Describe the bug**
`MultiTurnMCPUseMetric` raises a `ZeroDivisionError` when called with a `ConversationalTestCase` that produces no tasks.

This happens because `_calculate_score()` performs division by `len(tool_accuracy_score)` and `len(args_accuracy_score)` without guarding for the case where either list is empty.

In practice, this occurs when the test case has too few turns and `_get_tasks()` returns an empty list.

**To Reproduce**
Run the following minimal script:

```python
from deepeval.metrics.mcp.multi_turn_mcp_use_metric import MultiTurnMCPUseMetric
from deepeval.test_case import ConversationalTestCase
from deepeval.test_case.mcp import MCPServer

def make_tc():
    # minimal valid conversational test case with non-empty mcp_servers
    return ConversationalTestCase(
        turns=[
            {"role": "user", "content": "Hi"},
            {"role": "assistant", "content": "Hello"},
        ],
        mcp_servers=[MCPServer(server_name="dummy")]
    )

def run(async_mode):
    metric = MultiTurnMCPUseMetric(async_mode=async_mode)
    tc = make_tc()
    print(f"\n**async_mode={async_mode}**")
    try:
        metric.measure(tc, _show_indicator=False)
    except Exception as e:
        print("Raised:", repr(e))

if __name__ == "__main__":
    run(async_mode=False)  # sync path -> ZeroDivisionError
    run(async_mode=True)   # async path -> ZeroDivisionError
```

**Observed behavior:**
Both sync and async paths raise:

```
ZeroDivisionError: division by zero
```

---

**Expected behavior**
When there are no tasks or scores to evaluate, the metric should handle this gracefully—either returning a default score (e.g., `1.0` or `0.0`) or raising a more descriptive error message instead of a `ZeroDivisionError`.

---

**Screenshots**
N/A

**Desktop (please complete the following information):**
 - OS: purisim ( Linux )
 - Browser: N/A
 - Version: 3.6.2

**Additional context**
* The issue originates in `_calculate_score()` within `deepeval/metrics/mcp/multi_turn_mcp_use_metric.py`:

  ```python
  tool_score = sum(score.score for score in tool_accuracy_score) / len(tool_accuracy_score)
  args_score = sum(score.score for score in args_accuracy_score) / len(args_accuracy_score)
  ```
* Guarding against empty lists would prevent this:

  ```python
  if not tool_accuracy_score or not args_accuracy_score:
      return 1.0  # or 0.0, depending on desired semantics
  ```


@Stu-ops I would like to assign this issue to you. Please let me know if you decide not to complete it and I will open it for others. I just need to you post a comment back or GitHub won't let me assign the issue to you.

> [@Stu-ops](https://github.com/Stu-ops) I would like to assign this issue to you. Please let me know if you decide not to complete it and I will open it for others. I just need to you post a comment back or GitHub won't let me assign the issue to you.

@trevor-cai can you assign this issue? I’d like to work on fixing.

@trevor-cai yes assign this to me , actually i won't see the message due to night in our country (it may be different time zones )

@trevor-cai @penguine-ip
 
There is the same issue with MCPTaskCompletionMetric. May it be fixed in the same way, too?

The issue originates in `_calculate_score()` within `deepeval/metrics/mcp/mcp_task_completion.py`.

```
total_score = sum(score.score for score in scores)
return total_score / len(scores)
```
Guarding against empty lists would prevent this:

```
if not scores:
    return 1.0  # or 0.0, depending on desired semantics
```