# Dialogue Tree Complexity Analyzer AI Agent Connect

> Analyze structural complexity, branching, and localization costs of dialogue trees.

## Overview
- **Category:** data-analysis
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_RjTyplSU0O5wzDC43VU2GyW7mHhlHdpDBSkggIh7/ai-agent-connect
- **Tags:** dialogue, branching, narrative, complexity, localization

## Description

This MCP server provides deterministic tools for evaluating the structural health and narrative density of branching dialogue systems. Use `analyze_tree_complexity` to calculate branching factors, tree depth, and estimated localization costs. Use `get_node_statistics` to examine word counts and conditional node ratios, or `validate_tree_integrity` to ensure your dialogue meets minimum ending requirements. It is designed for narrative designers to manage complexity and budget.

## Tools

### analyze_tree_complexity


### get_node_statistics


### validate_tree_integrity


## Prompt Examples

**Prompt:** 
```
Analyze this dialogue tree: [{'id': 'n1', 'text_length': 50, 'choices_count': 2, 'conditions_count': 0, 'depth': 0}, {'id': 'n2', 'text_length': 30, 'choices_count': 0, 'conditions_count': 0, 'depth': 1}]. Set max depth to 5, branching threshold to 2, and cost per word to 0.05.
```

**Response:** 
```
{"totalNodes": 2, "totalBranches": 2, "treeDepth": 1, "uniqueEndings": 1, "branchingFactor": 1.0, "contentReplayability": 0.5, "localizationCostEstimate": 4.0}
```

**Prompt:** 
```
What are the statistics for these nodes: [{'id': '1', 'text_length': 100, 'choices_count': 1, 'conditions_count': 1, 'depth': 0}, {'id': '2', 'text_length': 50, 'choices_count': 0, 'conditions_count': 0, 'depth': 1}]?
```

**Response:** 
```
{"totalWordCount": 150, "averageChoicesPerNode": 0.5, "conditionalNodeRatio": 0.5}
```

**Prompt:** 
```
Check if this tree has at least 2 endings: [{'id': 'start', 'text_length': 20, 'choices_count': 2, 'conditions_count': 0, 'depth': 0}, {'id': 'end1', 'text_length': 10, 'choices_count': 0, 'conditions_count': 0, 'depth': 1}, {'id': 'end2', 'text_length': 10, 'choices_count': 0, 'conditions_count': 0, 'depth': 1}]
```

**Response:** 
```
{"isIntegrityPassed": true, "missingEndingsCount": 0}
```

## Frequently Asked Questions

**How do I calculate localization costs?**
You can use the `analyze_tree_complexity` tool by providing a `costPerWord` value. The tool will multiply the total word count of all nodes by this value.

**What is a 'High Branching' flag?**
A 'HIGH_BRANCHING' flag is triggered if the branching factor (total branches divided by total nodes) exceeds the threshold you set in `analyze_tree_complexity`.

**Can I check if my story has enough endings?**
Yes, use the `validate_tree_integrity` tool and specify the `requiredMinEndings` parameter to check if your terminal nodes meet your design goals.
