You've probably run into this scenario yet:
You spin up a swarm of agents to solve a complex task—maybe researching a topic, auditing code, or scraping structured data. You expect a clean, unified result. Instead, you get three versions of the same sentence, four slightly different summaries of the same JSON blob, and enough redundant noise to blow your token budget out of the water.
The core issue isn't usually the individual LLM quality; it's the lack of coordination in the output layer. In multi-agent architectures, redundancy isn't just annoying—it's expensive and technically obstructive. If Agent A and Agent B both conclude that 'The database migration failed due to a timeout,' having both statements in your final context window doesn't add signal. It just adds entropy.
I’ve seen teams build massive amounts of custom Python glue code just to deduplicate these responses. They write regex patterns, they implement fuzzy string matching libraries, and they spend more time debugging their de-duplication logic than improving their actual agentic reasoning. It becomes another brittle piece of infrastructure that needs maintenance whenever the model's verbosity shifts.
We needed a way to treat output reconciliation as a standard primitive rather than an afterthought. That is exactly why we built the agent-output-deduplicator.
Beyond Simple String Matching
A naive approach to this problem is checking if string_a == string_b. But agents rarely produce identical strings even when they say the exact same thing. One might use a bullet point; another might use a full sentence.
To make this useful for real engineering workloads, you need math. Specifically, you need similarity measures that handle semantic overlap without requiring heavy embedding models for every single comparison.
The deduplicator leverages Jaccard similarity and n-gram overlap (specifically $n=2$ and $n=3$). By looking at sets of intersecting word sequences relative to the total unique sequences, it identifies clusters of information that represent the same underlying fact, regardless of minor syntactical variations.
How the Toolset Operates
The MCP server exposes three primary tools designed to fit into different stages of an agentic workflow:
get_similarity_score: This is your low-level probe. If you want to programmatically check if two specific pieces of evidence are effectively duplicates before deciding whether to merge them or discard one, this gives you that mathematical certainty.identify_duplicates: This handles the heavier lifting. Instead of comparing pairs manually, you feed it a whole collection of outputs—say, everything gathered during a long-running research loop—and it scans for clusters of redundant information. You can pass a custom threshold (between 0 and 1) here; higher means stricter adherence to uniqueness, lower allows for more aggressive grouping.resolve_canonical_selection: Once you know things are redundant, what do you actually do with them? Most people think they should just pick one randomly or take the shortest one. That’s bad practice because some agents are inherently better at certain tasks than others.
The resolution tool allows you to pick a 'canonical' version based on agent priority or execution order. If your 'Senior Architect Agent' produces an output similar to your 'Junior Intern Agent', this tool ensures the architect wins every time.
Why most devs skip this step (and why they shouldn't)
The reason most developers ignore redundancy is that managing state in agent workflows feels hard enough already. Adding a post-processing step feels like extra latency.
But consider the cost: increased latency in downstream LLM calls due to bloated contexts, increased costs per request, and most importantly—hallucination triggers caused by conflicting but nearly identical information appearing repeatedly in the prompt history.
losing control over what stays in your context window is how small automation scripts turn into unmanageable messses once scaled.
You can find the full implementation and documentation at https://vinkius.com/mcp/agent-output-deduplicator.
The goal isn't just to reduce tokens; it's to ensure that when your system finally presents an answer back to a human or makes a decision via function calling, that decision is based on distilled truth rather than repetitive echoes.
MCPs are the music of AI Agents. We built the catalog. Discover Vinkius MCP Catalog.
Top comments (0)