counterparty.classify

Live

Inferred relationship + class with confidence + evidence summary.

CategoryCounterparty
JSON-RPCtools/call
EndpointPOST /mcp
Sourcepackages/mcp-tools/src/tools/counterparty-classify.ts

Description

Returns inferred class (colleague / family / vendor / friend / unknown) with plain-language evidence_summary. Reads from the kg_relations graph; classification is materialized, not LLM-rerun on each call. Per ADR-0021 §read-API Family B.

Input schema

FieldTypeRequiredDescription
counterparty_idstringyesCanonical counterparty id.

Output shape

typescript
{
  counterparty_id: string;
  inferred_relationship?: string;
  inferred_class?: 'colleague' | 'family' | 'vendor' | 'friend' | 'unknown';
  confidence: 'strong_pattern' | 'pretty_sure' | 'just_guessing';
  evidence_summary: string;
}

Example call

JSON-RPC tools/call request body (omit the JSON-RPC envelope when using an SDK; the SDK adds it for you):

jsontools/call params
{ "name": "counterparty.classify", "arguments": { "counterparty_id": "entity_01HXSARAH" } }

Example response

Tool results are always wrapped as content[0].text with a stringified JSON body. The shape below is what you get back from JSON.parse(result.content[0].text):

jsonparsed result body
{
  "counterparty_id": "entity_01HXSARAH",
  "inferred_relationship": "API lead at Acme",
  "inferred_class": "colleague",
  "confidence": "strong_pattern",
  "evidence_summary": "47 work-hours interactions over 8 months; all calendar overlaps with Acme attendees; signature domain consistent."
}

Errors this tool can return

CodeMeaning
invalid_argumentsTool input failed Zod validation.
unauthorizedMissing or invalid bearer token.
quota_exceededPer-minute, daily call, or daily inference budget exceeded.
not_foundThe requested resource (action_id, decision_id, counterparty_id, etc.) was not found.

See the full error catalog for resolution steps on each code, plus the standard transport-layer responses (401, 429).