Skip to main content
Glama
mcp-ledger-server-ts

mcp-ledger-server-ts

by Gurmeher23

Three-way match

match_invoice_to_po
Read-onlyIdempotent

Run a read-only three-way match of an invoice against its purchase order and goods receipts to check quantities, prices, duplicates, dates, and tolerances, then return findings and routing.

Instructions

Run a three-way match of an invoice against its purchase order and goods receipts. Checks vendor, currency, duplicates, dates, per-line quantity (vs ordered and received, net of already-approved invoices) and unit price, using tolerance rules. Returns an outcome (matched / matched_within_tolerance / exception), the list of findings with severity, and a recommended routing action and reason code. Read-only: it never changes the ledger. Call this before route_exception.

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": {
      "invoiceId": "<invoiceId>"
    },
    "name": "match_invoice_to_po"
  }
}

Input Schema

NameRequiredDescriptionDefault
invoiceIdYesLedger invoice id, e.g. "inv_003". Obtain ids from list_invoices.

Output Schema

NameRequiredDescriptionDefault
outcomeYes
poTotalYes
findingsYes
invoiceIdYes
invoiceTotalYes
recommendedActionYes
recommendedReasonCodeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, so the safety profile is covered; the description still adds the concrete consequence ('it never changes the ledger') and, more usefully, the return contract in behavioral terms: matched / matched_within_tolerance / exception plus findings with severity and a routing recommendation. It does not disclose which tolerance rules are applied or how they are configured, which is the main remaining behavioral gap.

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?

One dense paragraph, front-loaded with the core action and checks before the return shape and the routing instruction. No filler sentences, though the checks list and the outcome list are packed into long clauses that could be split for faster scanning.

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?

With an output schema present and rich annotations, the description is nearly complete: it covers purpose, checks performed, outcome vocabulary, and call ordering for a one-parameter tool. It is only slightly short on edge cases such as missing PO/receipt data and tolerance-rule configuration.

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?

There is a single parameter and schema description coverage is 100%, with the schema itself telling the agent where to get ids ('Obtain ids from list_invoices'). The description adds no additional meaning about invoiceId, so the baseline of 3 applies rather than a higher score.

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 and resource ('Run a three-way match of an invoice against its purchase order and goods receipts') and then enumerates exactly what is compared: vendor, currency, duplicates, dates, per-line quantity net of already-approved invoices, and unit price. It also names the outcome space, which distinguishes it unambiguously from list_invoices, get_invoice, and route_exception.

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

Usage Guidelines4/5

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

Gives an explicit ordering constraint ('Call this before route_exception'), which is the key usage decision for this tool. It stops short of a full when-not rule, e.g. it does not say what to do if the invoice has no linked PO or whether it should be re-run after tolerance changes.

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