@talonic/mcp 0.1.102 → 0.1.103

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.
package/dist/server.js CHANGED
@@ -3681,9 +3681,9 @@ var readOnly = {
3681
3681
  idempotentHint: true,
3682
3682
  openWorldHint: false
3683
3683
  };
3684
- var write = (idempotent, destructive = false) => ({
3684
+ var write = (idempotent, destructive2 = false) => ({
3685
3685
  readOnlyHint: false,
3686
- destructiveHint: destructive,
3686
+ destructiveHint: destructive2,
3687
3687
  idempotentHint: idempotent,
3688
3688
  openWorldHint: false
3689
3689
  });
@@ -4197,9 +4197,9 @@ var readOnly2 = {
4197
4197
  idempotentHint: true,
4198
4198
  openWorldHint: false
4199
4199
  };
4200
- var write2 = (idempotent, destructive = false) => ({
4200
+ var write2 = (idempotent, destructive2 = false) => ({
4201
4201
  readOnlyHint: false,
4202
- destructiveHint: destructive,
4202
+ destructiveHint: destructive2,
4203
4203
  idempotentHint: idempotent,
4204
4204
  openWorldHint: false
4205
4205
  });
@@ -4438,9 +4438,9 @@ var readOnly3 = {
4438
4438
  idempotentHint: true,
4439
4439
  openWorldHint: false
4440
4440
  };
4441
- var write3 = (idempotent, destructive = false) => ({
4441
+ var write3 = (idempotent, destructive2 = false) => ({
4442
4442
  readOnlyHint: false,
4443
- destructiveHint: destructive,
4443
+ destructiveHint: destructive2,
4444
4444
  idempotentHint: idempotent,
4445
4445
  openWorldHint: false
4446
4446
  });
@@ -5156,9 +5156,9 @@ var readOnly4 = {
5156
5156
  idempotentHint: true,
5157
5157
  openWorldHint: false
5158
5158
  };
5159
- var write4 = (idempotent, destructive = false) => ({
5159
+ var write4 = (idempotent, destructive2 = false) => ({
5160
5160
  readOnlyHint: false,
5161
- destructiveHint: destructive,
5161
+ destructiveHint: destructive2,
5162
5162
  idempotentHint: idempotent,
5163
5163
  openWorldHint: false
5164
5164
  });
@@ -5804,6 +5804,14 @@ var write6 = {
5804
5804
  idempotentHint: false,
5805
5805
  openWorldHint: false
5806
5806
  };
5807
+ var destructive = {
5808
+ readOnlyHint: false,
5809
+ destructiveHint: true,
5810
+ idempotentHint: false,
5811
+ openWorldHint: false
5812
+ };
5813
+ var BASE = "/v1/processes";
5814
+ var pid = (a) => encodeURIComponent(a.process_id);
5807
5815
  async function probeProcessesAccess(token, baseUrl) {
5808
5816
  try {
5809
5817
  const res = await fetch(buildUrl(baseUrl, "/v1/processes"), {
@@ -5821,6 +5829,21 @@ var STATUS_DESCRIPTION4 = "Where a process run stands: per step, how many items
5821
5829
  var RUNS_DESCRIPTION2 = "Runs across all processes, newest first: state (running, completed, failed, stuck = open with a failed item), items done, waiting and failed. Filter by process or by runs waiting for the caller.";
5822
5830
  var WAITING_DESCRIPTION = "Sign-offs and forms waiting for the caller (the person behind the key): per process and step, how many items wait. Use talonic_process_status to see the items, then talonic_process_sign.";
5823
5831
  var SIGN_DESCRIPTION = "Sign a sign-off step of a run for the caller: approve all waiting items, or only `items`. A step that offers choices needs `decision` (one of its choices). Allowed only where the caller is assigned to the step. Signing moves real work on: call only when the user decides.";
5832
+ var GET_DESCRIPTION2 = "One process with its draft: fields, steps (id, kind, name, settings) and the arrows between them. Use it to see step ids before talonic_process_change with step_id, or to read what a process does.";
5833
+ var CREATE_DESCRIPTION2 = "Set up a new process as a DRAFT. Pass `description` in the user's own words (what comes in, what is read or checked, who decides, what goes out), or `workflow_json` with an exported n8n workflow to take it over. Nothing runs and nothing is sent until talonic_process_publish. The answer names what a person still has to choose (`stillOpen`, `questions`): tell the user those. Uses a model call for `description`.";
5834
+ var CHANGE_DESCRIPTION = "Change a process draft from an instruction in plain words: add, remove or reorder steps, change who decides, what is sent, any setting. With `step_id` only that step's settings change. Touches the draft only; the live version stays until talonic_process_publish. If the answer is `needs_confirmation`, NOTHING was saved: the change means fewer people or checks look at items. Tell the user exactly those points and ask; call again with `confirmed: true` only after they said yes, never on a first call.";
5835
+ var CHECK_DESCRIPTION = "What a draft still needs before it can go live (`stillNeeded`, per step), every problem the check finds, and what publishing would change against the live version. Call before talonic_process_publish and tell the user what is open.";
5836
+ var TEST_RUN_DESCRIPTION = "Run the DRAFT on real documents in a test copy: nothing is delivered, emailed or called. Steps not set up yet end the test (`endsAt`). Returns `processId` of the test copy and `runId`; follow with talonic_process_status on that processId.";
5837
+ var PUBLISH_DESCRIPTION = "Make the draft the LIVE version. From then on the process runs for real: it starts on what its start says (arriving documents, mail, another system), sends its mail and calls its systems. Refused while talonic_process_check finds an error. Call only when the user said to publish; show them talonic_process_check first.";
5838
+ var VERSIONS_DESCRIPTION = "The published versions of a process, newest first, with who published and why.";
5839
+ var ROLLBACK_DESCRIPTION = "Make an earlier published version live again. Changes what runs for real: call only when the user asks for it.";
5840
+ var DELETE_DESCRIPTION2 = "Delete a process. Not possible while a run is open. Cannot be undone: call only when the user asked to delete this process by name.";
5841
+ var ITEM_DESCRIPTION = "One item's way through a run, step by step (status, time, note such as why it stopped or where a mail went), and its values now. Item keys come from talonic_process_status.";
5842
+ var RETRY_DESCRIPTION = "Try every failed step of a run again. Steps that send or call will send or call again: use when the cause of the failure is fixed.";
5843
+ var SEND_BACK_DESCRIPTION = "Send items back from a sign-off step with a reason, for the caller: the opposite of talonic_process_sign. Allowed only where the caller is assigned. Moves real work: call only when the user decides.";
5844
+ var SETUP_DESCRIPTION = "What processes of this workspace can use: who a step can wait for (roles, groups), the connected mailboxes and whether each may send, the names of stored secrets (never values), and the shared data a look-up step can read. Connecting a mailbox and storing a secret happen in the Talonic web app, not here.";
5845
+ var MAILBOX_OWNERSHIP_DESCRIPTION = "Say whether a connected mailbox is one person's own (`individual`: only that person may put it on a process) or the company's (`company`: everyone who builds processes may). A governance decision: call only when the user asks.";
5846
+ var ADDRESS_DESCRIPTION = "The address other systems send items to (a webhook). Without `make` it only says whether one exists; the address itself is shown once, when made. With `make: true` it makes one and returns `path` to post to. An existing address is replaced only with `replace: true`: the old one stops working AT ONCE and whatever sends to it stops getting through, so ask the user first. `test: true` is the address of the test copy.";
5824
5847
  function registerProcessesTools(server, getToken, baseUrl) {
5825
5848
  const tools = [
5826
5849
  [
@@ -5926,6 +5949,244 @@ function registerProcessesTools(server, getToken, baseUrl) {
5926
5949
  }
5927
5950
  )
5928
5951
  )
5952
+ ],
5953
+ [
5954
+ "talonic_process_get",
5955
+ "One process",
5956
+ GET_DESCRIPTION2,
5957
+ { process_id: zUuid().describe("The process id from talonic_process_list") },
5958
+ readOnly6,
5959
+ (a) => runTool(() => apiJson(getToken, baseUrl, "GET", `${BASE}/${pid(a)}`))
5960
+ ],
5961
+ [
5962
+ "talonic_process_create",
5963
+ "New process draft",
5964
+ CREATE_DESCRIPTION2,
5965
+ {
5966
+ description: z.string().min(10).max(2e3).optional().describe("What the process should do, complete and in the user's words"),
5967
+ workflow_json: z.string().min(2).max(4e5).optional().describe("An exported n8n workflow as JSON text, instead of description")
5968
+ },
5969
+ write6,
5970
+ (a) => runTool(() => {
5971
+ if (a.workflow_json) {
5972
+ let workflow;
5973
+ try {
5974
+ workflow = JSON.parse(a.workflow_json);
5975
+ } catch {
5976
+ throw new Error("workflow_json is not valid JSON.");
5977
+ }
5978
+ return apiJson(getToken, baseUrl, "POST", BASE, { body: { workflow } });
5979
+ }
5980
+ if (!a.description) throw new Error("Pass description or workflow_json.");
5981
+ return apiJson(getToken, baseUrl, "POST", BASE, { body: { description: a.description } });
5982
+ })
5983
+ ],
5984
+ [
5985
+ "talonic_process_change",
5986
+ "Change a process draft",
5987
+ CHANGE_DESCRIPTION,
5988
+ {
5989
+ process_id: zUuid(),
5990
+ change: z.string().min(1).max(2e3).describe("What should change, in plain words"),
5991
+ step_id: z.string().min(1).max(80).optional().describe("Only this step's settings (id from talonic_process_get)"),
5992
+ confirmed: z.boolean().optional().describe(
5993
+ "Leave out. true only after needs_confirmation was shown to the user and they agreed"
5994
+ )
5995
+ },
5996
+ write6,
5997
+ (a) => runTool(
5998
+ () => apiJson(getToken, baseUrl, "POST", `${BASE}/${pid(a)}/change`, {
5999
+ body: {
6000
+ change: a.change,
6001
+ ...a.step_id ? { stepId: a.step_id } : {},
6002
+ ...a.confirmed === true ? { confirmed: true } : {}
6003
+ }
6004
+ })
6005
+ )
6006
+ ],
6007
+ [
6008
+ "talonic_process_check",
6009
+ "Check a process draft",
6010
+ CHECK_DESCRIPTION,
6011
+ { process_id: zUuid() },
6012
+ readOnly6,
6013
+ async (a) => runTool(async () => {
6014
+ const [check, changes] = await Promise.all([
6015
+ apiJson(getToken, baseUrl, "GET", `${BASE}/${pid(a)}/check`),
6016
+ apiJson(getToken, baseUrl, "GET", `${BASE}/${pid(a)}/changes`)
6017
+ ]);
6018
+ return { check, changes };
6019
+ })
6020
+ ],
6021
+ [
6022
+ "talonic_process_test_run",
6023
+ "Test a process draft",
6024
+ TEST_RUN_DESCRIPTION,
6025
+ {
6026
+ process_id: zUuid(),
6027
+ document_ids: z.array(zUuid()).min(1).max(100).describe("Documents to run the draft on")
6028
+ },
6029
+ write6,
6030
+ (a) => runTool(
6031
+ () => apiJson(getToken, baseUrl, "POST", `${BASE}/${pid(a)}/test-run`, {
6032
+ body: { documentIds: a.document_ids }
6033
+ })
6034
+ )
6035
+ ],
6036
+ [
6037
+ "talonic_process_publish",
6038
+ "Publish a process",
6039
+ PUBLISH_DESCRIPTION,
6040
+ {
6041
+ process_id: zUuid(),
6042
+ reason: z.string().max(2e3).optional().describe("Why this change, for the record")
6043
+ },
6044
+ destructive,
6045
+ (a) => runTool(
6046
+ () => apiJson(getToken, baseUrl, "POST", `${BASE}/${pid(a)}/publish`, {
6047
+ body: a.reason ? { reason: a.reason } : {}
6048
+ })
6049
+ )
6050
+ ],
6051
+ [
6052
+ "talonic_process_versions",
6053
+ "Process versions",
6054
+ VERSIONS_DESCRIPTION,
6055
+ { process_id: zUuid() },
6056
+ readOnly6,
6057
+ (a) => runTool(() => apiJson(getToken, baseUrl, "GET", `${BASE}/${pid(a)}/versions`))
6058
+ ],
6059
+ [
6060
+ "talonic_process_rollback",
6061
+ "Roll a process back",
6062
+ ROLLBACK_DESCRIPTION,
6063
+ {
6064
+ process_id: zUuid(),
6065
+ version: z.number().int().min(1).describe("The version number to make live again")
6066
+ },
6067
+ destructive,
6068
+ (a) => runTool(
6069
+ () => apiJson(
6070
+ getToken,
6071
+ baseUrl,
6072
+ "POST",
6073
+ `${BASE}/${pid(a)}/versions/${encodeURIComponent(String(a.version))}/rollback`
6074
+ )
6075
+ )
6076
+ ],
6077
+ [
6078
+ "talonic_process_delete",
6079
+ "Delete a process",
6080
+ DELETE_DESCRIPTION2,
6081
+ { process_id: zUuid() },
6082
+ destructive,
6083
+ (a) => runTool(() => apiJson(getToken, baseUrl, "DELETE", `${BASE}/${pid(a)}`))
6084
+ ],
6085
+ [
6086
+ "talonic_process_item",
6087
+ "One item of a run",
6088
+ ITEM_DESCRIPTION,
6089
+ {
6090
+ process_id: zUuid(),
6091
+ run_id: zUuid(),
6092
+ item_key: z.string().min(1).max(200).describe("The item's key (documentId) from the run")
6093
+ },
6094
+ readOnly6,
6095
+ (a) => runTool(
6096
+ () => apiJson(
6097
+ getToken,
6098
+ baseUrl,
6099
+ "GET",
6100
+ `${BASE}/${pid(a)}/runs/${encodeURIComponent(a.run_id)}/items/${encodeURIComponent(a.item_key)}`
6101
+ )
6102
+ )
6103
+ ],
6104
+ [
6105
+ "talonic_process_retry",
6106
+ "Retry a run's failed steps",
6107
+ RETRY_DESCRIPTION,
6108
+ { run_id: zUuid() },
6109
+ write6,
6110
+ (a) => runTool(
6111
+ () => apiJson(getToken, baseUrl, "POST", `${BASE}/runs/${encodeURIComponent(a.run_id)}/retry`)
6112
+ )
6113
+ ],
6114
+ [
6115
+ "talonic_process_send_back",
6116
+ "Send items back from a sign-off",
6117
+ SEND_BACK_DESCRIPTION,
6118
+ {
6119
+ process_id: zUuid(),
6120
+ run_id: zUuid(),
6121
+ step_id: z.string().min(1).max(64),
6122
+ items: z.array(z.string().min(1).max(200)).min(1).max(200).describe("Item keys"),
6123
+ reason: z.string().min(1).max(2e3).describe("Why they go back, in the user's words")
6124
+ },
6125
+ write6,
6126
+ (a) => runTool(
6127
+ () => apiJson(
6128
+ getToken,
6129
+ baseUrl,
6130
+ "POST",
6131
+ `${BASE}/${pid(a)}/runs/${encodeURIComponent(a.run_id)}/holds/${encodeURIComponent(a.step_id)}/send-back`,
6132
+ { body: { items: a.items, reason: a.reason } }
6133
+ )
6134
+ )
6135
+ ],
6136
+ [
6137
+ "talonic_process_setup",
6138
+ "What processes can use",
6139
+ SETUP_DESCRIPTION,
6140
+ {},
6141
+ readOnly6,
6142
+ async () => runTool(async () => {
6143
+ const [people, mailboxes, secrets, lookupData] = await Promise.all([
6144
+ apiJson(getToken, baseUrl, "GET", `${BASE}/people`),
6145
+ apiJson(getToken, baseUrl, "GET", `${BASE}/mailboxes`),
6146
+ apiJson(getToken, baseUrl, "GET", `${BASE}/secrets`),
6147
+ apiJson(getToken, baseUrl, "GET", `${BASE}/lookup-data`)
6148
+ ]);
6149
+ return { people, mailboxes, secrets, lookupData };
6150
+ })
6151
+ ],
6152
+ [
6153
+ "talonic_process_mailbox_ownership",
6154
+ "Say whose a mailbox is",
6155
+ MAILBOX_OWNERSHIP_DESCRIPTION,
6156
+ {
6157
+ mailbox_id: zUuid().describe("The mailbox id from talonic_process_setup"),
6158
+ ownership: z.enum(["individual", "company"])
6159
+ },
6160
+ write6,
6161
+ (a) => runTool(
6162
+ () => apiJson(
6163
+ getToken,
6164
+ baseUrl,
6165
+ "PUT",
6166
+ `${BASE}/mailboxes/${encodeURIComponent(a.mailbox_id)}/ownership`,
6167
+ { body: { ownership: a.ownership } }
6168
+ )
6169
+ )
6170
+ ],
6171
+ [
6172
+ "talonic_process_address",
6173
+ "A process's address for other systems",
6174
+ ADDRESS_DESCRIPTION,
6175
+ {
6176
+ process_id: zUuid(),
6177
+ make: z.boolean().optional().describe("true: make the address. Default: only say whether one exists"),
6178
+ test: z.boolean().optional().describe("The address of the test copy"),
6179
+ replace: z.boolean().optional().describe("true only after the user agreed to switch the existing address off")
6180
+ },
6181
+ destructive,
6182
+ (a) => runTool(
6183
+ () => a.make === true ? apiJson(getToken, baseUrl, "PUT", `${BASE}/${pid(a)}/address`, {
6184
+ body: {
6185
+ ...a.test === true ? { test: true } : {},
6186
+ ...a.replace === true ? { replace: true } : {}
6187
+ }
6188
+ }) : apiJson(getToken, baseUrl, "GET", `${BASE}/${pid(a)}/address`)
6189
+ )
5929
6190
  ]
5930
6191
  ];
5931
6192
  for (const [name, title, description, inputSchema11, annotations, handler] of tools) {
@@ -5942,9 +6203,9 @@ var readOnly7 = {
5942
6203
  idempotentHint: true,
5943
6204
  openWorldHint: false
5944
6205
  };
5945
- var write7 = (idempotent, destructive = false) => ({
6206
+ var write7 = (idempotent, destructive2 = false) => ({
5946
6207
  readOnlyHint: false,
5947
- destructiveHint: destructive,
6208
+ destructiveHint: destructive2,
5948
6209
  idempotentHint: idempotent,
5949
6210
  openWorldHint: false
5950
6211
  });
@@ -6183,9 +6444,9 @@ var readOnly8 = {
6183
6444
  idempotentHint: true,
6184
6445
  openWorldHint: false
6185
6446
  };
6186
- var write8 = (idempotent, destructive = false) => ({
6447
+ var write8 = (idempotent, destructive2 = false) => ({
6187
6448
  readOnlyHint: false,
6188
- destructiveHint: destructive,
6449
+ destructiveHint: destructive2,
6189
6450
  idempotentHint: idempotent,
6190
6451
  openWorldHint: false
6191
6452
  });
@@ -8168,7 +8429,7 @@ async function handleListFields(getToken, baseUrl, args) {
8168
8429
  })
8169
8430
  );
8170
8431
  }
8171
- var GET_DESCRIPTION2 = [
8432
+ var GET_DESCRIPTION3 = [
8172
8433
  "Get the CONCEPT CARD for one Field Registry field: what it means (curated description + extraction instruction), its synonyms and aliases, maturity, where it occurs (document/occurrence counts, first/last seen, document-type spread), its value distribution (top values with counts, distinct count, examples), schema usage, and identity links (superseded_by, absorbed concepts).",
8173
8434
  "",
8174
8435
  "USE WHEN: you must decide whether a field is the right concept for a question, need example values or the value shape before writing a filter, or hold a field NAME from the user and need the live concept behind it.",
@@ -8270,7 +8531,7 @@ function registerFieldTools(server, getToken, baseUrl) {
8270
8531
  "talonic_get_field",
8271
8532
  {
8272
8533
  title: "Look up a field",
8273
- description: GET_DESCRIPTION2,
8534
+ description: GET_DESCRIPTION3,
8274
8535
  inputSchema: getFieldInputSchema,
8275
8536
  annotations: {
8276
8537
  title: "Look up a field",
@@ -8511,7 +8772,7 @@ var LIST_DESCRIPTION5 = [
8511
8772
  "ARGS: optional `search` (name contains, case-insensitive), `limit` (1\u2013100, default 20), `cursor` (from pagination.next_cursor), `order` (asc|desc by updated_at).",
8512
8773
  "RETURNS: { data[] of { id, name, description, schema_id, version, materialized_version, materialized_at, field_count, node_count, created_at, updated_at, links }, pagination { total, limit, has_more, next_cursor } }."
8513
8774
  ].join("\n");
8514
- var GET_DESCRIPTION3 = [
8775
+ var GET_DESCRIPTION4 = [
8515
8776
  "Get one Spec's structure: identity and version state, the schema its output rows follow, `nodes[]` (the processing steps as the user configured them, in editing order), `phases[]` (the steps as they actually run, in run order; one configured validation step can run as several phases, so the two lists can differ), and `fields[]` (Spec field \u2194 schema field).",
8516
8777
  "",
8517
8778
  "USE WHEN: you need to explain what a run will do, confirm a Spec is published (`version` non-null) before talonic_run_spec, or map field names to keys.",
@@ -8574,7 +8835,7 @@ function registerSpecTools(server, getToken, baseUrl) {
8574
8835
  "talonic_get_spec",
8575
8836
  {
8576
8837
  title: "Look up a pipeline",
8577
- description: GET_DESCRIPTION3,
8838
+ description: GET_DESCRIPTION4,
8578
8839
  inputSchema: getSpecInputSchema,
8579
8840
  annotations: { title: "Look up a pipeline", ...READ_ONLY4 },
8580
8841
  _meta: widgetToolMeta("getSpec")
@@ -8979,7 +9240,7 @@ function registerAskTools(server, getToken, baseUrl) {
8979
9240
 
8980
9241
  // package.json
8981
9242
  var package_default = {
8982
- version: "0.1.102"};
9243
+ version: "0.1.103"};
8983
9244
 
8984
9245
  // src/version.ts
8985
9246
  var VERSION = package_default.version;