Skip to main content
Glama

Reconcile many-to-many

reconcile_many_to_many
Read-onlyIdempotent

Matches statement deposits to disjoint invoice combinations using subset-sum integer linear programming, resolving consolidated or split remittances left unmatched by simpler one-to-one matching.

Instructions

Match statement deposits to disjoint subsets of invoices via subset-sum ILP.

Purpose: Solves bounded subset-sum as an integer linear program (ILP) to pair statement deposits against matching combinations of outstanding invoice records.

When to use:

  • When customer deposits consolidate multiple invoices or split remittances.

  • When one-to-one or one-to-many heuristics leave unmatched aggregates.

When NOT to use:

  • Solves combinatorial subset-sum rather than standard 1:1 or 1:N reconciliation, where reconcile is faster.

  • Requires the optional ilp extra (pip install reconcile-mcp[ilp]).

Behavioral transparency: Deterministic ILP optimization; read-only and idempotent.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "statements": "<statements>",
      "invoices": "<invoices>"
    },
    "name": "reconcile_many_to_many"
  }
}

Input Schema

NameRequiredDescriptionDefault
invoicesYesList of canonical records. Each is an object with 'id' (string) and 'amount' (number) required, plus optional 'currency' (ISO 4217), 'date' (ISO-8601), 'counterparty' (name), 'reference' (remittance/end-to-end id).
statementsYesList of canonical records. Each is an object with 'id' (string) and 'amount' (number) required, plus optional 'currency' (ISO 4217), 'date' (ISO-8601), 'counterparty' (name), 'reference' (remittance/end-to-end id).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.0.5

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly, idempotent, and non-destructive, so the safety profile is covered; the description adds genuinely new context: deterministic ILP optimization and the hard dependency on the optional `ilp` extra with the install command. It stops short of warning about combinatorial blowup or runtime scaling on large invoice sets, which matters for an ILP solver.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded one-line summary followed by labeled sections makes it scannable. Minor waste: the opening sentence and the 'Purpose:' section restate the same idea, costing a line without adding information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need no explanation, and the description covers purpose, routing, dependency requirements, and determinism. The remaining gap is scale/performance expectations for a subset-sum ILP, which an agent weighing this against `reconcile` would benefit from knowing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and both `statements` and `invoices` document their record shape (id, amount, currency, date, counterparty, reference) in the schema itself. The description adds no field-level meaning beyond the schema, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb, resource, and method: match statement deposits to disjoint subsets of invoices via subset-sum ILP. The word 'disjoint' and the ILP framing make it distinguishable from the plain `reconcile` and `match_amounts_with_fx_drift` siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit 'When to use' conditions (consolidated deposits, split remittances, failed 1:1 and 1:N heuristics) and 'When NOT to use' guidance that names the faster alternative `reconcile` for standard 1:1/1:N cases. An agent can route correctly without opening any schema.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.