@lerianstudio/matcher-mcp 1.0.0-beta.7 → 1.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5167,7 +5167,13 @@ components:
5167
5167
  description: Aggregate run statistics as an open key-value map; consumers must tolerate unknown keys and treat a missing key as unknown rather than zero. Known keys include matches, candidates_left, candidates_right, unmatched_left, unmatched_right, unmatched_external, auto_matched_left, auto_matched_right, pending_review_left, pending_review_right, proposed_left, proposed_right, exceptions_raised (newly created), exceptions_updated (re-touched), plus per-rule families rule_matched:<ruleID> and rule_meta:<ruleID>:<TYPE>
5168
5168
  type: object
5169
5169
  status:
5170
- description: "Current status of the run: PROCESSING (in flight), COMPLETED (finished), or FAILED (errored)"
5170
+ description: "Current status of the run: QUEUED (async submit, awaiting worker pickup), PROCESSING (in flight), FINALIZING (a transient finishing-up state — a poll MAY briefly observe it between PROCESSING and COMPLETED, and it is also observable while a run is recovered after a crash; treat it as in-flight, not terminal), COMPLETED (finished), or FAILED (errored)"
5171
+ enum:
5172
+ - QUEUED
5173
+ - PROCESSING
5174
+ - FINALIZING
5175
+ - COMPLETED
5176
+ - FAILED
5171
5177
  examples:
5172
5178
  - COMPLETED
5173
5179
  type: string
@@ -5968,6 +5974,11 @@ components:
5968
5974
  RunMatchRequest:
5969
5975
  additionalProperties: false
5970
5976
  properties:
5977
+ async:
5978
+ description: "Submit asynchronously: when true the run is queued (status QUEUED) and executed by the worker; when false/omitted the run executes in-request and the response carries the completed run (terminal status). Both paths return HTTP 202; distinguish by the response status. Poll GET /v1/matching/runs/{runId} for async progress."
5979
+ examples:
5980
+ - false
5981
+ type: boolean
5971
5982
  mode:
5972
5983
  description: Execution mode
5973
5984
  enum:
@@ -5989,9 +6000,13 @@ components:
5989
6000
  format: uuid
5990
6001
  type: string
5991
6002
  status:
5992
- description: "Status of the run at acceptance: PROCESSING (in flight), COMPLETED (finished synchronously), or FAILED (errored)"
6003
+ description: "Status of the run at acceptance: QUEUED (async submit, awaiting worker pickup), COMPLETED (finished synchronously), or FAILED (errored synchronously). A synchronous run is already terminal; an async run is QUEUED. Poll GET /v1/matching/runs/{runId} for async progress (PROCESSING/FINALIZING/COMPLETED)"
6004
+ enum:
6005
+ - QUEUED
6006
+ - COMPLETED
6007
+ - FAILED
5993
6008
  examples:
5994
- - PROCESSING
6009
+ - COMPLETED
5995
6010
  type: string
5996
6011
  required:
5997
6012
  - runId
@@ -13530,7 +13545,10 @@ paths:
13530
13545
  - Matching
13531
13546
  /v1/matching/contexts/{contextId}/run:
13532
13547
  post:
13533
- description: Triggers a matching run for a reconciliation context. Supports DRY_RUN mode for testing rules without committing results, or COMMIT mode for persisting matches.
13548
+ description: |-
13549
+ Triggers a matching run for a reconciliation context. Supports DRY_RUN mode for testing rules without committing results, or COMMIT mode for persisting matches.
13550
+
13551
+ Submission is synchronous by default: the run executes inside the request and the 202 response carries the run id and its terminal status (COMPLETED or FAILED). Set `async: true` to submit asynchronously: the run is created in QUEUED state, the request returns 202 immediately with `{runId, status: QUEUED}` WITHOUT executing in-request, and the matching worker executes it. Distinguish the two by the response `status`: a synchronous run is already terminal (COMPLETED/FAILED), an async run is QUEUED. For the async path, poll `GET /v1/matching/runs/{runId}` until status transitions QUEUED -> PROCESSING -> COMPLETED (or FAILED). A poll MAY briefly observe FINALIZING (a transient finishing-up state) between PROCESSING and COMPLETED; treat it as in-flight, not terminal.
13534
13552
  operationId: runMatch
13535
13553
  parameters:
13536
13554
  - description: Reconciliation context ID
@@ -3,6 +3,8 @@
3
3
  // Reads one match run's detail by id: status, timing, aggregate stats, and the
4
4
  // per-rule matched-group counts (ruleStats). The matcher payload is returned
5
5
  // verbatim — this is how an operator polls a run started by `match_run_start`.
6
+ // In-flight states (keep polling): QUEUED, PROCESSING, FINALIZING. Terminal
7
+ // states (stop): COMPLETED, FAILED.
6
8
  //
7
9
  // Path/query split (per the spec): `runId` is the PATH param, but `contextId` is
8
10
  // a REQUIRED QUERY param (not part of the path), so matcher can scope the run to
@@ -32,10 +34,13 @@ export function registerMatchRunGetTool(server) {
32
34
  server.registerTool('match_run_get', {
33
35
  description: 'Fetch a single match run by id, including status, timing, aggregate ' +
34
36
  'statistics, and per-rule matched-group counts. Use this to poll a run ' +
35
- 'started by match_run_start. Requires runId and contextId (contextId is ' +
36
- 'sent as a query param). Both are routing params scoped to your token; no ' +
37
- 'tenant field is accepted. Returns the run detail, or a structured RFC ' +
38
- '9457 error (e.g. 404).',
37
+ 'started by match_run_start. status is one of: QUEUED, PROCESSING, ' +
38
+ 'FINALIZING (all IN-FLIGHT still running, keep polling; FINALIZING is a ' +
39
+ 'transient near-done state, not an error) or COMPLETED, FAILED (TERMINAL ' +
40
+ ' stop polling). Requires runId and contextId (contextId is sent as a ' +
41
+ 'query param). Both are routing params scoped to your token; no tenant ' +
42
+ 'field is accepted. Returns the run detail, or a structured RFC 9457 ' +
43
+ 'error (e.g. 404).',
39
44
  inputSchema: getMatchRunInputShape,
40
45
  }, async (args, extra) => {
41
46
  return dispatchMatching({
@@ -1 +1 @@
1
- {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/tools/matching/get.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,gFAAgF;AAChF,uDAAuD;AAEvD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAEvD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,mCAAmC,CAAC;IAChD,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAC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C,MAAiB;IACvD,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,WAAW,EACT,sEAAsE;YACtE,wEAAwE;YACxE,oEAAoE;YACpE,2EAA2E;YAC3E,0EAA0E;YAC1E,wEAAwE;YACxE,wEAAwE;YACxE,sEAAsE;YACtE,mBAAmB;QACrB,WAAW,EAAE,qBAAqB;KACnC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,gBAAgB,CACrB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YACzB,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE;SACrC,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -1,8 +1,12 @@
1
1
  // `match_run_start` — curated POST /v1/matching/contexts/{contextId}/run.
2
2
  //
3
- // Triggers a matching run for a reconciliation context. This is an async action:
4
- // matcher responds 202 with { runId, status } and processes in the background —
5
- // the operator polls `match_run_get` with the returned runId to follow progress.
3
+ // Triggers a matching run for a reconciliation context. Both submit paths return
4
+ // HTTP 202 with { runId, status }; the `status` distinguishes them:
5
+ // - sync (async omitted/false): the run executes in-request and the 202 carries
6
+ // the TERMINAL run — status COMPLETED or FAILED. No polling needed.
7
+ // - async (async:true): the run is created QUEUED and executed by a background
8
+ // worker; the 202 carries status QUEUED. The operator polls `match_run_get`
9
+ // with the returned runId to follow progress.
6
10
  // This tool does NOT auto-poll; it returns the 202 acceptance body verbatim.
7
11
  //
8
12
  // `contextId` is a routing path param (matcher validates it belongs to the
@@ -27,28 +31,50 @@ export const startMatchRunInputShape = {
27
31
  .enum(RUN_MODES)
28
32
  .describe('Execution mode. DRY_RUN tests the rules without committing any matches; ' +
29
33
  'COMMIT executes the rules and persists the resulting matches.'),
34
+ async: z
35
+ .boolean()
36
+ .optional()
37
+ .describe('Submit path (optional, default false). Both return 202 with ' +
38
+ '{ runId, status }; the status distinguishes them. Omit (or false) to ' +
39
+ 'run in-request: the 202 carries the TERMINAL run (status COMPLETED or ' +
40
+ 'FAILED). Set true to enqueue: the run is created QUEUED and a background ' +
41
+ 'worker executes it — the 202 status is QUEUED and you poll match_run_get ' +
42
+ 'with the runId until it reaches COMPLETED/FAILED.'),
30
43
  };
31
44
  /**
32
- * Register `match_run_start`. Substitutes contextId into the path and sends only
33
- * `{ mode }` as the body (per RunMatchRequest, which forbids extra properties).
34
- * Dispatches through the shared fail-closed relay; a matcher error surfaces via
35
- * the shared toToolError.
45
+ * Register `match_run_start`. Substitutes contextId into the path and sends
46
+ * `{ mode }` as the body, adding `async` ONLY when the caller set it (per
47
+ * RunMatchRequest, which accepts `async` but forbids unknown properties so the
48
+ * key is omitted when undefined to keep the body minimal). Dispatches through the
49
+ * shared fail-closed relay; a matcher error surfaces via the shared toToolError.
36
50
  */
37
51
  export function registerMatchRunStartTool(server) {
38
52
  server.registerTool('match_run_start', {
39
- description: 'Trigger a matching run for a reconciliation context. Async: returns 202 ' +
40
- 'with { runId, status } and processes in the background — poll ' +
41
- 'match_run_get with the runId to follow progress (this tool does not ' +
53
+ description: 'Trigger a matching run for a reconciliation context. Both submit paths ' +
54
+ 'return 202 with { runId, status }; the status distinguishes them. Omit ' +
55
+ 'async (or set false) to run in-request: the 202 carries the TERMINAL run ' +
56
+ '(status COMPLETED or FAILED). Set async:true to enqueue: the run is ' +
57
+ 'created QUEUED and a background worker executes it (202 status QUEUED) — ' +
58
+ 'poll match_run_get with the runId to follow progress (this tool does not ' +
42
59
  'auto-poll). mode is required: DRY_RUN tests rules without committing, ' +
43
60
  'COMMIT persists the matches. contextId is a routing param scoped to your ' +
44
61
  'token (no tenant field is accepted). Returns the acceptance body, or a ' +
45
- 'structured RFC 9457 error.',
62
+ 'structured RFC 9457 error (e.g. 422 when the rule set is not ' +
63
+ 'stream-bounded and cannot run at unbounded scale).',
46
64
  inputSchema: startMatchRunInputShape,
47
65
  }, async (args, extra) => {
66
+ // Omit `async` unless the caller set it — match the { mode } body style and
67
+ // keep the body minimal for RunMatchRequest's no-unknown-props contract.
68
+ const body = {
69
+ mode: args.mode,
70
+ };
71
+ if (args.async !== undefined) {
72
+ body.async = args.async;
73
+ }
48
74
  return dispatchMatching({
49
75
  method: 'POST',
50
76
  path: contextRunPath(args.contextId),
51
- body: { mode: args.mode },
77
+ body,
52
78
  }, extra);
53
79
  });
54
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/tools/matching/start.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,iFAAiF;AACjF,6EAA6E;AAC7E,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAE5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAU,CAAA;AAEvD,oFAAoF;AACpF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,2EAA2E;QACzE,8CAA8C,CACjD;IACH,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,SAAS,CAAC;SACf,QAAQ,CACP,0EAA0E;QACxE,+DAA+D,CAClE;CACJ,CAAA;AAOD;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,WAAW,EACT,0EAA0E;YAC1E,gEAAgE;YAChE,sEAAsE;YACtE,wEAAwE;YACxE,2EAA2E;YAC3E,yEAAyE;YACzE,4BAA4B;QAC9B,WAAW,EAAE,uBAAuB;KACrC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,gBAAgB,CACrB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC;YACpC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;SAC1B,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/tools/matching/start.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,iFAAiF;AACjF,oEAAoE;AACpE,kFAAkF;AAClF,wEAAwE;AACxE,iFAAiF;AACjF,gFAAgF;AAChF,kDAAkD;AAClD,6EAA6E;AAC7E,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAE5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAU,CAAA;AAEvD,oFAAoF;AACpF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,2EAA2E;QACzE,8CAA8C,CACjD;IACH,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,SAAS,CAAC;SACf,QAAQ,CACP,0EAA0E;QACxE,+DAA+D,CAClE;IACH,KAAK,EAAE,CAAC;SACL,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CACP,8DAA8D;QAC5D,uEAAuE;QACvE,wEAAwE;QACxE,2EAA2E;QAC3E,2EAA2E;QAC3E,mDAAmD,CACtD;CACJ,CAAA;AAOD;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,WAAW,EACT,yEAAyE;YACzE,yEAAyE;YACzE,2EAA2E;YAC3E,sEAAsE;YACtE,2EAA2E;YAC3E,2EAA2E;YAC3E,wEAAwE;YACxE,2EAA2E;YAC3E,yEAAyE;YACzE,+DAA+D;YAC/D,oDAAoD;QACtD,WAAW,EAAE,uBAAuB;KACrC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,4EAA4E;QAC5E,yEAAyE;QACzE,MAAM,IAAI,GAA0D;YAClE,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAA;QACD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QACzB,CAAC;QACD,OAAO,gBAAgB,CACrB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC;YACpC,IAAI;SACL,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lerianstudio/matcher-mcp",
3
- "version": "1.0.0-beta.7",
3
+ "version": "1.0.0-beta.8",
4
4
  "type": "module",
5
5
  "description": "Model Context Protocol server for the Matcher reconciliation engine",
6
6
  "license": "Apache-2.0",