conduyt-mcp 4.105.32 → 4.105.34

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.
@@ -440,6 +440,7 @@ export const TOOL_ANNOTATIONS = {
440
440
  conduyt_update_booking_page: row("Update Booking Page", false, true, true), // owner transfer clears the iCal feed token (booking-pages/[id]/route.ts:266); the tool no longer offers enableIcalFeed (the route refuses it for API-key calls, #401), so a repeat lands the same state
441
441
  conduyt_report_fields: ro("Report Fields"),
442
442
  conduyt_list_reports: ro("List Reports"),
443
+ conduyt_get_report: ro("Get Report"),
443
444
  conduyt_create_report: create("Create Report"),
444
445
  conduyt_run_report: create("Run Saved Report"),
445
446
  conduyt_preview_report: ro("Preview Report"),
@@ -1,3 +1,4 @@
1
+ import { WEBHOOK_NAME_TAG_DOC } from "./user-fields-doc.js";
1
2
  import { z } from "zod";
2
3
  import { formatResult, formatToolError } from "../client.js";
3
4
  /** (card ownership per lane, app 10-08/09) the action options an agent can set; the catalog does not carry action config, so this is the one place they are documented */
@@ -31,7 +32,7 @@ export function registerAutomationTools(server, client) {
31
32
  const result = await client.get(`/api/v1/automations/${id}`);
32
33
  return formatResult(result);
33
34
  });
34
- server.tool("conduyt_create_automation", "Create a new automation. Requires a name and trigger event. Use conduyt_resolve_names to convert human-readable names to UUIDs before building actions." + AUTOMATION_KEY_REFUSALS_NOTE, {
35
+ server.tool("conduyt_create_automation", "Create a new automation. Requires a name and trigger event. Use conduyt_resolve_names to convert human-readable names to UUIDs before building actions." + AUTOMATION_KEY_REFUSALS_NOTE + WEBHOOK_NAME_TAG_DOC, {
35
36
  name: z.string().describe("Automation name"),
36
37
  description: z.string().optional().describe("Description of what this automation does"),
37
38
  triggerEvent: z.string().describe("Trigger event (e.g. 'contact.created', 'deal.stage_changed', 'tag.added', 'scheduled', or 'message.understood' — fires when the copilot has read an inbound text/email and understood its intent; list them all with conduyt_list_automation_events)"),
@@ -50,7 +51,7 @@ export function registerAutomationTools(server, client) {
50
51
  const result = await client.post("/api/v1/automations", params);
51
52
  return formatResult(result);
52
53
  });
53
- server.tool("conduyt_update_automation", "Update an existing automation — change trigger, actions, schedule, or activation status." + AUTOMATION_KEY_REFUSALS_NOTE, {
54
+ server.tool("conduyt_update_automation", "Update an existing automation — change trigger, actions, schedule, or activation status." + AUTOMATION_KEY_REFUSALS_NOTE + WEBHOOK_NAME_TAG_DOC, {
54
55
  id: z.string().describe("Automation UUID"),
55
56
  name: z.string().optional().describe("Updated name"),
56
57
  description: z.string().optional().describe("Updated description"),
@@ -1,3 +1,4 @@
1
+ import { LIST_USERS_DOC } from "./user-fields-doc.js";
1
2
  import { z } from "zod";
2
3
  import { formatResult } from "../client.js";
3
4
  import { INVALID_NUMBER_REFUSALS } from "./contacts.js";
@@ -28,7 +29,7 @@ export function registerBulkTools(server, client) {
28
29
  const result = await client.post("/api/v1/contacts/ai-import", { contacts, options });
29
30
  return formatResult(result);
30
31
  });
31
- server.tool("conduyt_export_contacts", "Export contacts as JSON with filtering. Returns all matching contacts with tags and custom fields. The API judges the query names first (batch33): a name the export does not read is 400 unknown_query_param { message, unknown[], accepted[], didYouMean } (it used to be ignored and every contact exported) and two different values of format or of a single-value filter 400 query_param_conflict { message, param }, both before the numeric code; this tool sends only accepted names. min_score that is not an integer 0..2147483647 is 400 invalid_min_score { message, param, accepted } (GET /contacts, /contacts/count and /contacts/export).", {
32
+ server.tool("conduyt_export_contacts", "Export contacts as JSON with filtering. Returns all matching contacts with tags and custom fields. The API judges the query names first (batch33): a name the export does not read is 400 unknown_query_param { message, unknown[], accepted[], didYouMean } (it used to be ignored and every contact exported) and two different values of format or of a single-value filter 400 query_param_conflict { message, param }, both before the numeric code; this tool sends only accepted names. min_score that is not an integer 0..2147483647 is 400 invalid_min_score { message, param, accepted } (GET /contacts, /contacts/count and /contacts/export)." + LIST_USERS_DOC, {
32
33
  format: z.enum(["json"]).optional().describe("Export format (use 'json' for MCP)"),
33
34
  search: z.string().optional().describe("Search filter"),
34
35
  tag: z.string().optional().describe("Filter by tag name"),
@@ -67,7 +68,7 @@ export function registerBulkTools(server, client) {
67
68
  });
68
69
  return formatResult(result);
69
70
  });
70
- server.tool("conduyt_export_deals", "Export deals as JSON (GET /api/v1/deals/export, owner or admin only: otherwise 403) with the board's filters: search, status, pipeline, assigned_to (user UUIDs or `unassigned`, at most 25 distinct owners), tag_ids (tag UUIDs, ANY match, at most 25), contact_timezone, created_after / created_before (YYYY-MM-DD in the account time zone, day-inclusive, or an ISO datetime with offset), value_min / value_max, needsAction, stale, health (one Pipeline health check). Answer: { deals, meta { total, exported_at, filters_applied } }; Secure custom field values are masked. The whole filtered book is read in one request (not streamed): at most 50,000 rows, past that 413 and nothing is exported (narrow the filters); rate limited to 5 exports a minute per workspace and address (429). Each repeated filter is sent as repeated query parameters, never comma-joined; the owner and tag caps are also checked here, before any request. The API judges the query names first (batch33): a name the export does not read is 400 unknown_query_param { message, unknown[], accepted[], didYouMean } (it used to be ignored and the whole book exported) and two different values of format, search, status, pipeline, value_min / minValue, value_max / maxValue, needsAction or stale 400 query_param_conflict { message, param }, both before the numeric codes; this tool sends only accepted names. The deal value bounds are judged too: value_min / minValue and value_max / maxValue that are non-numeric or outside the deal value column range (-9999999999.99..9999999999.99) are 400 invalid_value_min / invalid_value_max { message, param, accepted } (absent or empty = no filter; an alias spelling answers the same code with the sent spelling in param). TIME ZONE (#1312): " + CONTACT_TIMEZONE_NOTE + " The export applies the same rule as conduyt_list_deals.", {
71
+ server.tool("conduyt_export_deals", "Export deals as JSON (GET /api/v1/deals/export, owner or admin only: otherwise 403) with the board's filters: search, status, pipeline, assigned_to (user UUIDs or `unassigned`, at most 25 distinct owners), tag_ids (tag UUIDs, ANY match, at most 25), contact_timezone, created_after / created_before (YYYY-MM-DD in the account time zone, day-inclusive, or an ISO datetime with offset), value_min / value_max, needsAction, stale, health (one Pipeline health check). Answer: { deals, meta { total, exported_at, filters_applied } }; Secure custom field values are masked. The whole filtered book is read in one request (not streamed): at most 50,000 rows, past that 413 and nothing is exported (narrow the filters); rate limited to 5 exports a minute per workspace and address (429). Each repeated filter is sent as repeated query parameters, never comma-joined; the owner and tag caps are also checked here, before any request. The API judges the query names first (batch33): a name the export does not read is 400 unknown_query_param { message, unknown[], accepted[], didYouMean } (it used to be ignored and the whole book exported) and two different values of format, search, status, pipeline, value_min / minValue, value_max / maxValue, needsAction or stale 400 query_param_conflict { message, param }, both before the numeric codes; this tool sends only accepted names. The deal value bounds are judged too: value_min / minValue and value_max / maxValue that are non-numeric or outside the deal value column range (-9999999999.99..9999999999.99) are 400 invalid_value_min / invalid_value_max { message, param, accepted } (absent or empty = no filter; an alias spelling answers the same code with the sent spelling in param). TIME ZONE (#1312): " + CONTACT_TIMEZONE_NOTE + " The export applies the same rule as conduyt_list_deals." + LIST_USERS_DOC, {
71
72
  search: z.string().optional().describe("Search deal titles"),
72
73
  status: z.string().optional().describe("Filter by status (open, won, lost)"),
73
74
  pipeline: z.string().optional().describe("Filter by pipeline UUID"),
@@ -90,7 +91,7 @@ export function registerBulkTools(server, client) {
90
91
  });
91
92
  return formatResult(result);
92
93
  });
93
- strictInput(server.tool("conduyt_export_companies", "Export companies as JSON with filtering (GET /api/v1/companies/export, JSON only here): { companies, meta { total, exported_at, filters_applied } }. Owner or admin only (otherwise 403); Secure custom field values are always masked. At most 50,000 rows: past that 413 and nothing is exported (narrow the filters); the response is bounded at 25 MB (past it a structured response_too_large error says to narrow the filters). Rate limited to 5 exports a minute per workspace and address (429, wait Retry-After). The export is audited (an Activity row and an audit log row), so it is not a pure read. The API judges the query names first (batch33): a name the export does not read is 400 unknown_query_param { message, unknown[], accepted[], didYouMean } (it used to be ignored and every company exported) and two different values of format or of a single-value filter 400 query_param_conflict { message, param }; ownerId or ids that are not UUIDs are 400. This tool sends only accepted names.", {
94
+ strictInput(server.tool("conduyt_export_companies", "Export companies as JSON with filtering (GET /api/v1/companies/export, JSON only here): { companies, meta { total, exported_at, filters_applied } }. Owner or admin only (otherwise 403); Secure custom field values are always masked. At most 50,000 rows: past that 413 and nothing is exported (narrow the filters); the response is bounded at 25 MB (past it a structured response_too_large error says to narrow the filters). Rate limited to 5 exports a minute per workspace and address (429, wait Retry-After). The export is audited (an Activity row and an audit log row), so it is not a pure read. The API judges the query names first (batch33): a name the export does not read is 400 unknown_query_param { message, unknown[], accepted[], didYouMean } (it used to be ignored and every company exported) and two different values of format or of a single-value filter 400 query_param_conflict { message, param }; ownerId or ids that are not UUIDs are 400. This tool sends only accepted names." + LIST_USERS_DOC, {
94
95
  search: z.string().optional().describe("Search name, domain or phone"),
95
96
  industry: z.string().optional().describe("Filter by industry"),
96
97
  ownerId: z.string().uuid().optional().describe("Filter by owner user UUID"),
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { USER_FIELD_READ_DOC, USER_FIELD_RECORD_WRITE_DOC } from "./user-fields-doc.js";
2
+ import { REPLY_USERS_DOC, USER_FIELD_READ_DOC, USER_FIELD_RECORD_WRITE_DOC } from "./user-fields-doc.js";
3
3
  import { formatResult } from "../client.js";
4
4
  import { FORMULA_WRITE_NOTE } from "./formula-fields.js";
5
5
  export function registerCompanyTools(server, client) {
@@ -51,7 +51,7 @@ export function registerCompanyTools(server, client) {
51
51
  const result = await client.get(`/api/v1/companies/${encodeURIComponent(company_id)}/related?${params}`);
52
52
  return formatResult(result);
53
53
  });
54
- server.tool("conduyt_create_company", "Create a new company record with business details." + " " + FORMULA_WRITE_NOTE + " " + USER_FIELD_RECORD_WRITE_DOC, {
54
+ server.tool("conduyt_create_company", "Create a new company record with business details." + " " + FORMULA_WRITE_NOTE + " " + USER_FIELD_RECORD_WRITE_DOC + REPLY_USERS_DOC, {
55
55
  name: z.string().describe("Company name (required)"),
56
56
  domain: z.string().optional().describe("Company domain (e.g. 'acme.com')"),
57
57
  industry: z.string().optional().describe("Industry (e.g. 'Technology', 'Healthcare')"),
@@ -68,7 +68,7 @@ export function registerCompanyTools(server, client) {
68
68
  const result = await client.post("/api/v1/companies", params);
69
69
  return formatResult(result);
70
70
  });
71
- server.tool("conduyt_update_company", "Update a company's details — name, domain, industry, address, or any other field." + " " + FORMULA_WRITE_NOTE + " " + USER_FIELD_RECORD_WRITE_DOC, {
71
+ server.tool("conduyt_update_company", "Update a company's details — name, domain, industry, address, or any other field." + " " + FORMULA_WRITE_NOTE + " " + USER_FIELD_RECORD_WRITE_DOC + REPLY_USERS_DOC, {
72
72
  id: z.string().describe("Company UUID"),
73
73
  name: z.string().optional().describe("Updated company name"),
74
74
  domain: z.string().optional().describe("Updated domain"),
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { USER_FIELD_READ_DOC, USER_FIELD_RECORD_WRITE_DOC } from "./user-fields-doc.js";
2
+ import { LIST_USERS_DOC, REPLY_USERS_DOC, USER_FIELD_READ_DOC, USER_FIELD_RECORD_WRITE_DOC } from "./user-fields-doc.js";
3
3
  import { OFF_LIST_NOTE, TIMEZONE_FILTER_NOTE } from "./lender-options.js";
4
4
  import { formatResult, formatToolError } from "../client.js";
5
5
  import { FORMULA_FILTER_NOTE, FORMULA_WRITE_NOTE } from "./formula-fields.js";
@@ -141,7 +141,7 @@ export function registerContactTools(server, client) {
141
141
  params.set(`cf[${key}]`, value);
142
142
  return params;
143
143
  };
144
- server.tool("conduyt_list_contacts", "List and search contacts with filtering. To find the contact(s) holding a known email address, pass `email` (exact match on the primary or any secondary email); `search` is a substring search. To list the contacts carrying a tag (or any of several tags), pass `tagId` (uuid) or `tag` (name). Returns paginated results with name, email, phone, tags, source, and assignee. Each row carries `revision` (integer save revision; pass it back as expectedRevision on conduyt_update_contact or the collaborator tools). " + LIST_TOTAL_NOTE + " " + FORMULA_FILTER_NOTE + " " + TIMEZONE_FILTER_NOTE + " The API judges sort and order (batch32): an unknown sort field, or an order other than asc / desc, is 400 sort_invalid { message, param, accepted } (the sent spelling in param) and is never silently replaced by the default order. min_score that is not an integer 0..2147483647 is 400 invalid_min_score { message, param, accepted } (GET /contacts, /contacts/count and /contacts/export).", {
144
+ server.tool("conduyt_list_contacts", "List and search contacts with filtering. To find the contact(s) holding a known email address, pass `email` (exact match on the primary or any secondary email); `search` is a substring search. To list the contacts carrying a tag (or any of several tags), pass `tagId` (uuid) or `tag` (name). Returns paginated results with name, email, phone, tags, source, and assignee. Each row carries `revision` (integer save revision; pass it back as expectedRevision on conduyt_update_contact or the collaborator tools). " + LIST_TOTAL_NOTE + " " + FORMULA_FILTER_NOTE + " " + TIMEZONE_FILTER_NOTE + " The API judges sort and order (batch32): an unknown sort field, or an order other than asc / desc, is 400 sort_invalid { message, param, accepted } (the sent spelling in param) and is never silently replaced by the default order. min_score that is not an integer 0..2147483647 is 400 invalid_min_score { message, param, accepted } (GET /contacts, /contacts/count and /contacts/export)." + LIST_USERS_DOC, {
145
145
  ...contactFilterShape,
146
146
  // list-only filters (GET /contacts reads them; GET /contacts/count does not)
147
147
  dealContextOwners: z.string().optional().describe("Deal-context filter: comma-separated owner ids (query param `deal_context_owners`; list only, the count route does not read it)"),
@@ -176,7 +176,7 @@ export function registerContactTools(server, client) {
176
176
  const result = await client.get(`/api/v1/contacts/${id}`);
177
177
  return formatResult(result);
178
178
  });
179
- const createContactTool = server.tool("conduyt_create_contact", "Create a new contact in the CRM. Email or phone is recommended but not strictly required. With callId (a lead made from a contact-less inbound call) you must NOT send source or assignedTo: the server derives both from the call, and the request is refused if either is present." + INVALID_NUMBER_REFUSALS + " " + IDENTITY_CREATE_ANSWERS + " " + FORMULA_WRITE_NOTE + " " + OFF_LIST_NOTE + " " + USER_FIELD_RECORD_WRITE_DOC, {
179
+ const createContactTool = server.tool("conduyt_create_contact", "Create a new contact in the CRM. Email or phone is recommended but not strictly required. With callId (a lead made from a contact-less inbound call) you must NOT send source or assignedTo: the server derives both from the call, and the request is refused if either is present." + INVALID_NUMBER_REFUSALS + " " + IDENTITY_CREATE_ANSWERS + " " + FORMULA_WRITE_NOTE + " " + OFF_LIST_NOTE + " " + USER_FIELD_RECORD_WRITE_DOC + REPLY_USERS_DOC, {
180
180
  email: z.string().optional().describe("Contact email address"),
181
181
  firstName: z.string().optional().describe("First name"),
182
182
  lastName: z.string().optional().describe("Last name"),
@@ -206,7 +206,7 @@ export function registerContactTools(server, client) {
206
206
  created.inputSchema = Object.assign(base.superRefine((v, ctx) => { if (callDerivedFieldsConflict(v))
207
207
  ctx.addIssue({ code: z.ZodIssueCode.custom, message: CALL_DERIVED_REFUSAL, path: ["callId"] }); }), { shape: base.shape });
208
208
  }
209
- strictInput(server.tool("conduyt_update_contact", "Update an existing contact's fields — name, email, phone, company, owner (assignedTo), custom fields. A reassignment releases the previous owner unless keepPreviousOwnerAsCollaborator is true, which keeps them as a collaborator (read-only access to the lead and its cards). customFields merge into existing values (omit a key to leave it unchanged). Pass expectedRevision (the contact's `revision` as you read it) to refuse the save when the contact changed since." + INVALID_NUMBER_REFUSALS + " " + CONTACT_CHANGED + " " + IDENTITY_SAVE_RETRY + " " + FORMULA_WRITE_NOTE + " " + OFF_LIST_NOTE + " " + USER_FIELD_RECORD_WRITE_DOC, {
209
+ strictInput(server.tool("conduyt_update_contact", "Update an existing contact's fields — name, email, phone, company, owner (assignedTo), custom fields. A reassignment releases the previous owner unless keepPreviousOwnerAsCollaborator is true, which keeps them as a collaborator (read-only access to the lead and its cards). customFields merge into existing values (omit a key to leave it unchanged). Pass expectedRevision (the contact's `revision` as you read it) to refuse the save when the contact changed since." + INVALID_NUMBER_REFUSALS + " " + CONTACT_CHANGED + " " + IDENTITY_SAVE_RETRY + " " + FORMULA_WRITE_NOTE + " " + OFF_LIST_NOTE + " " + USER_FIELD_RECORD_WRITE_DOC + REPLY_USERS_DOC, {
210
210
  id: z.string().describe("Contact UUID"),
211
211
  email: z.string().optional().describe("Updated email"),
212
212
  firstName: z.string().optional().describe("Updated first name"),
@@ -255,7 +255,7 @@ export function registerContactTools(server, client) {
255
255
  const result = await client.del(`/api/v1/contacts/${encodeURIComponent(id)}`);
256
256
  return formatResult(result);
257
257
  });
258
- server.tool("conduyt_add_tags", "Add one or more existing tags to a contact by tag UUID. Tags must already exist (create them with conduyt_create_tag); this does NOT create tags.", {
258
+ server.tool("conduyt_add_tags", "Add one or more existing tags to a contact by tag UUID. Tags must already exist (create them with conduyt_create_tag); this does NOT create tags." + REPLY_USERS_DOC, {
259
259
  contactId: z.string().describe("Contact UUID"),
260
260
  tagIds: z.array(z.string()).describe("Tag UUIDs to add (must already exist)"),
261
261
  }, async ({ contactId, tagIds }) => {
@@ -277,7 +277,7 @@ export function registerContactTools(server, client) {
277
277
  const result = await client.post("/api/v1/contacts/verify-line-type", params);
278
278
  return formatResult(result);
279
279
  });
280
- strictInput(server.tool("conduyt_merge_contacts", "DESTRUCTIVE and not reversible through the API: merge duplicate contacts (POST /api/v1/contacts/merge; owner or admin). The survivor (`primaryId`) keeps its id and receives every related record of the losers (`secondaryIds`: tags, deals, messages, activities, tasks, appointments and so on) plus any field it lacks; each loser is then DELETED (soft-deleted, gone from lists and searches, no undelete). A forgotten (anonymized) contact cannot be merged. TWO STEPS, always in this order. STEP 1, preview: call with only primaryId + secondaryIds (confirmImpact absent or false); nothing is changed and the answer is { data: { dryRun: true, primary, secondaries, counts, totalRecords, guardCounts, filledFields, identifierOverflow: { intoPrimary, intoSlots, unstored }, blockers: { outbox } } } (the standard envelope: read the fields inside `data`). Show the user (or decide on) what will move and what will be deleted; `unstored` lists emails or phones with nowhere to go (they would be lost); `blockers.outbox` lists queued sends that must drain first. STEP 2, apply: call again with confirmImpact: true and pass back EXACTLY what the preview answered: expectedCounts = data.counts, expectedGuardCounts = data.guardCounts (both required), and expectedIdentifiers = data.identifierOverflow (recommended: without it the merge refuses only when a value would be dropped). The tool binds the confirm to the preview it returned: a confirm whose values do not equal a preview this server returned for the same survivor and losers in the last 10 minutes is refused locally (\"run the dry run first (no matching preview)\") and nothing is sent. LOSER ORDER: losers are merged in the order given: for each field the survivor lacks, the first loser in this order with a value wins; reorder to change precedence; the dry run's filledFields shows which fields will be filled. WHAT IS PINNED: the server refuses if the record counts, guard counts or identifier plan moved; other field edits made after this preview (a loser's name, company, source, address) are not detected. The server re-counts inside the merge: if the counts, guard counts or identifier plan moved since the preview it answers 409 (for example \"Merge impact changed. Refresh duplicate scan and try again.\"); that text is surfaced verbatim and nothing was merged: preview again and decide again, never reuse the old numbers. Other refusals, surfaced verbatim and never retried: 400 (primaryId missing, secondaryIds empty, primaryId inside secondaryIds, malformed expected values), 404 (a contact not found or not yours), 409 (queued work on the contacts being merged, a drip or sequence send in flight, a deal publication in flight, a refused forgotten contact). 503 with `code` merge_contacts_busy (a contact stayed busy for the whole lock budget: a delivery in flight, another merge or an erasure of the same contact) or merge_budget_exhausted (the time budget ran out): everything was rolled back, nothing changed; the error text carries the code and `Retry-After: <N>s`. This tool NEVER retries (one API job per key): wait at least that many seconds, then run the preview again. The apply answers { data: the merged survivor contact plus identifierOverflow }.", {
280
+ strictInput(server.tool("conduyt_merge_contacts", "DESTRUCTIVE and not reversible through the API: merge duplicate contacts (POST /api/v1/contacts/merge; owner or admin). The survivor (`primaryId`) keeps its id and receives every related record of the losers (`secondaryIds`: tags, deals, messages, activities, tasks, appointments and so on) plus any field it lacks; each loser is then DELETED (soft-deleted, gone from lists and searches, no undelete). A forgotten (anonymized) contact cannot be merged. TWO STEPS, always in this order. STEP 1, preview: call with only primaryId + secondaryIds (confirmImpact absent or false); nothing is changed and the answer is { data: { dryRun: true, primary, secondaries, counts, totalRecords, guardCounts, filledFields, identifierOverflow: { intoPrimary, intoSlots, unstored }, blockers: { outbox } } } (the standard envelope: read the fields inside `data`). Show the user (or decide on) what will move and what will be deleted; `unstored` lists emails or phones with nowhere to go (they would be lost); `blockers.outbox` lists queued sends that must drain first. STEP 2, apply: call again with confirmImpact: true and pass back EXACTLY what the preview answered: expectedCounts = data.counts, expectedGuardCounts = data.guardCounts (both required), and expectedIdentifiers = data.identifierOverflow (recommended: without it the merge refuses only when a value would be dropped). The tool binds the confirm to the preview it returned: a confirm whose values do not equal a preview this server returned for the same survivor and losers in the last 10 minutes is refused locally (\"run the dry run first (no matching preview)\") and nothing is sent. LOSER ORDER: losers are merged in the order given: for each field the survivor lacks, the first loser in this order with a value wins; reorder to change precedence; the dry run's filledFields shows which fields will be filled. WHAT IS PINNED: the server refuses if the record counts, guard counts or identifier plan moved; other field edits made after this preview (a loser's name, company, source, address) are not detected. The server re-counts inside the merge: if the counts, guard counts or identifier plan moved since the preview it answers 409 (for example \"Merge impact changed. Refresh duplicate scan and try again.\"); that text is surfaced verbatim and nothing was merged: preview again and decide again, never reuse the old numbers. Other refusals, surfaced verbatim and never retried: 400 (primaryId missing, secondaryIds empty, primaryId inside secondaryIds, malformed expected values), 404 (a contact not found or not yours), 409 (queued work on the contacts being merged, a drip or sequence send in flight, a deal publication in flight, a refused forgotten contact). 503 with `code` merge_contacts_busy (a contact stayed busy for the whole lock budget: a delivery in flight, another merge or an erasure of the same contact) or merge_budget_exhausted (the time budget ran out): everything was rolled back, nothing changed; the error text carries the code and `Retry-After: <N>s`. This tool NEVER retries (one API job per key): wait at least that many seconds, then run the preview again. The apply answers { data: the merged survivor contact plus identifierOverflow }." + REPLY_USERS_DOC, {
281
281
  primaryId: z.string().uuid().describe("The surviving contact UUID: it keeps its id and receives the losers' records"),
282
282
  secondaryIds: z.array(z.string().uuid()).min(1).max(50).describe("The duplicate contact UUIDs to merge into the survivor and DELETE (not the survivor itself). Order matters: " + LOSER_ORDER_NOTE),
283
283
  confirmImpact: z.boolean().optional().describe("Omit or false = STEP 1, the preview (nothing changes). true = STEP 2, apply the merge, with expectedCounts and expectedGuardCounts from the preview."),
@@ -6,4 +6,6 @@ export declare const PUSH_ACTIONS: readonly ["create", "update", "documents"];
6
6
  /** the push route can run up to its 300 s budget (a Delancey create sends its documents right after, as the documents press does) */
7
7
  export declare const PUSH_TIMEOUT_MS = 310000;
8
8
  export declare const PUSH_EXPECT_MODES: readonly ["test", "live"];
9
+ /** (parity46, app branch postclose44, settings.dealProfile.dealTabs / hideBackOfficeGroup; the whole binding is sent as given, the server validates) */
10
+ export declare const DEAL_TABS_NOTE = "postclose44: dealTabs (up to 12) are tabs whose rows are the card's OWN DEAL custom fields, shown after the contact tabs in this order: { key (lowercase letter first, then lowercase letters, digits or underscore, at most 40; unique across tabs AND dealTabs; general is reserved), label (1 to 40 characters, starting with a visible character), source: \"deal\" (required, the only value), fields (default []: up to 312 entries in tab order, each a row { key (a DEAL custom field key whose deal definition must exist in the workspace; at most 100 characters), label (optional, 1 to 80 characters, default the definition's label) } or a section heading { heading (1 to 60 characters of plain text) }; at most 12 headings and 300 rows), pipelineIds (optional, 1 to 100 workspace pipeline UUIDs: the tab shows on a card in one of them; absent with no showWhenAnyValue = every card the profile shows on), showWhenAnyValue (optional, only true: the tab also shows on any card whose own custom fields hold a non-empty value in one of the tab's keys) }. A deal tab's keys leave the General tab and the back-office group; deal tabs never count toward readiness. hideBackOfficeGroup: true makes the deal page stop rendering the back-office group (\"DPP / Portfolio\") under the profile; its fields stay defined and stored; absent or false = unchanged. A rule the server refuses is 422 invalid_deal_profile. Deal tab values are READ here (masked as the deal read masks them: a Secure value is the mask) and WRITTEN through the deal update's customFields (PATCH /deals/{id}), never through conduyt_update_deal_profile.";
9
11
  export declare function registerDealProfileTools(server: McpServer, client: ConduytClient): void;
@@ -17,19 +17,21 @@ const HELD_RESEND_NOTE = "A pending delancey_street submission (status unknown a
17
17
  const DELANCEY_DOCUMENTS_NOTE = "action documents (delancey_street only; creditors_relief answers 400 documents_not_supported) is the card's Send documents: it SENDS the files of the deal and of its contact that Delancey Street does not have yet, one POST /documents per file (one deal_partner_pushes row per file), and cannot be recalled. It needs a submission made from this card for the deal's CURRENT contact (409 not_submitted otherwise; 409 deal_has_no_contact, key_mode_changed and partner_not_configured as for a create; 404 not_found). These refusals are decided before anything is sent, so they RELEASE the Idempotency-Key (the same key may be retried at once); a 200 answer with result documents (even with stopped set or files not sent) is an executed press and SPENDS it. Each file goes inline (up to 4 MB; types pdf, png, jpg, jpeg, heic, tif, tiff, csv, xls, xlsx, doc, docx; a file outside them, over 4 MB or empty is refused before anything is sent and shows in the card's documents line as file_type_not_allowed, file_too_large or file_empty; file_unreadable = the stored bytes could not be read). An accepted create sends the documents right after itself, and its 200 answer then carries documents { total, sent, checked, pending, failed, results[], stopped, copy } (or documents { code } when they could not go). The documents press answers 200 { pushId, partner, action: documents, test, result: documents, total, sent, checked, pending, failed, results [{ pushId, fileId, status, code }], stopped, copy }: stopped is null, or budget (a press starts no new document after 120 s: press again to continue), or the per-file refusal that ended the press: push_in_flight, deal_busy, contact_busy, deal_changed (the deal's contact changed), deal_has_no_contact, not_found, erased or lost (these come as 200 with stopped set, not as an HTTP error); a file that got no definite answer (status unknown) is held and resent on the SAME key with the very same bytes (never stored twice), a LIVE attempt whose file changed (file_changed), whose Delancey key changed (key_changed) or whose deal changed (deal_changed) stays held for an admin; Delancey's own refusal codes (unauthorized, rate_limited, document_limit = 50 per deal, not_found, file_too_large) print as the code. A TEST key checks the files and stores nothing: checked counts the files it passed and test is true; sent still counts files an earlier LIVE press delivered. The press can run up to 300 s (this tool waits 310 s, then says the server may have applied it: read conduyt_get_deal_partner_pushes before pressing again). conduyt_get_deal_partner_pushes shows each Delancey card's documents { total, sent, checked, pending, failed, sending, test, files[] { fileId, filename, type, size, state (sent, checked, held, refused, failed, new), code, copy } } (files only for a caller who may push; a caller who can only view gets the counts without files); the documents rows are not in its pushes history. delsubnotice1286: when a contact is erased while a Delancey submission or a document may exist there (a lost or held one), the workspace admins get a notice naming the deal id only (no file name, no partner identifier); the notice can also follow a refused attempt that settled while the contact was being erased.";
18
18
  const DELANCEY_PUSH_NOTE = "delancey_street (the ISO Partner API) is enabled per workspace (config.partners.delancey_street.enabled plus a key; else 409 partner_disabled / partner_not_configured) and takes NEW submissions only: action create, one deal record per card (a card that already has its delancey_deal_id or a succeeded submission answers 409 already_submitted). A TEST key runs every check and creates nothing (the answer carries test: true; the card is not stamped). expectMode is the key mode the card showed (test or live): a changed key answers 409 key_mode_changed with nothing sent.";
19
19
  const PUSH_CODES = "400 documents_not_supported (action documents with creditors_relief); 403 deal_not_editable / push_not_permitted; 404; 409 partner_disabled, partner_not_configured (delancey_street: no API key in the workspace), partner_not_enabled, push_in_flight, needs_link, action_changed (the current state comes back), not_submitted (action documents before a delancey_street submission for the deal's current contact), deal_changed (the deal's contact changed), already_submitted (delancey_street takes a new submission only: the card already has its deal id), key_mode_changed { mode } (delancey_street: the workspace key is now a test or live key other than the expectMode you passed; nothing sent), deal_has_no_contact, contact_busy, reconcile_needs_admin, reconcile_ambiguous; 422 profile_incomplete (missing[] names each gap; nothing written, no partner call), profile_secure_field { secure[], missing[] } (a Secure value the push would send whose key the binding does not list in secureEgress FOR THAT PARTNER; nothing written, no partner call) or stage_automation_only (the card sits in a stage only automation may change); 503 deal_busy or partner_auth.";
20
+ /** (parity46, app branch postclose44, settings.dealProfile.dealTabs / hideBackOfficeGroup; the whole binding is sent as given, the server validates) */
21
+ export const DEAL_TABS_NOTE = "postclose44: dealTabs (up to 12) are tabs whose rows are the card's OWN DEAL custom fields, shown after the contact tabs in this order: { key (lowercase letter first, then lowercase letters, digits or underscore, at most 40; unique across tabs AND dealTabs; general is reserved), label (1 to 40 characters, starting with a visible character), source: \"deal\" (required, the only value), fields (default []: up to 312 entries in tab order, each a row { key (a DEAL custom field key whose deal definition must exist in the workspace; at most 100 characters), label (optional, 1 to 80 characters, default the definition's label) } or a section heading { heading (1 to 60 characters of plain text) }; at most 12 headings and 300 rows), pipelineIds (optional, 1 to 100 workspace pipeline UUIDs: the tab shows on a card in one of them; absent with no showWhenAnyValue = every card the profile shows on), showWhenAnyValue (optional, only true: the tab also shows on any card whose own custom fields hold a non-empty value in one of the tab's keys) }. A deal tab's keys leave the General tab and the back-office group; deal tabs never count toward readiness. hideBackOfficeGroup: true makes the deal page stop rendering the back-office group (\"DPP / Portfolio\") under the profile; its fields stay defined and stored; absent or false = unchanged. A rule the server refuses is 422 invalid_deal_profile. Deal tab values are READ here (masked as the deal read masks them: a Secure value is the mask) and WRITTEN through the deal update's customFields (PATCH /deals/{id}), never through conduyt_update_deal_profile.";
20
22
  /** fields: 1 to 100 keys; expected: any number of keys (the server caps only fields); both: key length 1 to 100 */
21
23
  const keyed = (min, max) => z.record(z.string().min(1).max(KEY_MAX), z.unknown()).refine((o) => Object.keys(o).length >= min && Object.keys(o).length <= max, { message: `must hold ${min} to ${max} keys` });
22
24
  export function registerDealProfileTools(server, client) {
23
25
  const dealId = z.string().uuid().describe("Deal UUID");
24
- server.tool("conduyt_get_deal_profile", "Read a deal's Deal profile (GET /api/v1/deals/{id}/profile): the CONTACT custom fields the workspace binds in settings.dealProfile, read from the card's PRIMARY contact (one value per contact; nothing is stored on the deal), arranged in tabs, plus the partner readiness (ready of total: readiness fields are needed to send to a partner, never to save or work the card; partners[key].actionName is the action's display name the readiness copy reads as \"Needed for <actionName>\", and a field's note is the binding's hint to the rep, null = none). { enabled: false } when the workspace has no binding or the card is outside its pipelines. A sensitive field is answered masked (last 4); conduyt_reveal_deal_profile_field returns the full value. Every answer carries cardKey, the same value the deal read answers as profileCardKey. Needs deals:view on the card (an API key needs the deals AND contacts scopes). 404 when the deal does not exist or the caller cannot see it.", { id: dealId }, async ({ id }) => formatResult(await client.get(`/api/v1/deals/${encodeURIComponent(id)}/profile`)));
25
- strictInput(server.tool("conduyt_update_deal_profile", `Edit Deal profile fields (PATCH /api/v1/deals/{id}/profile): writes the bound CONTACT custom fields of the card's primary contact through the contact write path (partial merge of only the submitted keys, audited as contact.updated). Needs deals:edit, the card's edit scope AND contacts:edit. fields: bound contact field key -> new value (1 to 100 keys; null clears). expected (optional): key -> the value you last saw (a sensitive field's token from conduyt_get_deal_profile, never its mask); every supplied key is checked under the contact lock, a mismatch answers 409 profile_field_changed with the current value and NOTHING is written; leave expected off to overwrite (latest edit wins). Returns the fresh profile. A value identical to the stored one is skipped and nothing is audited for it, so repeating the same call changes nothing more. ${PATCH_CODES}`, {
26
+ server.tool("conduyt_get_deal_profile", "Read a deal's Deal profile (GET /api/v1/deals/{id}/profile): the CONTACT custom fields the workspace binds in settings.dealProfile, read from the card's PRIMARY contact (one value per contact; nothing is stored on the deal), arranged in tabs, plus the partner readiness (ready of total: readiness fields are needed to send to a partner, never to save or work the card; partners[key].actionName is the action's display name the readiness copy reads as \"Needed for <actionName>\", and a field's note is the binding's hint to the rep, null = none). { enabled: false } when the workspace has no binding or the card is outside its pipelines. A sensitive field is answered masked (last 4); conduyt_reveal_deal_profile_field returns the full value. Every answer carries cardKey, the same value the deal read answers as profileCardKey. postclose44: a tab with source \"deal\" is a DEAL tab (listed after the contact tabs, only when its visibility rule shows it on this card): its fields are the card\'s own deal custom fields (masked as the deal read masks them), its layout lists the section headings and rows in order, and it is never readiness (missing 0, required false); dealTabKeys (present only when the binding has deal tabs) lists every deal key they bind and hideBackOfficeGroup: true (present only when the binding sets it) means the deal page does not render the back-office group. Needs deals:view on the card (an API key needs the deals AND contacts scopes). 404 when the deal does not exist or the caller cannot see it.", { id: dealId }, async ({ id }) => formatResult(await client.get(`/api/v1/deals/${encodeURIComponent(id)}/profile`)));
27
+ strictInput(server.tool("conduyt_update_deal_profile", `Edit Deal profile fields (PATCH /api/v1/deals/{id}/profile): writes the bound CONTACT custom fields of the card's primary contact through the contact write path (partial merge of only the submitted keys, audited as contact.updated). Needs deals:edit, the card's edit scope AND contacts:edit. fields: bound contact field key -> new value (1 to 100 keys; null clears). expected (optional): key -> the value you last saw (a sensitive field's token from conduyt_get_deal_profile, never its mask); every supplied key is checked under the contact lock, a mismatch answers 409 profile_field_changed with the current value and NOTHING is written; leave expected off to overwrite (latest edit wins). Contact fields only: the fields of a DEAL tab (source \"deal\") are written through the deal update\'s customFields, not here. Returns the fresh profile. A value identical to the stored one is skipped and nothing is audited for it, so repeating the same call changes nothing more. ${PATCH_CODES}`, {
26
28
  id: dealId,
27
29
  fields: keyed(1, PROFILE_KEYS_MAX).describe("Bound contact field key -> new value (null clears); 1 to 100 keys, each key 1 to 100 characters"),
28
30
  expected: keyed(0, Infinity).optional().describe("Optional: key -> the value you last saw (a sensitive field's token); a mismatch writes nothing (409 profile_field_changed)"),
29
31
  }, async ({ id, fields, expected }) => formatResult(await client.patch(`/api/v1/deals/${encodeURIComponent(id)}/profile`, { fields, expected }))));
30
32
  strictInput(server.tool("conduyt_reveal_deal_profile_field", "Reveal ONE sensitive Deal profile field in full (POST /api/v1/deals/{id}/profile/reveal with body { key }; the answer is never cached and carries the value's token; the old GET answers 405). A bound key whose contact field is Secure is revealed the same way but is refused for an API key (403 reveal_requires_session) and needs that field's own reveal set. Allowed only for a caller in the binding's reveal set (settings.dealProfile revealRoles / revealGroupIds; a super admin always) with contacts:view on a card they can see. Every reveal of a stored value is audited before the answer (deal_profile.reveal for a sensitive-only key; custom_field.revealed with via deal_profile for a Secure key), so each call is recorded; an empty field answers value null and is not audited. 400 invalid_body, invalid_json, profile_key_not_sensitive or deal_profile_not_enabled; 403 reveal_not_allowed or contacts_permission_required; 404.", { id: dealId, key: z.string().min(1).max(100).refine((v) => v.trim() !== "", { message: "key must not be blank" }).describe("The sensitive bound field key (exactly one)") }, async ({ id, key }) => formatResult(await client.post(`/api/v1/deals/${encodeURIComponent(id)}/profile/reveal`, { key }))));
31
- server.tool("conduyt_get_deal_profile_settings", "Read the workspace's Deal profile binding (GET /api/v1/settings/deal-profile; settings:view): { dealProfile (as stored), valid, danglingKeys (bound keys that name no contact custom field definition) }.", {}, async () => formatResult(await client.get("/api/v1/settings/deal-profile")));
32
- strictInput(server.tool("conduyt_set_deal_profile_settings", "REPLACE the workspace's Deal profile binding (PUT /api/v1/settings/deal-profile; settings:edit, and only an owner or admin: a delegated holder is refused 403 deal_profile_admin_only; audited as settings_deal_profile_updated): the whole object is replaced, nothing merges, so read the current one with conduyt_get_deal_profile_settings first. dealProfile holds enabled, pipelineIds (null or absent = every pipeline), generalTab { label }, tabs (up to 12: key, label, fields of { key (a CONTACT custom field key), label, control, options, span, sensitive, default, requiredFor, showWhen, note, validate }), repeating slot tables (each may set readinessPerSlot: true), footerNote, actions, secureEgress, revealRoles / revealGroupIds. secureEgress is an OBJECT per partner { creditors_relief: [custom field key], delancey_street: [custom field key] } (each list optional, up to 100 keys, none twice within a list, no other key; the Secure CONTACT or DEAL custom field keys the partner push MAY send TO THAT PARTNER: a key listed for one partner never unblocks the other; each key must name an existing contact or deal custom field, else 422 invalid_deal_profile; a Secure value the push would send to a partner whose list does not name the key refuses the push with 422 profile_secure_field, a listed one is sent masked to the last 4 in the preview, the stored snapshot and the history, and every send is audited); the older FLAT array [custom field key] is still accepted and is read as the Creditors Relief list ONLY (it never unblocks Delancey Street; a stored flat list keeps working). roleStamping { enabled, rules: [{ role: appointment_setter|opener|transfer_rep|closer, groupId (a member group UUID), fieldKey (a DEAL custom field of type user; another type is skipped), mode: first|latest }] } (up to 20 rules; on an owner change the new owner's role field is stamped when their group maps: first = never replaced once set, latest = the newest owner of the group wins; #1303). actions is [{ key, name }] (up to 20, one entry per partner key; a key named twice is refused; name 1 to 60 characters of plain text): the readiness copy on the deal page reads \"Needed for <name>\", and an action without one shows its partner's default name, else its key. A field's note is a hint to the rep shown under the field (plain text, 1 to 240 characters). readinessPerSlot: true on a repeating table makes each readiness column count one item per filled slot (3 creditors listed = 3 items per column in the N of M); absent, the whole table is one item per column. Plain text starts with a visible character and holds no control, line-separator, invisible (zero-width, soft hyphen, BOM) or bidirectional characters. conduyt_get_deal_profile answers the result as partners[key].actionName (the binding's saved name, else \"Send to <name>\" for a known partner, else the key) and fields[].note (null = none, absent on a repeating cell). Every pipeline and member group named must be this workspace's. No custom field definition is created or altered. 422 invalid_deal_profile (shape, a foreign pipeline or member group).", { dealProfile: z.record(z.string(), z.unknown()).describe("The whole binding object (validated by the server: secureEgress { creditors_relief: [field key], delancey_street: [field key] } or the older flat array (= Creditors Relief), each list up to 100 none twice, actions [{ key, name }] up to 20, a field note up to 240 plain-text characters, readinessPerSlot true on a repeating table)") }, async ({ dealProfile }) => {
33
+ server.tool("conduyt_get_deal_profile_settings", "Read the workspace's Deal profile binding (GET /api/v1/settings/deal-profile; settings:view): { dealProfile (as stored, including dealTabs and hideBackOfficeGroup when set), valid, danglingKeys (bound keys that name no contact custom field definition) }.", {}, async () => formatResult(await client.get("/api/v1/settings/deal-profile")));
34
+ strictInput(server.tool("conduyt_set_deal_profile_settings", "REPLACE the workspace's Deal profile binding (PUT /api/v1/settings/deal-profile; settings:edit, and only an owner or admin: a delegated holder is refused 403 deal_profile_admin_only; audited as settings_deal_profile_updated): the whole object is replaced, nothing merges, so read the current one with conduyt_get_deal_profile_settings first. dealProfile holds enabled, pipelineIds (null or absent = every pipeline), generalTab { label }, tabs (up to 12: key, label, fields of { key (a CONTACT custom field key), label, control, options, span, sensitive, default, requiredFor, showWhen, note, validate }), repeating slot tables (each may set readinessPerSlot: true), footerNote, actions, secureEgress, revealRoles / revealGroupIds, dealTabs, hideBackOfficeGroup (below). secureEgress is an OBJECT per partner { creditors_relief: [custom field key], delancey_street: [custom field key] } (each list optional, up to 100 keys, none twice within a list, no other key; the Secure CONTACT or DEAL custom field keys the partner push MAY send TO THAT PARTNER: a key listed for one partner never unblocks the other; each key must name an existing contact or deal custom field, else 422 invalid_deal_profile; a Secure value the push would send to a partner whose list does not name the key refuses the push with 422 profile_secure_field, a listed one is sent masked to the last 4 in the preview, the stored snapshot and the history, and every send is audited); the older FLAT array [custom field key] is still accepted and is read as the Creditors Relief list ONLY (it never unblocks Delancey Street; a stored flat list keeps working). roleStamping { enabled, rules: [{ role: appointment_setter|opener|transfer_rep|closer, groupId (a member group UUID), fieldKey (a DEAL custom field of type user; another type is skipped), mode: first|latest }] } (up to 20 rules; on an owner change the new owner's role field is stamped when their group maps: first = never replaced once set, latest = the newest owner of the group wins; #1303). actions is [{ key, name }] (up to 20, one entry per partner key; a key named twice is refused; name 1 to 60 characters of plain text): the readiness copy on the deal page reads \"Needed for <name>\", and an action without one shows its partner's default name, else its key. A field's note is a hint to the rep shown under the field (plain text, 1 to 240 characters). readinessPerSlot: true on a repeating table makes each readiness column count one item per filled slot (3 creditors listed = 3 items per column in the N of M); absent, the whole table is one item per column. Plain text starts with a visible character and holds no control, line-separator, invisible (zero-width, soft hyphen, BOM) or bidirectional characters. conduyt_get_deal_profile answers the result as partners[key].actionName (the binding's saved name, else \"Send to <name>\" for a known partner, else the key) and fields[].note (null = none, absent on a repeating cell). " + DEAL_TABS_NOTE + " Every pipeline and member group named must be this workspace's. No custom field definition is created or altered. 422 invalid_deal_profile (shape, a foreign pipeline or member group).", { dealProfile: z.record(z.string(), z.unknown()).describe("The whole binding object (validated by the server: secureEgress { creditors_relief: [field key], delancey_street: [field key] } or the older flat array (= Creditors Relief), each list up to 100 none twice, actions [{ key, name }] up to 20, a field note up to 240 plain-text characters, readinessPerSlot true on a repeating table, dealTabs [{ key, label, source: deal, fields, pipelineIds?, showWhenAnyValue? }] up to 12, hideBackOfficeGroup boolean)") }, async ({ dealProfile }) => {
33
35
  const problem = secureEgressProblem(dealProfile);
34
36
  if (problem)
35
37
  return fail(problem);
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { USER_FIELD_READ_DOC, USER_FIELD_RECORD_WRITE_DOC, USER_FIELD_WRITE_DOC } from "./user-fields-doc.js";
2
+ import { LIST_USERS_DOC, REPLY_USERS_DOC, USER_FIELD_READ_DOC, USER_FIELD_RECORD_WRITE_DOC, USER_FIELD_WRITE_DOC } from "./user-fields-doc.js";
3
3
  import { OFF_LIST_NOTE } from "./lender-options.js";
4
4
  import { ROLE_COLUMNS_NOTE } from "./batch33-surface.js";
5
5
  import { formatResult } from "../client.js";
@@ -58,7 +58,7 @@ function boardSnapshotColumns(a, f) {
58
58
  return a.board_columns.map((c) => (c.limit === undefined ? c.stageId : `${c.stageId}:${c.limit}`)).join(",");
59
59
  }
60
60
  export function registerDealTools(server, client) {
61
- strictInput(server.tool("conduyt_list_deals", "List deals with filtering by pipeline, stage, assignee, or status. Returns deal title, value, stage, contact, and dates. Filter by pipeline/stage NAME (the same names you import with) or by UUID — both camelCase (pipelineName) and snake_case (pipeline_name) argument names are accepted. An unknown name returns a clear error, never the whole account. Each deal row carries hasNextStep (boolean: an open task or a booked appointment from a day ago on; the Needs next action rule's own answer) and nextAppointmentAt (ISO string or null; null unless your key can view the calendar, even when hasNextStep is true). PIPELINE HEALTH: pass health_summary=true to get the Pipeline health strip for the same filtered set instead of the deal list: { totalOpenDeals, atRiskValue, checks[] (key, label, severity, color, rule, count, value; the six checks high_value_idle, stale, unassigned, needs_action, missing_close_date, missing_contact, ordered by money at risk), deals }. Add health_check to also get that check's first page of deals (highest value first) as deals: { check, offset, items, hasMore, nextCursor, total }; deals is null without a check. Page with health_cursor (the previous nextCursor, passed back UNCHANGED: an opaque signed token) or health_offset, and health_rows_only=true to get just the page without the summary: the answer is {data:{deals:{check, offset, items, hasMore, nextCursor}}} (the page sits under data.deals). " + HEALTH_ERRORS + " " + BOARD_SNAPSHOT_DOC + " " + BUSY_503_DOC + MIRROR_READ_DOC + " A mirror key is not filterable (422 mirror_not_filterable). The API judges the query NAMES (batch32, #1313): a name GET /deals does not read is 400 unknown_query_param { message, unknown[], accepted[] (every name it reads), didYouMean { name: accepted twin } for the camelCase / snake_case twin of an accepted name } and is never silently ignored (it used to answer the unfiltered list); two different values for a single-value name (status, contact_id, search, stale, needsAction, summary, latest_updated, system_occupancy, sort, order, page, per_page, value_min / minValue, value_max / maxValue) are 400 query_param_conflict { message, param }, an exact repeat is accepted. This tool sends only accepted names (pipeline, pipeline_name, stage, stage_name, assigned_to, status, search, contact_timezone, page, per_page, board_snapshot, board_columns, health_summary, health_check, health_limit, health_offset, health_cursor, health_rows_only), so these two codes mean an older or newer server than this MCP expects; they reach you as `Conduyt API 400: <message>` with the code. The API judges sort and order (batch32): an unknown sort field, or an order other than asc / desc, is 400 sort_invalid { message, param, accepted } (the sent spelling in param) and is never silently replaced by the default order. The deal value bounds are judged too: value_min / minValue and value_max / maxValue that are non-numeric or outside the deal value column range (-9999999999.99..9999999999.99) are 400 invalid_value_min / invalid_value_max { message, param, accepted } (absent or empty = no filter; an alias spelling answers the same code with the sent spelling in param)." + " " + ROLE_COLUMNS_NOTE + " TIME ZONE (#1312): " + CONTACT_TIMEZONE_NOTE, {
61
+ strictInput(server.tool("conduyt_list_deals", "List deals with filtering by pipeline, stage, assignee, or status. Returns deal title, value, stage, contact, and dates. Filter by pipeline/stage NAME (the same names you import with) or by UUID — both camelCase (pipelineName) and snake_case (pipeline_name) argument names are accepted. An unknown name returns a clear error, never the whole account. Each deal row carries hasNextStep (boolean: an open task or a booked appointment from a day ago on; the Needs next action rule's own answer) and nextAppointmentAt (ISO string or null; null unless your key can view the calendar, even when hasNextStep is true). PIPELINE HEALTH: pass health_summary=true to get the Pipeline health strip for the same filtered set instead of the deal list: { totalOpenDeals, atRiskValue, checks[] (key, label, severity, color, rule, count, value; the six checks high_value_idle, stale, unassigned, needs_action, missing_close_date, missing_contact, ordered by money at risk), deals }. Add health_check to also get that check's first page of deals (highest value first) as deals: { check, offset, items, hasMore, nextCursor, total }; deals is null without a check. Page with health_cursor (the previous nextCursor, passed back UNCHANGED: an opaque signed token) or health_offset, and health_rows_only=true to get just the page without the summary: the answer is {data:{deals:{check, offset, items, hasMore, nextCursor}}} (the page sits under data.deals). " + HEALTH_ERRORS + " " + BOARD_SNAPSHOT_DOC + " " + BUSY_503_DOC + MIRROR_READ_DOC + " A mirror key is not filterable (422 mirror_not_filterable). The API judges the query NAMES (batch32, #1313): a name GET /deals does not read is 400 unknown_query_param { message, unknown[], accepted[] (every name it reads), didYouMean { name: accepted twin } for the camelCase / snake_case twin of an accepted name } and is never silently ignored (it used to answer the unfiltered list); two different values for a single-value name (status, contact_id, search, stale, needsAction, summary, latest_updated, system_occupancy, sort, order, page, per_page, value_min / minValue, value_max / maxValue) are 400 query_param_conflict { message, param }, an exact repeat is accepted. This tool sends only accepted names (pipeline, pipeline_name, stage, stage_name, assigned_to, status, search, contact_timezone, page, per_page, board_snapshot, board_columns, health_summary, health_check, health_limit, health_offset, health_cursor, health_rows_only), so these two codes mean an older or newer server than this MCP expects; they reach you as `Conduyt API 400: <message>` with the code. The API judges sort and order (batch32): an unknown sort field, or an order other than asc / desc, is 400 sort_invalid { message, param, accepted } (the sent spelling in param) and is never silently replaced by the default order. The deal value bounds are judged too: value_min / minValue and value_max / maxValue that are non-numeric or outside the deal value column range (-9999999999.99..9999999999.99) are 400 invalid_value_min / invalid_value_max { message, param, accepted } (absent or empty = no filter; an alias spelling answers the same code with the sent spelling in param)." + " " + ROLE_COLUMNS_NOTE + " TIME ZONE (#1312): " + CONTACT_TIMEZONE_NOTE + LIST_USERS_DOC, {
62
62
  pipeline: z.string().optional().describe("Filter by pipeline UUID (canonical). Aliases: pipelineId, pipeline_id."),
63
63
  pipelineId: z.string().optional().describe("Filter by pipeline UUID (alias of pipeline)."),
64
64
  pipeline_id: z.string().optional().describe("snake_case alias of pipelineId."),
@@ -196,7 +196,7 @@ export function registerDealTools(server, client) {
196
196
  const result = await client.get(`/api/v1/deals/lead-id?${params}`);
197
197
  return formatResult(result);
198
198
  }));
199
- strictInput(server.tool("conduyt_pipeline_health_fix_deal", "Pipeline health QUICK FIX for a deal row (PATCH /api/v1/deals/{id} with checkOrigin). Pass the health check the row came from, the deal's updatedAt exactly as the health row carried it (expectedUpdatedAt, REQUIRED), and ONLY that check's fix: stale = stageId (+ optional expectedStageId, the stage the move was chosen against); unassigned = assignedTo; missing_close_date = expectedCloseDate; missing_contact = contactId. Each set to a value; any other combination is refused 400 health_fix_mismatch and nothing is read or written. For the next-action checks (high_value_idle, needs_action) use conduyt_pipeline_health_fix_next_action instead. Refusals reach you verbatim (status, server message, code, and the deal's CURRENT health row) and are NEVER retried. Error text grammar: `Conduyt API <status>: <message>[ [Retry-After: Ns]][ <one JSON object, the final token>]` (see README, Error text grammar). 409 deal_changed (the deal is no longer at expectedUpdatedAt; error text carries updatedAt and the current row: read it, choose again against row.updatedAt), 409 deal_check_cleared (the deal no longer fails that check; nothing written), a 409 without a code (a stage move by another writer, a stale expectedStageId, an in-flight publication), 400 health_fix_mismatch, 404 (no such deal, or your key cannot see it). The row in a refusal is null when your key can no longer see the deal. Ordinary edits (several fields, no health context) stay on conduyt_update_deal.", {
199
+ strictInput(server.tool("conduyt_pipeline_health_fix_deal", "Pipeline health QUICK FIX for a deal row (PATCH /api/v1/deals/{id} with checkOrigin). Pass the health check the row came from, the deal's updatedAt exactly as the health row carried it (expectedUpdatedAt, REQUIRED), and ONLY that check's fix: stale = stageId (+ optional expectedStageId, the stage the move was chosen against); unassigned = assignedTo; missing_close_date = expectedCloseDate; missing_contact = contactId. Each set to a value; any other combination is refused 400 health_fix_mismatch and nothing is read or written. For the next-action checks (high_value_idle, needs_action) use conduyt_pipeline_health_fix_next_action instead. Refusals reach you verbatim (status, server message, code, and the deal's CURRENT health row) and are NEVER retried. Error text grammar: `Conduyt API <status>: <message>[ [Retry-After: Ns]][ <one JSON object, the final token>]` (see README, Error text grammar). 409 deal_changed (the deal is no longer at expectedUpdatedAt; error text carries updatedAt and the current row: read it, choose again against row.updatedAt), 409 deal_check_cleared (the deal no longer fails that check; nothing written), a 409 without a code (a stage move by another writer, a stale expectedStageId, an in-flight publication), 400 health_fix_mismatch, 404 (no such deal, or your key cannot see it). The row in a refusal is null when your key can no longer see the deal. Ordinary edits (several fields, no health context) stay on conduyt_update_deal." + REPLY_USERS_DOC, {
200
200
  dealId: z.string().uuid().describe("Deal UUID"),
201
201
  checkOrigin: z.enum(["stale", "unassigned", "missing_close_date", "missing_contact"]).describe("The health check this edit fixes"),
202
202
  expectedUpdatedAt: z.string().datetime({ message: "expectedUpdatedAt must be the deal's updatedAt exactly as the health row carried it (UTC, trailing Z, e.g. 2026-10-06T23:19:00.000Z)" }).describe("REQUIRED: the deal's updatedAt as the health row carried it (PipelineHealthDeal.updatedAt). A deal at another version is refused 409 deal_changed."),
@@ -231,7 +231,7 @@ export function registerDealTools(server, client) {
231
231
  const result = await client.get(`/api/v1/deals/${id}`);
232
232
  return formatResult(result);
233
233
  });
234
- server.tool("conduyt_create_deal", "Create a new deal in a pipeline with full attributes. Requires a pipeline and stage ID — use conduyt_list_pipelines to discover them. Supports currency (e.g. GBP), probability, priority, expected close date, and structured custom-field values. A stage set to \"Entry by automation only\" refuses every entry here: 422 code stage_automation_only, message \"Only an automation can move a deal into <stage>\" (admins and API keys included; moving out is free)." + " A mirror key cannot be set on a new deal: 422 mirror_not_writable." + " " + FORMULA_WRITE_NOTE + " " + OFF_LIST_NOTE + USER_FIELD_RECORD_WRITE_DOC, {
234
+ server.tool("conduyt_create_deal", "Create a new deal in a pipeline with full attributes. Requires a pipeline and stage ID — use conduyt_list_pipelines to discover them. Supports currency (e.g. GBP), probability, priority, expected close date, and structured custom-field values. A stage set to \"Entry by automation only\" refuses every entry here: 422 code stage_automation_only, message \"Only an automation can move a deal into <stage>\" (admins and API keys included; moving out is free)." + " A mirror key cannot be set on a new deal: 422 mirror_not_writable." + " " + FORMULA_WRITE_NOTE + " " + OFF_LIST_NOTE + USER_FIELD_RECORD_WRITE_DOC + REPLY_USERS_DOC, {
235
235
  title: z.string().describe("Deal title (e.g. 'Acme Corp — Enterprise Plan')"),
236
236
  pipelineId: z.string().describe("Pipeline UUID"),
237
237
  stageId: z.string().describe("Stage UUID within the pipeline"),
@@ -250,7 +250,7 @@ export function registerDealTools(server, client) {
250
250
  const result = await client.post("/api/v1/deals", params);
251
251
  return formatResult(result);
252
252
  });
253
- server.tool("conduyt_update_deal", "Update a deal — move stage, change value/currency, set probability or expected close date, reassign (assignedTo: the previous owner is released unless they own another open card of the lead, or keepPreviousOwnerAsCollaborator is true, which keeps them as a read-only collaborator of the contact; the flag is refused 400 without assignedTo and 400 together with a contact change), mark won/lost, or write structured custom-field values. customFields are merged into existing values (omit a key to leave it unchanged). A stage set to \"Entry by automation only\" refuses every entry here: 422 code stage_automation_only, message \"Only an automation can move a deal into <stage>\" (admins and API keys included; moving out is free)." + MIRROR_WRITE_DOC + " " + FORMULA_WRITE_NOTE + " " + OFF_LIST_NOTE + " " + USER_FIELD_WRITE_DOC, {
253
+ server.tool("conduyt_update_deal", "Update a deal — move stage, change value/currency, set probability or expected close date, reassign (assignedTo: the previous owner is released unless they own another open card of the lead, or keepPreviousOwnerAsCollaborator is true, which keeps them as a read-only collaborator of the contact; the flag is refused 400 without assignedTo and 400 together with a contact change), mark won/lost, or write structured custom-field values. customFields are merged into existing values (omit a key to leave it unchanged). A stage set to \"Entry by automation only\" refuses every entry here: 422 code stage_automation_only, message \"Only an automation can move a deal into <stage>\" (admins and API keys included; moving out is free)." + MIRROR_WRITE_DOC + " " + FORMULA_WRITE_NOTE + " " + OFF_LIST_NOTE + " " + USER_FIELD_WRITE_DOC + REPLY_USERS_DOC, {
254
254
  id: z.string().describe("Deal UUID"),
255
255
  title: z.string().optional().describe("Updated title"),
256
256
  stageId: z.string().optional().describe("Move to a new stage UUID"),
@@ -318,7 +318,7 @@ export function registerDealTools(server, client) {
318
318
  const result = await client.post(`/api/v1/imports/${jobId}/process`, {});
319
319
  return formatResult({ jobId, ...result });
320
320
  });
321
- server.tool("conduyt_add_deal_tags", "Tag a deal with one or more EXISTING tags by tag UUID. Tags must already exist (create them with conduyt_create_tag); this does NOT create tags. Deals support tags just like contacts — use this to segment high-value or priority deals. To tag several deals, call this once per deal.", {
321
+ server.tool("conduyt_add_deal_tags", "Tag a deal with one or more EXISTING tags by tag UUID. Tags must already exist (create them with conduyt_create_tag); this does NOT create tags. Deals support tags just like contacts — use this to segment high-value or priority deals. To tag several deals, call this once per deal." + REPLY_USERS_DOC, {
322
322
  dealId: z.string().describe("Deal UUID"),
323
323
  tagIds: z.array(z.string()).describe("Tag UUIDs to add to the deal (must already exist; non-empty)"),
324
324
  }, async ({ dealId, tagIds }) => {
@@ -1,3 +1,21 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { ConduytClient } from "../client.js";
3
+ /**
4
+ * (parity46, app branch reportbuilder45, lib/report-column-labels.ts) a saved report's own column headers: { <column name>: <header> }.
5
+ * The API trims a header, then refuses one over 60 characters or holding a control character (line breaks, tabs, 0x00-0x1F, 0x7F-0x9F);
6
+ * an empty header (or one equal to the field's own label) just drops the key, which returns that column to its field label. Whether a
7
+ * key names one of the report's columns and whether a header collides with another column's header (own or field label, ignoring case
8
+ * and outer spaces) needs the field labels and is judged by the API: 422 with its message, never retried.
9
+ */
10
+ export declare const COLUMN_HEADER_MAX = 60;
11
+ /** (parity47 r3, Codex parity47-r2 P2) a JSON key "__proto__" (and "constructor" / "prototype") is never a report column, so the API
12
+ * refuses it (422 "not one of the report's columns"); z.record would silently DROP it, turning { "__proto__": "x" } into {} (on update,
13
+ * "remove every rename"). The raw keys are checked before the record schema sees them, so such a request is refused and nothing is sent. */
14
+ export declare const FORBIDDEN_COLUMN_KEYS: Set<string>;
15
+ /** the one key rule the tool can check without the field labels: every renamed column must be one of the columns being saved (the API's own first check) */
16
+ export declare function columnLabelsProblem(labels: Record<string, string> | null | undefined, columns: readonly string[] | undefined): string | null;
17
+ /** (parity47 r2, Codex parity47-r1 P2) the value SENT is the trimmed one, exactly as the API stores it (lib/report-column-labels.ts
18
+ * normalizeColumnLabels: trim, then the length and control-character rules); the schema checks that same trimmed value, so a
19
+ * leading / trailing line break or tab never leaves the machine and an interior one is refused before any request */
20
+ export declare function trimmedColumnLabels<T extends Record<string, string> | null | undefined>(labels: T): T;
3
21
  export declare function registerReportTools(server: McpServer, client: ConduytClient): void;
@@ -23,10 +23,72 @@ const pivotSchema = z.object({
23
23
  format: z.enum(["number", "integer", "currency", "percent"]).optional().describe("How this measure is displayed (a property of the measure, not the report)"),
24
24
  })).min(1).max(5),
25
25
  }).describe("Pivot table on the report (contacts / deals): every cell, row totals, column totals and the grand total come from the same filtered rows as the table; XLSX exports and deliveries add a Pivot sheet");
26
+ /**
27
+ * (parity46, app branch reportbuilder45, lib/report-column-labels.ts) a saved report's own column headers: { <column name>: <header> }.
28
+ * The API trims a header, then refuses one over 60 characters or holding a control character (line breaks, tabs, 0x00-0x1F, 0x7F-0x9F);
29
+ * an empty header (or one equal to the field's own label) just drops the key, which returns that column to its field label. Whether a
30
+ * key names one of the report's columns and whether a header collides with another column's header (own or field label, ignoring case
31
+ * and outer spaces) needs the field labels and is judged by the API: 422 with its message, never retried.
32
+ */
33
+ export const COLUMN_HEADER_MAX = 60;
34
+ const hasControlChars = (text) => {
35
+ for (let i = 0; i < text.length; i++) {
36
+ const code = text.charCodeAt(i);
37
+ if (code <= 0x1f || (code >= 0x7f && code <= 0x9f))
38
+ return true;
39
+ }
40
+ return false;
41
+ };
42
+ const headerSchema = z.string().superRefine((value, ctx) => {
43
+ const h = value.trim();
44
+ if (h.length > COLUMN_HEADER_MAX)
45
+ ctx.addIssue({ code: "custom", message: `a header is at most ${COLUMN_HEADER_MAX} characters` });
46
+ if (hasControlChars(h))
47
+ ctx.addIssue({ code: "custom", message: "a header cannot contain line breaks, tabs or other control characters" });
48
+ });
49
+ const COLUMN_LABELS_DOC = "columnLabels: { <column name>: <header> } renames the headers this report shows and prints (table, CSV / Excel exports, scheduled e-mails, dashboard tiles) without changing the field underneath. Every key must be one of the report's columns; a header is trimmed, at most 60 characters, one line (no line breaks or control characters); an empty header, or one equal to the field's own label, removes the rename; a header may not match another column's header (its own or its field label, ignoring case and outer spaces). The API answers 422 with its message for a key that is not a column, a non-text header, one over 60 characters, a control character or a collision.";
50
+ /** (parity47 r3, Codex parity47-r2 P2) a JSON key "__proto__" (and "constructor" / "prototype") is never a report column, so the API
51
+ * refuses it (422 "not one of the report's columns"); z.record would silently DROP it, turning { "__proto__": "x" } into {} (on update,
52
+ * "remove every rename"). The raw keys are checked before the record schema sees them, so such a request is refused and nothing is sent. */
53
+ export const FORBIDDEN_COLUMN_KEYS = new Set(["__proto__", "constructor", "prototype"]);
54
+ const columnLabelsSchema = z.preprocess((raw, ctx) => {
55
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) {
56
+ for (const key of Object.keys(raw))
57
+ if (FORBIDDEN_COLUMN_KEYS.has(key))
58
+ ctx.addIssue({ code: "custom", message: `columnLabels names "${key}", which is not one of the report's columns` });
59
+ }
60
+ return raw;
61
+ }, z.record(z.string().min(1), headerSchema)).describe(COLUMN_LABELS_DOC);
62
+ /** the one key rule the tool can check without the field labels: every renamed column must be one of the columns being saved (the API's own first check) */
63
+ export function columnLabelsProblem(labels, columns) {
64
+ if (!labels || !columns)
65
+ return null;
66
+ for (const key of Object.keys(labels))
67
+ if (!columns.includes(key))
68
+ return `columnLabels names "${key}", which is not one of the report's columns`;
69
+ return null;
70
+ }
71
+ /** (parity47 r2, Codex parity47-r1 P2) the value SENT is the trimmed one, exactly as the API stores it (lib/report-column-labels.ts
72
+ * normalizeColumnLabels: trim, then the length and control-character rules); the schema checks that same trimmed value, so a
73
+ * leading / trailing line break or tab never leaves the machine and an interior one is refused before any request */
74
+ export function trimmedColumnLabels(labels) {
75
+ if (!labels)
76
+ return labels;
77
+ // a null-prototype object: no key can reach a prototype setter
78
+ const out = Object.create(null);
79
+ for (const [k, v] of Object.entries(labels)) {
80
+ if (FORBIDDEN_COLUMN_KEYS.has(k))
81
+ throw new Error(`columnLabels names "${k}", which is not one of the report's columns`);
82
+ out[k] = v.trim();
83
+ }
84
+ return out;
85
+ }
86
+ const fail = (text) => ({ content: [{ type: "text", text }], isError: true });
26
87
  export function registerReportTools(server, client) {
27
88
  server.tool("conduyt_report_fields", "The field catalogue a custom report may use on a base: the entity's own columns, its per-row rollups (contacts/deals) and the account's custom fields, with type, operators and whether each can group, sort or be measured. Read this before building a report.", { entity: z.enum(["contacts", "deals", "activities", "tasks", "messages", "invoices"]).describe("The report base") }, async ({ entity }) => formatResult(await client.get(`/api/v1/reports/custom/fields?entity=${encodeURIComponent(entity)}`)));
28
89
  server.tool("conduyt_list_reports", "List the account's saved custom reports (shared ones and your own), with their definition and last-run status.", {}, async () => formatResult(await client.get("/api/v1/reports/custom")));
29
- server.tool("conduyt_create_report", "Create a saved custom report. contacts/deals bases support rollup columns, cf:<key> custom fields, a Smart View population and groupBy2 (see conduyt_report_fields).", {
90
+ server.tool("conduyt_get_report", "Read one saved custom report (GET /api/v1/reports/custom/{id}): its definition (name, entity, columns, filters, sort, grouping, pivot, population, sharing) and columnLabels (the report's own column headers, { column: header }), plus keptColumns: the report's OWN columns that the selectable catalogue (conduyt_report_fields) leaves out, such as a custom field made Secure after the report was saved, each as { name, label, type, kind: custom, operators: [], selectable: false } with the runtime label. They are never offered for new reports; read them to label or keep those columns. 404 when the report does not exist or you may not open it.", { id: z.string().uuid().describe("Saved report id (from conduyt_list_reports)") }, async ({ id }) => formatResult(await client.get(`/api/v1/reports/custom/${encodeURIComponent(id)}`)));
91
+ server.tool("conduyt_create_report", "Create a saved custom report. contacts/deals bases support rollup columns, cf:<key> custom fields, a Smart View population and groupBy2 (see conduyt_report_fields). " + COLUMN_LABELS_DOC, {
30
92
  name: z.string().min(1).max(120),
31
93
  description: z.string().max(500).optional(),
32
94
  entity: z.enum(["contacts", "deals", "activities", "tasks", "messages", "invoices"]),
@@ -44,7 +106,12 @@ export function registerReportTools(server, client) {
44
106
  isShared: z.boolean().optional().describe("Visible to the whole account (default false = only you and admins)"),
45
107
  isPrivate: z.boolean().optional().describe("Only the creator and admins can open it, even when shared to a dashboard (default false)"),
46
108
  pivot: pivotSchema.optional(),
47
- }, async ({ name, description, entity, columns, filters, sortBy, sortDir, groupBy, groupBy2, timeGrain, aggregate, measureField, chartType, population, isShared, isPrivate, pivot }) => {
109
+ columnLabels: columnLabelsSchema.nullable().optional(),
110
+ }, async ({ name, description, entity, columns, filters, sortBy, sortDir, groupBy, groupBy2, timeGrain, aggregate, measureField, chartType, population, isShared, isPrivate, pivot, columnLabels }) => {
111
+ const problem = columnLabelsProblem(columnLabels, columns);
112
+ columnLabels = trimmedColumnLabels(columnLabels);
113
+ if (problem)
114
+ return fail(problem);
48
115
  // Inline body (undefined fields drop out in JSON) — readable by the contract verifier's static parser.
49
116
  const result = await client.post("/api/v1/reports/custom", {
50
117
  name,
@@ -64,6 +131,7 @@ export function registerReportTools(server, client) {
64
131
  isShared,
65
132
  isPrivate,
66
133
  pivot,
134
+ columnLabels,
67
135
  });
68
136
  return formatResult(result);
69
137
  });
@@ -80,7 +148,7 @@ export function registerReportTools(server, client) {
80
148
  const qs = params.toString();
81
149
  return formatResult(await client.post(`/api/v1/reports/custom/${encodeURIComponent(id)}/run${qs ? `?${qs}` : ""}`, {}));
82
150
  });
83
- server.tool("conduyt_preview_report", "Run an UNSAVED report definition (10 rows) to check columns and filters before saving. Same fields as conduyt_create_report.", {
151
+ server.tool("conduyt_preview_report", "Run an UNSAVED report definition (10 rows) to check columns and filters before saving. Same fields as conduyt_create_report; columnLabels shows the renamed headers in the preview. " + COLUMN_LABELS_DOC, {
84
152
  entity: z.enum(["contacts", "deals", "activities", "tasks", "messages", "invoices"]),
85
153
  columns: z.array(z.string()).min(1).max(60),
86
154
  filters: z.array(filterSchema).max(30).optional(),
@@ -93,7 +161,12 @@ export function registerReportTools(server, client) {
93
161
  measureField: z.string().optional(),
94
162
  population: z.object({ smartViewId: z.string().uuid().nullable().optional() }).optional(),
95
163
  pivot: pivotSchema.optional(),
96
- }, async ({ entity, columns, filters, sortBy, sortDir, groupBy, groupBy2, timeGrain, aggregate, measureField, population, pivot }) => {
164
+ columnLabels: columnLabelsSchema.nullable().optional(),
165
+ }, async ({ entity, columns, filters, sortBy, sortDir, groupBy, groupBy2, timeGrain, aggregate, measureField, population, pivot, columnLabels }) => {
166
+ const problem = columnLabelsProblem(columnLabels, columns);
167
+ columnLabels = trimmedColumnLabels(columnLabels);
168
+ if (problem)
169
+ return fail(problem);
97
170
  const result = await client.post("/api/v1/reports/custom/preview", {
98
171
  entity,
99
172
  columns,
@@ -107,10 +180,11 @@ export function registerReportTools(server, client) {
107
180
  measureField,
108
181
  population,
109
182
  pivot,
183
+ columnLabels,
110
184
  });
111
185
  return formatResult(result);
112
186
  });
113
- server.tool("conduyt_update_report", "Update a saved custom report: any create field, plus pivot (set a pivot grid, or null to remove it). Only the fields you pass change.", {
187
+ server.tool("conduyt_update_report", "Update a saved custom report: any create field, plus pivot (set a pivot grid, or null to remove it). Only the fields you pass change. Changing columns without columnLabels keeps the headers of the columns that stay (a removed column takes its header with it) and the API checks them again. " + COLUMN_LABELS_DOC, {
114
188
  id: z.string().uuid().describe("Saved report id (from conduyt_list_reports)"),
115
189
  name: z.string().min(1).max(120).optional(),
116
190
  description: z.string().max(500).nullable().optional(),
@@ -128,7 +202,12 @@ export function registerReportTools(server, client) {
128
202
  isShared: z.boolean().optional(),
129
203
  isPrivate: z.boolean().optional().describe("Only the creator and admins can open it, even when shared"),
130
204
  pivot: pivotSchema.nullable().optional().describe("A pivot definition, or null to remove the pivot"),
131
- }, async ({ id, name, description, columns, filters, sortBy, sortDir, groupBy, groupBy2, timeGrain, aggregate, measureField, chartType, population, isShared, isPrivate, pivot }) => {
205
+ columnLabels: columnLabelsSchema.nullable().optional().describe("The report's own column headers, REPLACED whole when sent ({} or null removes every rename); omit to keep them. Without columns, the saved columns decide which keys are valid (the API checks)."),
206
+ }, async ({ id, name, description, columns, filters, sortBy, sortDir, groupBy, groupBy2, timeGrain, aggregate, measureField, chartType, population, isShared, isPrivate, pivot, columnLabels }) => {
207
+ const problem = columnLabelsProblem(columnLabels, columns);
208
+ columnLabels = trimmedColumnLabels(columnLabels);
209
+ if (problem)
210
+ return fail(problem);
132
211
  const result = await client.patch(`/api/v1/reports/custom/${encodeURIComponent(id)}`, {
133
212
  name,
134
213
  description,
@@ -146,6 +225,7 @@ export function registerReportTools(server, client) {
146
225
  isShared,
147
226
  isPrivate,
148
227
  pivot,
228
+ columnLabels,
149
229
  });
150
230
  return formatResult(result);
151
231
  });
@@ -1,3 +1,4 @@
1
+ import { LIST_USERS_DOC } from "./user-fields-doc.js";
1
2
  import { z } from "zod";
2
3
  import { TIMEZONE_FILTER_NOTE } from "./lender-options.js";
3
4
  import { formatResult } from "../client.js";
@@ -40,7 +41,7 @@ export function registerSmartListTools(server, client) {
40
41
  const result = await client.post(`/api/v1/smart-lists/${smartListId}/contacts`, { contactIds });
41
42
  return formatResult(result);
42
43
  });
43
- server.tool("conduyt_get_smart_list_contacts", "Get contacts in a smart list. For static lists, returns the members; for dynamic lists, runs the filter query.", {
44
+ server.tool("conduyt_get_smart_list_contacts", "Get contacts in a smart list. For static lists, returns the members; for dynamic lists, runs the filter query." + LIST_USERS_DOC, {
44
45
  smartListId: z.string().describe("Smart list UUID"),
45
46
  page: z.number().optional().describe("Page number"),
46
47
  per_page: z.number().optional().describe("Results per page"),
@@ -1,5 +1,12 @@
1
- export declare const USER_FIELD_READ_DOC = " User fields (#1303): a custom field of fieldType user holds a user id of the workspace; the answer carries customFieldUsers ({ userId (lowercase): \"First Last\" }) naming the people its user fields hold (a value that names no member of the workspace is absent from the map).";
1
+ /** (people45 parity r6, Codex people45-parity-r5) THE record rule, per record object (never per route): every record-returning tool cites it */
2
+ export declare const RECORD_USERS_RULE = " Each contact, deal or company record returned with its customFields also carries customFieldUsers: { userId: display name } for each id in the record's own non-Secure user fields that resolves, {} when none does. A reply with no record, or a record marked _degraded (its read could not be completed), carries no customFieldUsers. A deal field that mirrors a contact or company user field shows the stored member id only, with no name: for a non-Secure source, read the name from the source record; a Secure source is masked and has no name anywhere.";
3
+ export declare const USER_FIELD_READ_DOC: string;
2
4
  export declare const USER_FIELD_WRITE_DOC = " A USER custom field (fieldType user) takes a user id of the workspace (null clears); an id outside the workspace is 422 user_not_in_account. An owner change (assignedTo) also stamps the new owner's ROLE field when the workspace's settings.dealProfile.roleStamping maps their group (each rule's mode decides: first = never replaced once set, latest = the newest owner of the group wins; never blanked; a role key set in the same request is kept as sent).";
3
5
  export declare const USER_NOTE = " USER fields (fieldType user): the value is a user id of the workspace (record writes refuse an id outside it: 422 user_not_in_account; the inbound webhooks and the import also accept an exact \"First Last\" or the user's e-mail); a user field takes no options (422). Changing a TEXT field into a user field (PATCH fieldType user, a DEAL field only; confirmDependencies true to accept the references that read it as text, else 409 field_type_change_dependencies_unconfirmed; 422 field_type_change_refused) is a signed-in owner / admin action in the app only: an API key is refused 403 field_type_change_forbidden, so there is no input for it on these tools. A user value is a lowercase member id of the workspace (an empty array is refused); the type change is allowed on DEAL fields only (422 on a contact or company field). Automation steps update_contact_field, math_operation, ai_compose_email and update_deal_field refuse a non-member with 422 user_not_in_account. A deal create can answer 422 \"The custom fields changed while saving\" when a field's type changed meanwhile: re-read the definitions and retry.";
4
6
  /** contacts and companies: a user field is written by user id too (the role stamp is a deal-owner rule only) */
5
7
  export declare const USER_FIELD_RECORD_WRITE_DOC = " A USER custom field (fieldType user) takes a user id of the workspace (null clears); an id outside the workspace is 422 user_not_in_account.";
8
+ export declare const LIST_USERS_DOC: string;
9
+ export declare const EVENT_USERS_DOC = " In a deal.*, contact.* or company.* event body, a record whose non-Secure user fields name a member carries customFieldUsers ({ userId: name }) beside its stored ids; the key is absent when nothing resolves, and a body that would pass the size limit with the names is sent with the ids only.";
10
+ export declare const WEBHOOK_NAME_TAG_DOC = " In a webhook action body, {{deal.custom_name.<key>}} renders the NAME of the member a non-Secure deal user field holds ({{deal.custom.<key>}} stays the stored user id; empty when the value names no member).";
11
+ export declare const REPLY_USERS_DOC = " Each contact, deal or company record returned with its customFields also carries customFieldUsers: { userId: display name } for each id in the record's own non-Secure user fields that resolves, {} when none does. A reply with no record, or a record marked _degraded (its read could not be completed), carries no customFieldUsers. A deal field that mirrors a contact or company user field shows the stored member id only, with no name: for a non-Secure source, read the name from the source record; a Secure source is masked and has no name anywhere.";
12
+ export declare const ANSWER_USERS_DOC = " Deal / contact / company records inside the answer carry customFieldUsers ({ userId: name }) for their non-Secure user fields that name a member, beside the stored ids (absent when nothing resolves).";
@@ -1,6 +1,14 @@
1
+ /** (people45 parity r6, Codex people45-parity-r5) THE record rule, per record object (never per route): every record-returning tool cites it */
2
+ export const RECORD_USERS_RULE = " Each contact, deal or company record returned with its customFields also carries customFieldUsers: { userId: display name } for each id in the record's own non-Secure user fields that resolves, {} when none does. A reply with no record, or a record marked _degraded (its read could not be completed), carries no customFieldUsers. A deal field that mirrors a contact or company user field shows the stored member id only, with no name: for a non-Secure source, read the name from the source record; a Secure source is masked and has no name anywhere.";
1
3
  // (userfield1303, batch32 #1303) USER custom fields and the card role stamp, named once for the record get / update tools and the definition tools
2
- export const USER_FIELD_READ_DOC = " User fields (#1303): a custom field of fieldType user holds a user id of the workspace; the answer carries customFieldUsers ({ userId (lowercase): \"First Last\" }) naming the people its user fields hold (a value that names no member of the workspace is absent from the map).";
4
+ export const USER_FIELD_READ_DOC = " User fields (#1303): a custom field of fieldType user holds a user id of the workspace." + RECORD_USERS_RULE;
3
5
  export const USER_FIELD_WRITE_DOC = " A USER custom field (fieldType user) takes a user id of the workspace (null clears); an id outside the workspace is 422 user_not_in_account. An owner change (assignedTo) also stamps the new owner's ROLE field when the workspace's settings.dealProfile.roleStamping maps their group (each rule's mode decides: first = never replaced once set, latest = the newest owner of the group wins; never blanked; a role key set in the same request is kept as sent).";
4
6
  export const USER_NOTE = " USER fields (fieldType user): the value is a user id of the workspace (record writes refuse an id outside it: 422 user_not_in_account; the inbound webhooks and the import also accept an exact \"First Last\" or the user's e-mail); a user field takes no options (422). Changing a TEXT field into a user field (PATCH fieldType user, a DEAL field only; confirmDependencies true to accept the references that read it as text, else 409 field_type_change_dependencies_unconfirmed; 422 field_type_change_refused) is a signed-in owner / admin action in the app only: an API key is refused 403 field_type_change_forbidden, so there is no input for it on these tools. A user value is a lowercase member id of the workspace (an empty array is refused); the type change is allowed on DEAL fields only (422 on a contact or company field). Automation steps update_contact_field, math_operation, ai_compose_email and update_deal_field refuse a non-member with 422 user_not_in_account. A deal create can answer 422 \"The custom fields changed while saving\" when a field's type changed meanwhile: re-read the definitions and retry.";
5
7
  /** contacts and companies: a user field is written by user id too (the role stamp is a deal-owner rule only) */
6
8
  export const USER_FIELD_RECORD_WRITE_DOC = " A USER custom field (fieldType user) takes a user id of the workspace (null clears); an id outside the workspace is 422 user_not_in_account.";
9
+ // (people45, userfieldnames40 parity; r2 qualified) where the app answers customFieldUsers beside stored user ids, and the webhook action's name tag
10
+ export const LIST_USERS_DOC = RECORD_USERS_RULE + " An export carries it in its JSON form only.";
11
+ export const EVENT_USERS_DOC = " In a deal.*, contact.* or company.* event body, a record whose non-Secure user fields name a member carries customFieldUsers ({ userId: name }) beside its stored ids; the key is absent when nothing resolves, and a body that would pass the size limit with the names is sent with the ids only.";
12
+ export const WEBHOOK_NAME_TAG_DOC = " In a webhook action body, {{deal.custom_name.<key>}} renders the NAME of the member a non-Secure deal user field holds ({{deal.custom.<key>}} stays the stored user id; empty when the value names no member).";
13
+ export const REPLY_USERS_DOC = RECORD_USERS_RULE;
14
+ export const ANSWER_USERS_DOC = " Deal / contact / company records inside the answer carry customFieldUsers ({ userId: name }) for their non-Secure user fields that name a member, beside the stored ids (absent when nothing resolves).";
@@ -1,3 +1,4 @@
1
+ import { EVENT_USERS_DOC } from "./user-fields-doc.js";
1
2
  import { z } from "zod";
2
3
  import { formatResult } from "../client.js";
3
4
  export function registerWebhookTools(server, client) {
@@ -13,7 +14,7 @@ export function registerWebhookTools(server, client) {
13
14
  const result = await client.get(`/api/v1/webhooks/manage?${params}`);
14
15
  return formatResult(result);
15
16
  });
16
- server.tool("conduyt_create_webhook", "Register a new webhook endpoint. Returns the signing secret once — store it securely. Events: contact.created/updated/deleted, contact.tag_added/removed, deal.created/updated/stage_changed/won/lost/deleted, company.created/updated/deleted, message.sent/received, appointment.created/updated/cancelled, campaign.completed.", {
17
+ server.tool("conduyt_create_webhook", "Register a new webhook endpoint. Returns the signing secret once — store it securely. Events: contact.created/updated/deleted, contact.tag_added/removed, deal.created/updated/stage_changed/won/lost/deleted, company.created/updated/deleted, message.sent/received, appointment.created/updated/cancelled, campaign.completed." + EVENT_USERS_DOC, {
17
18
  url: z.string().describe("Webhook endpoint URL (HTTPS required in production)"),
18
19
  events: z.array(z.string()).describe("Events to subscribe to (e.g. ['contact.created', 'deal.won'])"),
19
20
  description: z.string().optional().describe("Human-readable description of this webhook"),
@@ -22,7 +23,7 @@ export function registerWebhookTools(server, client) {
22
23
  const result = await client.post("/api/v1/webhooks/manage", params);
23
24
  return formatResult(result);
24
25
  });
25
- server.tool("conduyt_update_webhook", "Update a webhook — change URL, events, or enable/disable. Reactivating resets the failure count.", {
26
+ server.tool("conduyt_update_webhook", "Update a webhook — change URL, events, or enable/disable. Reactivating resets the failure count." + EVENT_USERS_DOC, {
26
27
  id: z.string().describe("Webhook UUID"),
27
28
  url: z.string().optional().describe("Updated endpoint URL"),
28
29
  events: z.array(z.string()).optional().describe("Updated event subscriptions"),
@@ -1,3 +1,4 @@
1
+ import { ANSWER_USERS_DOC, WEBHOOK_NAME_TAG_DOC } from "./user-fields-doc.js";
1
2
  import { z } from "zod";
2
3
  import { formatResult } from "../client.js";
3
4
  function unwrap(response) {
@@ -8,7 +9,7 @@ function unwrap(response) {
8
9
  }
9
10
  const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
10
11
  export function registerWorkflowSandboxTools(server, client) {
11
- server.tool("conduyt_workflow_validate", "Validate a workflow graph WITHOUT saving it. Returns errors and warnings so you can fix issues before creating or publishing. Always call this before conduyt_workflow_promote. An action config key the action does not read, or an unregistered action type, comes back as an error with code `unknown_action_config_key` / `unknown_action_type` and a \"Did you mean\" suggestion.", {
12
+ server.tool("conduyt_workflow_validate", "Validate a workflow graph WITHOUT saving it. Returns errors and warnings so you can fix issues before creating or publishing. Always call this before conduyt_workflow_promote. An action config key the action does not read, or an unregistered action type, comes back as an error with code `unknown_action_config_key` / `unknown_action_type` and a \"Did you mean\" suggestion." + WEBHOOK_NAME_TAG_DOC, {
12
13
  triggerEvent: z.string().describe("Trigger event (e.g. 'contact.created', 'deal.stage_changed', 'tag.added', 'scheduled')"),
13
14
  graph: z.object({
14
15
  nodes: z.array(z.object({
@@ -24,7 +25,7 @@ export function registerWorkflowSandboxTools(server, client) {
24
25
  });
25
26
  return formatResult(result);
26
27
  });
27
- server.tool("conduyt_workflow_simulate", "Dry-run a saved automation against a real or stub contact. Returns a step-by-step trace of what WOULD happen — no messages sent, no tags applied, no side effects. Checks compliance (DNC, opt-outs), provider readiness (SMS/email configured), and condition evaluation. Use this to verify a workflow does what you expect before publishing. A deal occurrence needs dealId and a company occurrence needs companyId (see those fields). executionId (optional, admin or owner only) replays a stored run of this automation and supplies ONE fact, the company carried by that run's payload; the run must belong to this account and this automation with the same trigger event, contact and deal as the preview, and without executionId on a non-company occurrence the preview is a synthetic sample whose company rules evaluate as unknown/absent, which the response states.", {
28
+ server.tool("conduyt_workflow_simulate", "Dry-run a saved automation against a real or stub contact. Returns a step-by-step trace of what WOULD happen — no messages sent, no tags applied, no side effects. Checks compliance (DNC, opt-outs), provider readiness (SMS/email configured), and condition evaluation. Use this to verify a workflow does what you expect before publishing. A deal occurrence needs dealId and a company occurrence needs companyId (see those fields). executionId (optional, admin or owner only) replays a stored run of this automation and supplies ONE fact, the company carried by that run's payload; the run must belong to this account and this automation with the same trigger event, contact and deal as the preview, and without executionId on a non-company occurrence the preview is a synthetic sample whose company rules evaluate as unknown/absent, which the response states." + ANSWER_USERS_DOC, {
28
29
  automationId: z.string().describe("Automation UUID to simulate"),
29
30
  contactId: z.string().optional().describe("Contact UUID to simulate against. If omitted, uses a stub contact with empty fields."),
30
31
  dealId: z.string().optional().describe("The event's deal for a DEAL occurrence (deal.created / stage_changed / won / lost / ...): REQUIRED, 400 without it (the contact's newest deal is never a substitute); must be a deal you can see (deals.view and pipeline visibility), 404 otherwise; refused (400) when the selected occurrence is not a deal event (UUID)"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conduyt-mcp",
3
- "version": "4.105.32",
3
+ "version": "4.105.34",
4
4
  "mcpName": "com.conduyt/mcp",
5
5
  "description": "MCP server for Conduyt CRM — expose CRM operations as AI-accessible tools",
6
6
  "type": "module",
@@ -1,11 +1,11 @@
1
1
  {
2
- "generatedAt": "2026-11-16T10:45:30.863Z",
3
- "toolCount": 444,
2
+ "generatedAt": "2026-11-17T23:34:46.984Z",
3
+ "toolCount": 445,
4
4
  "totalEndpoints": 1217,
5
5
  "counts": {
6
- "covered": 393,
6
+ "covered": 394,
7
7
  "excluded": 374,
8
- "planned": 450,
8
+ "planned": 449,
9
9
  "uncategorized": 0
10
10
  },
11
11
  "matrix": {
@@ -4369,8 +4369,10 @@
4369
4369
  ]
4370
4370
  },
4371
4371
  "GET /api/v1/reports/custom/:id": {
4372
- "status": "planned",
4373
- "reason": "additional report surfaces beyond ai/insights"
4372
+ "status": "covered",
4373
+ "tools": [
4374
+ "conduyt_get_report"
4375
+ ]
4374
4376
  },
4375
4377
  "PATCH /api/v1/reports/custom/:id": {
4376
4378
  "status": "covered",