# json-state-diff-generator AI Agent Connect

> json-state-diff-generator MCP compares two JSON objects to find every structural and value change. It's built for developers debugging agentic workflows like LangGraph or CrewAI, making it easy to see exactly how an agent's state evolved between steps by identifying added, removed, or modified keys.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_L6lDkKzxN23FQk9UypQ4x0Umoj4kBdGOoKDVwmEm/ai-agent-connect
- **Tags:** json, diff, langgraph, crewai, debugging, state-management

## Description

Debugging an autonomous agent is a nightmare when you're staring at massive, nested JSON blobs and trying to figure out why a specific variable changed or disappeared. You spend half your time manually scanning logs or writing custom scripts just to see what actually happened during a run. This MCP changes that by giving your AI client the ability to perform deep, recursive comparisons between any two states. Instead of guessing, you can pinpoint the exact moment a key was added or a value was modified. It handles the heavy lifting of traversing complex, deeply nested structures, turning messy data into clear, actionable insights. Whether you're tracking state transitions in a multi-agent system or just verifying data integrity after a tool call, you get a precise map of the changes. Since this is part of the Vinkius catalog, you can connect it to your preferred environment and immediately start inspecting state drifts without setting up local comparison logic. It turns the 

## Tools

### compare_json_states
Performs a deep, recursive comparison between two JSON objects to identify all structural and value changes

### flatten_diff_path
Converts complex, nested diff paths into human-readable dot-notation strings

### get_diff_summary
Provides a high-level statistical overview of the differences found between two states

## Prompt Examples

**Prompt:** 
```
Compare these two JSON states: {"a": 1, "b": 2} and {"a": 1, "b": 3, "c": 4}
```

**Response:** 
```
{"diff": {"b": {"old_value": 2, "new_value": 3}, "c": {"added": true}}, "changesCount": 2, "isUnchanged": false}
```

**Prompt:** 
```
Get a summary of the changes for this diff result: {"added": 1, "removed": 0, "modified": 1}
```

**Response:** 
```
{"totalChanges": 2, "changeTypeCounts": {"added": 1, "removed": 0, "modified": 1}}
```

**Prompt:** 
```
Convert this diff into a list of paths: {"user": {"profile": {"id": "changed"}}}
```

**Response:** 
```
{"paths": ["user.profile.id"]}
```

## Frequently Asked Questions

**How does the tool handle array comparisons?**
The tool performs a strict positional comparison. Elements are evaluated based on their exact index; for example, the element at index 0 in the previous state is compared only to the element at index 0 in the current state.

**What is the difference between added and modified keys?**
Added keys are elements present in the current state that were entirely absent in the previous state. Modified keys are elements that exist in both states but contain different values.

**Can I use this to debug LangGraph states?**
Yes, the `compare_json_states` tool is specifically designed to identify how a data structure has evolved, making it ideal for tracking state changes in LangGraph and CrewAI workflows.