conduyt-mcp 4.105.21 → 4.105.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tool-annotations.js +1 -0
- package/dist/tools/automations.d.ts +1 -1
- package/dist/tools/automations.js +1 -1
- package/dist/tools/companies.js +3 -2
- package/dist/tools/contacts.js +5 -4
- package/dist/tools/custom-fields.js +28 -6
- package/dist/tools/deal-profile.js +10 -4
- package/dist/tools/deals.js +8 -4
- package/dist/tools/formula-fields.d.ts +57 -0
- package/dist/tools/formula-fields.js +78 -0
- package/dist/tools/lead-pool.js +3 -2
- package/dist/tools/saved-filters.js +3 -2
- package/dist/tools/smart-lists.js +3 -2
- package/package.json +1 -1
- package/scripts/coverage-matrix.json +4 -3
package/dist/tool-annotations.js
CHANGED
|
@@ -243,6 +243,7 @@ export const TOOL_ANNOTATIONS = {
|
|
|
243
243
|
conduyt_update_team_chat_settings: update("Update Team Chat Settings"),
|
|
244
244
|
conduyt_list_custom_fields: ro("List Custom Fields"),
|
|
245
245
|
conduyt_create_custom_field: create("Create Custom Field"),
|
|
246
|
+
conduyt_create_mirror_field: create("Create Deal Mirror Field"),
|
|
246
247
|
conduyt_update_custom_field: update("Update Custom Field"),
|
|
247
248
|
conduyt_delete_custom_field: destroy("Delete Custom Field"),
|
|
248
249
|
conduyt_get_contact_table_defaults: ro("Get Contact Table Defaults"),
|
|
@@ -5,7 +5,7 @@ export declare const CARD_OWNERSHIP_ACTIONS_NOTE = " Card ownership per lane: as
|
|
|
5
5
|
/** (deal nodes, app 10-13) find_opportunity v2, link_appointment_to_deal, update_deal_field systemField source; the catalog does not carry action config */
|
|
6
6
|
export declare const DEAL_NODES_ACTIONS_NOTE = " Deal nodes: find_opportunity config {version: 2, pipelineIds (ordered; the first pipeline holding a match wins; empty = every pipeline), status (open default | won | lost | abandoned | any), excludeSources (lead sources never matched, case-insensitive), excludeCreatedByAutomationIds (automations whose create_deal cards are skipped; cards created from 2026-10-13 on), matchField {fieldKey, value} (searches the WHOLE WORKSPACE, any contact, for the card whose deal custom field equals the value, merge fields allowed e.g. {{trigger.oes}}; a card is found when its field holds the searched value (trimmed) as the same text exactly (no case folding); a value written with separators such as dashes or spaces also matches its digits as text; it matches a stored number only when the value (or those digits) is a plain number with no leading zero and at most 15 significant digits that a number holds exactly (007 is text and does not match the number 7; a 16-digit value, 1e-400 or 3e-324 is text only); booleans and differently formatted stored values never match; status, pipelines and exclusions still apply; exactly one match is found, several are ambiguous and take not found; a found card becomes the run's contact when the run has none; the field must exist; an empty rendered value finds nothing), resolution}: searches the run's contact's cards; FOUND makes the card the run's deal and follows nextIfTrue (else next), NOT FOUND is a normal outcome that follows nextIfFalse (else next) and leaves the run's existing deal unchanged (a later deal step on the false branch still acts on the deal the run already had); without version 2 the step keeps the original single-pipeline lookup (a miss fails the step). Prerequisite: a version 2 find needs step cursors on this workspace, and publishing refuses (find_needs_step_cursors) with \"Find opportunity needs step cursors on this workspace; ask support\"; every version 2 find must hold its own live step cursor or it hard-stops the run without selecting or routing. A version 2 find cannot be retried on its own: retrying a failed one alone answers 409, so re-trigger the automation for the contact. An automation definition that touches deals needs the `deals` scope on an API key: without it the write answers 403. link_appointment_to_deal config {stageId, pipelineId (needs stageId), lostReason}: in an appointment-triggered run, links the trigger's appointment to the run's deal (its appointment fields follow it; a newer booking is never displaced; the appointment must be the deal's contact's), then optionally moves the card; it needs an appointment trigger and the run's deal (find_opportunity first, or a booking made with a deal id). update_deal_field config {systemField: \"source\", value, overwriteExisting}: sets the deal's own lead source instead of a custom field (a value only, trimmed, at most 500 characters; overwriteExisting false writes only while the source is the Unknown label).";
|
|
7
7
|
/** (#124, automation unknown keys / types) the refusal codes the write paths answer; surfaced verbatim by the client (details JSON object last), never retried */
|
|
8
|
-
export declare const AUTOMATION_KEY_REFUSALS_NOTE = " Unknown action keys are refused, never ignored: an action config key the action does not read (a typo such as `laneSoruce`) answers code `unknown_action_config_key` with the node, the key and, when one is close, a suggestion (\"Did you mean `laneSource`?\"); an action `type` no registry entry defines answers `unknown_action_type` (with 'Did you mean' when a registered type is close). Create and update answer 400 (an update that does not write `actions` is never refused for a key stored earlier), conduyt_workflow_validate answers 200 with valid false and the `errors` list (nodeId, field, code, message), and publish / a version restore answer 422 (the preflight refusal wraps `data.message`, `data.errors`, `data.warnings`). Read the suggestion, fix the key and send again; a stored workflow is never refused on read.";
|
|
8
|
+
export declare const AUTOMATION_KEY_REFUSALS_NOTE = " Unknown action keys are refused, never ignored: an action config key the action does not read (a typo such as `laneSoruce`) answers code `unknown_action_config_key` with the node, the key and, when one is close, a suggestion (\"Did you mean `laneSource`?\"); an action `type` no registry entry defines answers `unknown_action_type` (with 'Did you mean' when a registered type is close). Create and update answer 400 (an update that does not write `actions` is never refused for a key stored earlier), conduyt_workflow_validate answers 200 with valid false and the `errors` list (nodeId, field, code, message), and publish / a version restore answer 422 (the preflight refusal wraps `data.message`, `data.errors`, `data.warnings`). Read the suggestion, fix the key and send again; a stored workflow is never refused on read. A trigger condition or trigger node naming a deal MIRROR key (deal.customFields.<key>) answers 422 mirror_not_triggerable (#1292): trigger on the source field's own change (Contact Updated / Company Updated).";
|
|
9
9
|
/** GET /automations/:id answers { data: { ...automation, configRevision } } (jsonResponse wraps): the revision lives under `data` */
|
|
10
10
|
export declare function configRevisionOf(raw: unknown): number | undefined;
|
|
11
11
|
export declare function registerAutomationTools(server: McpServer, client: ConduytClient): void;
|
|
@@ -5,7 +5,7 @@ export const CARD_OWNERSHIP_ACTIONS_NOTE = " Card ownership per lane: assign_to_
|
|
|
5
5
|
/** (deal nodes, app 10-13) find_opportunity v2, link_appointment_to_deal, update_deal_field systemField source; the catalog does not carry action config */
|
|
6
6
|
export const DEAL_NODES_ACTIONS_NOTE = " Deal nodes: find_opportunity config {version: 2, pipelineIds (ordered; the first pipeline holding a match wins; empty = every pipeline), status (open default | won | lost | abandoned | any), excludeSources (lead sources never matched, case-insensitive), excludeCreatedByAutomationIds (automations whose create_deal cards are skipped; cards created from 2026-10-13 on), matchField {fieldKey, value} (searches the WHOLE WORKSPACE, any contact, for the card whose deal custom field equals the value, merge fields allowed e.g. {{trigger.oes}}; a card is found when its field holds the searched value (trimmed) as the same text exactly (no case folding); a value written with separators such as dashes or spaces also matches its digits as text; it matches a stored number only when the value (or those digits) is a plain number with no leading zero and at most 15 significant digits that a number holds exactly (007 is text and does not match the number 7; a 16-digit value, 1e-400 or 3e-324 is text only); booleans and differently formatted stored values never match; status, pipelines and exclusions still apply; exactly one match is found, several are ambiguous and take not found; a found card becomes the run's contact when the run has none; the field must exist; an empty rendered value finds nothing), resolution}: searches the run's contact's cards; FOUND makes the card the run's deal and follows nextIfTrue (else next), NOT FOUND is a normal outcome that follows nextIfFalse (else next) and leaves the run's existing deal unchanged (a later deal step on the false branch still acts on the deal the run already had); without version 2 the step keeps the original single-pipeline lookup (a miss fails the step). Prerequisite: a version 2 find needs step cursors on this workspace, and publishing refuses (find_needs_step_cursors) with \"Find opportunity needs step cursors on this workspace; ask support\"; every version 2 find must hold its own live step cursor or it hard-stops the run without selecting or routing. A version 2 find cannot be retried on its own: retrying a failed one alone answers 409, so re-trigger the automation for the contact. An automation definition that touches deals needs the `deals` scope on an API key: without it the write answers 403. link_appointment_to_deal config {stageId, pipelineId (needs stageId), lostReason}: in an appointment-triggered run, links the trigger's appointment to the run's deal (its appointment fields follow it; a newer booking is never displaced; the appointment must be the deal's contact's), then optionally moves the card; it needs an appointment trigger and the run's deal (find_opportunity first, or a booking made with a deal id). update_deal_field config {systemField: \"source\", value, overwriteExisting}: sets the deal's own lead source instead of a custom field (a value only, trimmed, at most 500 characters; overwriteExisting false writes only while the source is the Unknown label).";
|
|
7
7
|
/** (#124, automation unknown keys / types) the refusal codes the write paths answer; surfaced verbatim by the client (details JSON object last), never retried */
|
|
8
|
-
export const AUTOMATION_KEY_REFUSALS_NOTE = " Unknown action keys are refused, never ignored: an action config key the action does not read (a typo such as `laneSoruce`) answers code `unknown_action_config_key` with the node, the key and, when one is close, a suggestion (\"Did you mean `laneSource`?\"); an action `type` no registry entry defines answers `unknown_action_type` (with 'Did you mean' when a registered type is close). Create and update answer 400 (an update that does not write `actions` is never refused for a key stored earlier), conduyt_workflow_validate answers 200 with valid false and the `errors` list (nodeId, field, code, message), and publish / a version restore answer 422 (the preflight refusal wraps `data.message`, `data.errors`, `data.warnings`). Read the suggestion, fix the key and send again; a stored workflow is never refused on read.";
|
|
8
|
+
export const AUTOMATION_KEY_REFUSALS_NOTE = " Unknown action keys are refused, never ignored: an action config key the action does not read (a typo such as `laneSoruce`) answers code `unknown_action_config_key` with the node, the key and, when one is close, a suggestion (\"Did you mean `laneSource`?\"); an action `type` no registry entry defines answers `unknown_action_type` (with 'Did you mean' when a registered type is close). Create and update answer 400 (an update that does not write `actions` is never refused for a key stored earlier), conduyt_workflow_validate answers 200 with valid false and the `errors` list (nodeId, field, code, message), and publish / a version restore answer 422 (the preflight refusal wraps `data.message`, `data.errors`, `data.warnings`). Read the suggestion, fix the key and send again; a stored workflow is never refused on read. A trigger condition or trigger node naming a deal MIRROR key (deal.customFields.<key>) answers 422 mirror_not_triggerable (#1292): trigger on the source field's own change (Contact Updated / Company Updated).";
|
|
9
9
|
/** GET /automations/:id answers { data: { ...automation, configRevision } } (jsonResponse wraps): the revision lives under `data` */
|
|
10
10
|
export function configRevisionOf(raw) {
|
|
11
11
|
const row = raw && typeof raw === "object" && "data" in raw ? raw.data : raw;
|
package/dist/tools/companies.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { formatResult } from "../client.js";
|
|
3
|
+
import { FORMULA_WRITE_NOTE } from "./formula-fields.js";
|
|
3
4
|
export function registerCompanyTools(server, client) {
|
|
4
5
|
server.tool("conduyt_list_companies", "List and search companies. Returns name, domain, industry, contact count, deal count, and total deal value. `count_mode: \"none\"` skips the total count (a picker that only lists names): meta.total is then null and meta.has_more says whether another page exists.", {
|
|
5
6
|
search: z.string().optional().describe("Search by company name, domain, or phone"),
|
|
@@ -49,7 +50,7 @@ export function registerCompanyTools(server, client) {
|
|
|
49
50
|
const result = await client.get(`/api/v1/companies/${encodeURIComponent(company_id)}/related?${params}`);
|
|
50
51
|
return formatResult(result);
|
|
51
52
|
});
|
|
52
|
-
server.tool("conduyt_create_company", "Create a new company record with business details.", {
|
|
53
|
+
server.tool("conduyt_create_company", "Create a new company record with business details." + " " + FORMULA_WRITE_NOTE, {
|
|
53
54
|
name: z.string().describe("Company name (required)"),
|
|
54
55
|
domain: z.string().optional().describe("Company domain (e.g. 'acme.com')"),
|
|
55
56
|
industry: z.string().optional().describe("Industry (e.g. 'Technology', 'Healthcare')"),
|
|
@@ -66,7 +67,7 @@ export function registerCompanyTools(server, client) {
|
|
|
66
67
|
const result = await client.post("/api/v1/companies", params);
|
|
67
68
|
return formatResult(result);
|
|
68
69
|
});
|
|
69
|
-
server.tool("conduyt_update_company", "Update a company's details — name, domain, industry, address, or any other field.", {
|
|
70
|
+
server.tool("conduyt_update_company", "Update a company's details — name, domain, industry, address, or any other field." + " " + FORMULA_WRITE_NOTE, {
|
|
70
71
|
id: z.string().describe("Company UUID"),
|
|
71
72
|
name: z.string().optional().describe("Updated company name"),
|
|
72
73
|
domain: z.string().optional().describe("Updated domain"),
|
package/dist/tools/contacts.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { formatResult, formatToolError } from "../client.js";
|
|
3
|
+
import { FORMULA_FILTER_NOTE, FORMULA_WRITE_NOTE } from "./formula-fields.js";
|
|
3
4
|
import { strictInput } from "./strict.js";
|
|
4
5
|
/** The contact save revision pin (catalog bounds: integer 0..2147483647). */
|
|
5
6
|
/** Create-from-call rule: the server derives the lead's source ("Inbound Call") and its owner (the rep who took the call), so a
|
|
@@ -138,7 +139,7 @@ export function registerContactTools(server, client) {
|
|
|
138
139
|
params.set(`cf[${key}]`, value);
|
|
139
140
|
return params;
|
|
140
141
|
};
|
|
141
|
-
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, {
|
|
142
|
+
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, {
|
|
142
143
|
...contactFilterShape,
|
|
143
144
|
// list-only filters (GET /contacts reads them; GET /contacts/count does not)
|
|
144
145
|
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)"),
|
|
@@ -161,7 +162,7 @@ export function registerContactTools(server, client) {
|
|
|
161
162
|
const result = await client.get(`/api/v1/contacts?${params}`);
|
|
162
163
|
return formatResult(result);
|
|
163
164
|
});
|
|
164
|
-
server.tool("conduyt_count_contacts", "Count the contacts a list filter matches (GET /contacts/count): the exact total when conduyt_list_contacts answers `meta.total: null` with `meta.total_deferred: true`. Takes the SHARED subset of conduyt_list_contacts filters (no page, per_page or sort, and NOT dealContextOwners / dealContextStages / dealContextStatuses, which exist only on the list): with a deal-context filter the exact total is not available here (dropping it counts a broader set), so page the list with has_more instead. Answers `{ total, age_ms?, total_capped?, pending?, timed_out? }`: a cached list (the unfiltered list, or a Smart View alone) answers its cached exact count while under a minute old (`age_ms`), else recounts; `total: null` with `pending: true` = another request is recounting and nothing is cached yet, ask again in a few seconds; `total: null` with `timed_out: true` = the count could not finish within 30 s (narrow the filter); a `search` counts up to 10,000 (`total_capped: true` = more match). Use the total as `expectedTotal` for conduyt_bulk_delete_contacts_matching or conduyt_create_batch_operation.", contactFilterShape, async (filter) => {
|
|
165
|
+
server.tool("conduyt_count_contacts", "Count the contacts a list filter matches (GET /contacts/count): the exact total when conduyt_list_contacts answers `meta.total: null` with `meta.total_deferred: true`. Takes the SHARED subset of conduyt_list_contacts filters (no page, per_page or sort, and NOT dealContextOwners / dealContextStages / dealContextStatuses, which exist only on the list): with a deal-context filter the exact total is not available here (dropping it counts a broader set), so page the list with has_more instead. Answers `{ total, age_ms?, total_capped?, pending?, timed_out? }`: a cached list (the unfiltered list, or a Smart View alone) answers its cached exact count while under a minute old (`age_ms`), else recounts; `total: null` with `pending: true` = another request is recounting and nothing is cached yet, ask again in a few seconds; `total: null` with `timed_out: true` = the count could not finish within 30 s (narrow the filter); a `search` counts up to 10,000 (`total_capped: true` = more match). Use the total as `expectedTotal` for conduyt_bulk_delete_contacts_matching or conduyt_create_batch_operation." + " " + FORMULA_FILTER_NOTE, contactFilterShape, async (filter) => {
|
|
165
166
|
const params = contactFilterParams(filter);
|
|
166
167
|
const result = await client.get(`/api/v1/contacts/count?${params}`);
|
|
167
168
|
return formatResult(result);
|
|
@@ -172,7 +173,7 @@ export function registerContactTools(server, client) {
|
|
|
172
173
|
const result = await client.get(`/api/v1/contacts/${id}`);
|
|
173
174
|
return formatResult(result);
|
|
174
175
|
});
|
|
175
|
-
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, {
|
|
176
|
+
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, {
|
|
176
177
|
email: z.string().optional().describe("Contact email address"),
|
|
177
178
|
firstName: z.string().optional().describe("First name"),
|
|
178
179
|
lastName: z.string().optional().describe("Last name"),
|
|
@@ -202,7 +203,7 @@ export function registerContactTools(server, client) {
|
|
|
202
203
|
created.inputSchema = Object.assign(base.superRefine((v, ctx) => { if (callDerivedFieldsConflict(v))
|
|
203
204
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: CALL_DERIVED_REFUSAL, path: ["callId"] }); }), { shape: base.shape });
|
|
204
205
|
}
|
|
205
|
-
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, {
|
|
206
|
+
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, {
|
|
206
207
|
id: z.string().describe("Contact UUID"),
|
|
207
208
|
email: z.string().optional().describe("Updated email"),
|
|
208
209
|
firstName: z.string().optional().describe("Updated first name"),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ConduytApiError, formatResult } from "../client.js";
|
|
3
|
+
import { CUSTOM_FIELD_TYPES, fail, formulaCreateProblem, formulaUpdateProblem, FORMULA_DEFINITION_NOTE, SECURE_IDENTIFIER_NOTE } from "./formula-fields.js";
|
|
3
4
|
// (parity1292, batch30 #1292 Ship 1) Secure custom fields: the flag, its reveal set, and the codes. There is NO reveal tool: the reveal
|
|
4
5
|
// routes (POST /{contacts|deals|companies}/{id}/custom-fields/{key}/reveal) refuse an API key (403 reveal_requires_session), and this
|
|
5
6
|
// server always signs in with one.
|
|
@@ -22,26 +23,30 @@ export function registerCustomFieldTools(server, client) {
|
|
|
22
23
|
const result = await client.get(`/api/v1/custom-fields?${params}`);
|
|
23
24
|
return formatResult(result);
|
|
24
25
|
});
|
|
25
|
-
server.tool("conduyt_create_custom_field", "Create a new custom field definition for contacts, deals, or companies. Field types: text, number, date, select, multiselect, boolean. " + SECURE_NOTE, {
|
|
26
|
+
server.tool("conduyt_create_custom_field", "Create a new custom field definition for contacts, deals, or companies. Field types: text, textarea, number, date, datetime, url, select, radio, multiselect, boolean, phone, email, formula. " + FORMULA_DEFINITION_NOTE + " " + SECURE_IDENTIFIER_NOTE + " " + SECURE_NOTE, {
|
|
26
27
|
entityType: z.enum(["contact", "deal", "company"]).describe("Entity type this field applies to"),
|
|
27
28
|
fieldKey: z.string().describe("Unique field key (alphanumeric + underscores, e.g. 'lead_score')"),
|
|
28
29
|
label: z.string().describe("Human-readable label (e.g. 'Lead Score')"),
|
|
29
|
-
fieldType: z.enum(
|
|
30
|
+
fieldType: z.enum(CUSTOM_FIELD_TYPES).describe("Field data type; formula is computed at read time from two number fields (options { op, left, right, format })"),
|
|
30
31
|
section: z.string().optional().describe("Section grouping for UI display"),
|
|
31
|
-
options: z.any().optional().describe("Options for select/multiselect fields (array of strings)"),
|
|
32
|
+
options: z.any().optional().describe("Options for select/multiselect fields (array of strings); for fieldType formula the object { op: add|sub|mul|div, left: <number field key>, right: <number field key or a number>, format: number|currency|percent }"),
|
|
32
33
|
isRequired: z.boolean().optional().describe("Whether this field is required"),
|
|
33
34
|
sortOrder: z.number().optional().describe("Display order"),
|
|
34
35
|
isSecure: z.boolean().optional().describe("Make this a Secure field (values masked everywhere; 400 secure_fields_not_enabled until enabled)"),
|
|
35
36
|
revealRoles,
|
|
36
37
|
revealGroupIds,
|
|
37
38
|
}, async (params) => {
|
|
39
|
+
const problem = formulaCreateProblem(params);
|
|
40
|
+
if (problem)
|
|
41
|
+
return fail(problem);
|
|
38
42
|
const result = await client.post("/api/v1/custom-fields", params);
|
|
39
43
|
return formatResult(result);
|
|
40
44
|
});
|
|
41
|
-
server.tool("conduyt_update_custom_field", "Update a custom field's label, options, required status, Secure flag or reveal set. Cannot change the field key or entity type. Turning Secure OFF (isSecure false) makes every stored value visible and needs confirmUnsecure true, else 409 secure_unsecure_unconfirmed. " + SECURE_NOTE, {
|
|
45
|
+
server.tool("conduyt_update_custom_field", "Update a custom field's label, options, required status, Secure flag or reveal set. Cannot change the field key or entity type. A FORMULA field's options (op / left / right / format), Secure flag and required flag are re-judged with its inputs locked: 422 formula_invalid, 422 formula_secure_input; turning Secure on for a number field a non-Secure formula computes from is 409 formula_secure_input naming the formulas. A deal MIRROR (conduyt_create_mirror_field) takes only section and sortOrder; anything else answers 422 invalid_mirror_definition. Turning Secure OFF (isSecure false) makes every stored value visible and needs confirmUnsecure true, else 409 secure_unsecure_unconfirmed. " + SECURE_NOTE, {
|
|
42
46
|
id: z.string().describe("Custom field UUID"),
|
|
43
47
|
label: z.string().optional().describe("Updated label"),
|
|
44
|
-
|
|
48
|
+
section: z.string().max(120).nullable().optional().describe("Updated section grouping (null clears); the one place besides sortOrder a deal MIRROR can be edited"),
|
|
49
|
+
options: z.any().optional().describe("Updated options for select/multiselect; for a formula field the object { op, left, right, format } (re-judged with its inputs locked)"),
|
|
45
50
|
isRequired: z.boolean().optional().describe("Updated required status"),
|
|
46
51
|
sortOrder: z.number().optional().describe("Updated display order"),
|
|
47
52
|
isSecure: z.boolean().optional().describe("Turn Secure on or off (off needs confirmUnsecure true)"),
|
|
@@ -49,15 +54,32 @@ export function registerCustomFieldTools(server, client) {
|
|
|
49
54
|
revealGroupIds,
|
|
50
55
|
confirmUnsecure: z.boolean().optional().describe("Required true with isSecure false: confirms every stored value becomes visible"),
|
|
51
56
|
}, async ({ id, ...updates }) => {
|
|
57
|
+
const problem = formulaUpdateProblem(updates);
|
|
58
|
+
if (problem)
|
|
59
|
+
return fail(problem);
|
|
52
60
|
const result = await client.patch(`/api/v1/custom-fields/${id}`, updates);
|
|
53
61
|
return formatResult(result);
|
|
54
62
|
});
|
|
55
|
-
server.tool("conduyt_delete_custom_field", "Delete a custom field definition. Removes the field from all entities. A Secure field cannot be deleted: 409 secure_field_delete_refused (turn Secure off first with conduyt_update_custom_field isSecure false + confirmUnsecure true, then delete).", {
|
|
63
|
+
server.tool("conduyt_delete_custom_field", "Delete a custom field definition. Removes the field from all entities. A field a formula computes from cannot be deleted: 409 deletion_blocked (the formula named in blockers). A contact / company field mirrored on deals cannot be deleted: 409 mirror_source_in_use { mirrors } (delete the deal mirrors first; deleting a mirror deletes only the placement, never the contact's value). A Secure field cannot be deleted: 409 secure_field_delete_refused (turn Secure off first with conduyt_update_custom_field isSecure false + confirmUnsecure true, then delete).", {
|
|
56
64
|
id: z.string().describe("Custom field UUID"),
|
|
57
65
|
}, async ({ id }) => {
|
|
58
66
|
const result = await client.del(`/api/v1/custom-fields/${id}`);
|
|
59
67
|
return formatResult(result);
|
|
60
68
|
});
|
|
69
|
+
// (mirror1292, batch31 #1292 Ship 3) a DEAL MIRROR: POST /custom-fields with mirrorOf (no type, options, required or Secure flags)
|
|
70
|
+
server.tool("conduyt_create_mirror_field", "Create a DEAL MIRROR field (#1292): a write-through view of a contact or company field shown and edited on every deal as ONE value (nothing is copied). Deal reads (conduyt_get_deal / conduyt_list_deals) answer the deal's linked contact's / company's value under fieldKey with a mirrorFields entry; conduyt_update_deal with the key writes that record. It has no type, options, required or Secure flag of its own: all the source's (a mirror of a Secure source is masked and revealed exactly like it). A re-linked deal shows the new record's value. Not filterable (422 mirror_not_filterable) and never a deal trigger (422 mirror_not_triggerable). Refusals: 422 invalid_mirror_definition (unknown or system-managed source, deals already store values under fieldKey); 409 when fieldKey already exists on deals. POST /api/v1/custom-fields with mirrorOf.", {
|
|
71
|
+
fieldKey: z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).describe("The deal field key of the mirror (letters, digits, underscores; not starting with a digit)"),
|
|
72
|
+
mirrorOf: z.object({
|
|
73
|
+
entityType: z.enum(["contact", "company"]).describe("The source record type: the deal's primary contact or its company"),
|
|
74
|
+
fieldKey: z.string().min(1).max(100).regex(/^[A-Za-z_][A-Za-z0-9_]*$/).describe("The source field key on that record type"),
|
|
75
|
+
}).describe("The contact / company field this deal field mirrors"),
|
|
76
|
+
label: z.string().min(1).max(200).optional().describe("Optional; the source's label is answered"),
|
|
77
|
+
section: z.string().max(120).nullable().optional().describe("Section grouping on the deal page"),
|
|
78
|
+
sortOrder: z.number().int().min(0).max(100000).optional().describe("Display order"),
|
|
79
|
+
}, async (params) => {
|
|
80
|
+
const result = await client.post("/api/v1/custom-fields", { entityType: "deal", ...params });
|
|
81
|
+
return formatResult(result);
|
|
82
|
+
});
|
|
61
83
|
// ─── account default columns for the contacts list (admin-managed; applied to every user on their next visit) ───
|
|
62
84
|
server.tool("conduyt_get_contact_table_defaults", "Read the account-level DEFAULT COLUMNS for the Contacts list: the column ids every user gets merged into their own layout on their next visit (each version once; users can rearrange afterwards). null = no account default (users see the built-in layout). Reads /api/v1/settings (settings:view).", {}, async () => {
|
|
63
85
|
const result = (await client.get("/api/v1/settings"));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { formatResult } from "../client.js";
|
|
3
3
|
import { strictInput } from "./strict.js";
|
|
4
|
+
import { fail, secureEgressProblem } from "./formula-fields.js";
|
|
4
5
|
/** (parity28, batch28) the Deal profile (the deal page's tabs of the primary contact's bound fields), the partner push and the workspace binding. */
|
|
5
6
|
export const PUSH_PARTNERS = ["creditors_relief", "delancey_street"];
|
|
6
7
|
export const PUSH_ACTIONS = ["create", "update"];
|
|
7
8
|
const PROFILE_KEYS_MAX = 100;
|
|
8
9
|
const KEY_MAX = 100;
|
|
9
10
|
const PATCH_CODES = "400 profile_key_not_bound (keys lists them), profile_field_invalid (key), deal_profile_not_enabled, invalid_body; 403 deal_not_editable or contacts_permission_required; 404 deal not found; 409 profile_field_changed { key, current } (nothing written), profile_conflict or deal_has_no_contact; 422 stage_automation_only (the card sits in a stage only automation may change; nothing written); 503 profile_busy (the contact stayed locked; nothing written, retry after the Retry-After seconds).";
|
|
10
|
-
const PUSH_CODES = "403 deal_not_editable / push_not_permitted; 404; 409 partner_disabled, partner_not_enabled, push_in_flight, needs_link, action_changed (the current state comes back), deal_has_no_contact, contact_busy, reconcile_needs_admin, reconcile_ambiguous; 422 profile_incomplete (missing[] names each gap; 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.";
|
|
11
|
+
const PUSH_CODES = "403 deal_not_editable / push_not_permitted; 404; 409 partner_disabled, partner_not_enabled, push_in_flight, needs_link, action_changed (the current state comes back), 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; 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.";
|
|
11
12
|
/** fields: 1 to 100 keys; expected: any number of keys (the server caps only fields); both: key length 1 to 100 */
|
|
12
13
|
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` });
|
|
13
14
|
export function registerDealProfileTools(server, client) {
|
|
@@ -20,15 +21,20 @@ export function registerDealProfileTools(server, client) {
|
|
|
20
21
|
}, async ({ id, fields, expected }) => formatResult(await client.patch(`/api/v1/deals/${encodeURIComponent(id)}/profile`, { fields, expected }))));
|
|
21
22
|
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 }))));
|
|
22
23
|
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")));
|
|
23
|
-
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, revealRoles / revealGroupIds. 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: actions [{ key, name }] up to 20, a field note up to 240 plain-text characters, readinessPerSlot true on a repeating table)") }, async ({ dealProfile }) =>
|
|
24
|
+
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 [custom field key] (up to 100 keys, none twice; the Secure CONTACT or DEAL custom field keys the partner push MAY send: each must name an existing contact or deal custom field, else 422 invalid_deal_profile; a Secure value the push would send whose key is not listed refuses the push with 422 profile_secure_field, a listed one is sent masked to the last 4 in the preview and the stored snapshot, and every send is audited). 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 [field key] 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 }) => {
|
|
25
|
+
const problem = secureEgressProblem(dealProfile);
|
|
26
|
+
if (problem)
|
|
27
|
+
return fail(problem);
|
|
28
|
+
return formatResult(await client.put("/api/v1/settings/deal-profile", { dealProfile }));
|
|
29
|
+
}));
|
|
24
30
|
strictInput(server.tool("conduyt_remove_deal_profile_settings", "REMOVE the workspace's Deal profile binding (PUT /api/v1/settings/deal-profile with dealProfile null; settings:edit, and only an owner or admin: a delegated holder is refused 403 deal_profile_admin_only): the deal page's Details card returns to its plain view and the stored binding (tabs, rules, reveal set) is DISCARDED, so read and keep a copy with conduyt_get_deal_profile_settings first. No custom field definition is touched.", {}, async () => formatResult(await client.put("/api/v1/settings/deal-profile", { dealProfile: null }))));
|
|
25
31
|
server.tool("conduyt_get_deal_partner_pushes", "The deal page's Push to partner card (GET /api/v1/deals/{id}/partner-pushes): { enabled: false } when the workspace has no enabled partner, else the partners (Creditors Relief; Delancey Street listed, disabled), the card's partner id (the deal field oes_number) and its display (CRL-<id>), a pending create (sending, or unknown after an ambiguous answer: the next push checks the partner first), the newest four pushes and canPush (the card's edit scope and closer or above). Needs deals:view on the card; 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)}/partner-pushes`)));
|
|
26
|
-
server.tool("conduyt_preview_deal_partner_push", "Preview what the next partner push would send (GET /api/v1/deals/{id}/partner-pushes/preview): the action (create when the card has no OES #, update when it has one), the partner endpoint, the payload rows (SSN and bank numbers masked to the last 4), the readiness gaps (missing[]; a push answers 422 profile_incomplete while any remain) and the policy warnings. Nothing is written and no partner is called. Same gates as the push: deals:edit, the card's edit scope, closer or above. 403 deal_not_editable / push_not_permitted; 404; 409 partner_disabled (delancey_street is disabled in v1), partner_not_enabled, deal_has_no_contact.", { id: dealId, partner: z.enum(PUSH_PARTNERS).optional().describe("creditors_relief (default) or delancey_street") }, async ({ id, partner }) => {
|
|
32
|
+
server.tool("conduyt_preview_deal_partner_push", "Preview what the next partner push would send (GET /api/v1/deals/{id}/partner-pushes/preview): the action (create when the card has no OES #, update when it has one), the partner endpoint, the payload rows (SSN and bank numbers masked to the last 4), the readiness gaps (missing[]; a push answers 422 profile_incomplete while any remain) and the policy warnings. Nothing is written and no partner is called. Same gates as the push: deals:edit, the card's edit scope, closer or above. 403 deal_not_editable / push_not_permitted; 404; 409 partner_disabled (delancey_street is disabled in v1), partner_not_enabled, deal_has_no_contact; 422 profile_secure_field { secure[], missing[] } (a Secure value the push would send whose key the binding does not list in secureEgress; the preview refuses it too, nothing is sent).", { id: dealId, partner: z.enum(PUSH_PARTNERS).optional().describe("creditors_relief (default) or delancey_street") }, async ({ id, partner }) => {
|
|
27
33
|
if (partner === undefined)
|
|
28
34
|
return formatResult(await client.get(`/api/v1/deals/${encodeURIComponent(id)}/partner-pushes/preview`));
|
|
29
35
|
return formatResult(await client.get(`/api/v1/deals/${encodeURIComponent(id)}/partner-pushes/preview?partner=${partner}`));
|
|
30
36
|
});
|
|
31
|
-
strictInput(server.tool("conduyt_push_deal_to_partner", `Push a deal to a partner (POST /api/v1/deals/{id}/partner-pushes): ONE press of the deal page's Push to partner, which SENDS the card's data to the partner and cannot be recalled. One partner record per card: a card without an OES # creates the record (the contact, one debt per creditor, then the bank account when its details are filled) and stamps the partner's id on the card; a card with an OES # can only update that record's contact. action is what you saw (create or update): the server decides from the locked card and answers 409 action_changed with the current state when they differ (call conduyt_preview_deal_partner_push first). An executed attempt answers 200 with result accepted, found, updated, refused (nothing saved on the deal), unknown (no definite answer: the next push checks the partner before creating), needs_link (the partner created the record but the card could not carry its id; an admin links it by hand) or erased. Needs deals:edit, the card's edit scope and closer or above. idempotencyKey (1-255 printable ASCII) is sent as the Idempotency-Key header: one key per push press, reused ONLY to retry the SAME request (same key + same body replays the first answer; a different body is 422 idempotency_request_conflict). A refusal decided before any partner call (the 403s, partner_disabled, partner_not_enabled, push_in_flight, needs_link, action_changed, deal_has_no_contact, contact_busy, profile_incomplete, deal_busy) releases the key, so the SAME key may be retried at once; an executed attempt (accepted, found, updated, refused, unknown) and reconcile_needs_admin, reconcile_ambiguous or partner_auth spend it: a retry with that key answers 409 idempotency_key_spent, so verify what happened before sending a NEW key. 409 idempotency_in_progress: wait Retry-After and retry with the SAME key. A key starting with forgotten: is reserved (400 idempotency_key_reserved). Rare wrapper outcomes: 409 idempotency_conflict_retry (a concurrent claim could not be resolved, nothing ran: retry with the SAME key); 503 idempotency_claim_held (the release of a failed attempt's claim could not be confirmed: retry with a NEW key); 503 idempotency_outcome_unknown (the success could not be confirmed and the push may have gone through: verify the outcome before any new key). ${PUSH_CODES}`, {
|
|
37
|
+
strictInput(server.tool("conduyt_push_deal_to_partner", `Push a deal to a partner (POST /api/v1/deals/{id}/partner-pushes): ONE press of the deal page's Push to partner, which SENDS the card's data to the partner and cannot be recalled. One partner record per card: a card without an OES # creates the record (the contact, one debt per creditor, then the bank account when its details are filled) and stamps the partner's id on the card; a card with an OES # can only update that record's contact. action is what you saw (create or update): the server decides from the locked card and answers 409 action_changed with the current state when they differ (call conduyt_preview_deal_partner_push first). An executed attempt answers 200 with result accepted, found, updated, refused (nothing saved on the deal), unknown (no definite answer: the next push checks the partner before creating), needs_link (the partner created the record but the card could not carry its id; an admin links it by hand) or erased. Needs deals:edit, the card's edit scope and closer or above. idempotencyKey (1-255 printable ASCII) is sent as the Idempotency-Key header: one key per push press, reused ONLY to retry the SAME request (same key + same body replays the first answer; a different body is 422 idempotency_request_conflict). A refusal decided before any partner call (the 403s, partner_disabled, partner_not_enabled, push_in_flight, needs_link, action_changed, deal_has_no_contact, contact_busy, profile_incomplete, profile_secure_field, deal_busy) releases the key, so the SAME key may be retried at once; an executed attempt (accepted, found, updated, refused, unknown) and reconcile_needs_admin, reconcile_ambiguous or partner_auth spend it: a retry with that key answers 409 idempotency_key_spent, so verify what happened before sending a NEW key. 409 idempotency_in_progress: wait Retry-After and retry with the SAME key. A key starting with forgotten: is reserved (400 idempotency_key_reserved). Rare wrapper outcomes: 409 idempotency_conflict_retry (a concurrent claim could not be resolved, nothing ran: retry with the SAME key); 503 idempotency_claim_held (the release of a failed attempt's claim could not be confirmed: retry with a NEW key); 503 idempotency_outcome_unknown (the success could not be confirmed and the push may have gone through: verify the outcome before any new key). ${PUSH_CODES}`, {
|
|
32
38
|
id: dealId,
|
|
33
39
|
partner: z.enum(PUSH_PARTNERS).describe("creditors_relief (Forth) or delancey_street (disabled in v1)"),
|
|
34
40
|
action: z.enum(PUSH_ACTIONS).describe("What the card showed: create (no OES # yet) or update (the card has one)"),
|
package/dist/tools/deals.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { formatResult } from "../client.js";
|
|
3
|
+
import { FORMULA_WRITE_NOTE } from "./formula-fields.js";
|
|
3
4
|
import { strictInput } from "./strict.js";
|
|
4
5
|
import { KEEP_PREVIOUS_OWNER_NEEDS_ASSIGNEE } from "./contacts.js";
|
|
6
|
+
// (mirror1292, batch31 #1292 Ship 3) deal MIRROR fields: a write-through view of a contact / company field, named on the deal tools
|
|
7
|
+
const MIRROR_READ_DOC = " Mirror fields (#1292): a deal custom field created as a MIRROR of a contact / company field answers that record's value in customFields, with mirrorFields[key] = { mirrored: true, source: { entityType, fieldKey }, unresolved? } beside it (unresolved: no_linked_contact | no_linked_company | source_field_missing, value null); a mirror of a Secure source answers the mask \u2022\u2022\u2022\u2022 like the source (passed through untouched).";
|
|
8
|
+
const MIRROR_WRITE_DOC = " A customFields key that is a deal MIRROR writes the linked contact / company through its own write path (nothing is stored on the deal): 409 mirror_unresolved (no linked record), 409 mirror_relink_conflict (the same request re-links it), 403 mirror_source_not_editable, 422 mirror_source_rejected, 409 mirror_source_changed, 409 mirror_source_conflict (the source's required state changed under the lock), 422 mirror_conflicting_values (two mirror keys of one source field with different values).";
|
|
5
9
|
/** The six Pipeline health checks (GET /deals health_check, GET /deals/inspection check). */
|
|
6
10
|
export const PIPELINE_HEALTH_CHECKS = ["high_value_idle", "stale", "unassigned", "needs_action", "missing_close_date", "missing_contact"];
|
|
7
11
|
const healthCheckSchema = z.enum(PIPELINE_HEALTH_CHECKS);
|
|
@@ -49,7 +53,7 @@ function boardSnapshotColumns(a, f) {
|
|
|
49
53
|
return a.board_columns.map((c) => (c.limit === undefined ? c.stageId : `${c.stageId}:${c.limit}`)).join(",");
|
|
50
54
|
}
|
|
51
55
|
export function registerDealTools(server, client) {
|
|
52
|
-
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, {
|
|
56
|
+
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).", {
|
|
53
57
|
pipeline: z.string().optional().describe("Filter by pipeline UUID (canonical). Aliases: pipelineId, pipeline_id."),
|
|
54
58
|
pipelineId: z.string().optional().describe("Filter by pipeline UUID (alias of pipeline)."),
|
|
55
59
|
pipeline_id: z.string().optional().describe("snake_case alias of pipelineId."),
|
|
@@ -194,13 +198,13 @@ export function registerDealTools(server, client) {
|
|
|
194
198
|
const result = await client.post("/api/v1/tasks", { checkOrigin, dealId, expectedDealUpdatedAt, title, description, dueDate, priority, status, assignedTo, contactId }, idempotencyKey !== undefined ? { headers: { "Idempotency-Key": idempotencyKey } } : undefined);
|
|
195
199
|
return formatResult(result);
|
|
196
200
|
}));
|
|
197
|
-
server.tool("conduyt_get_deal", "Get a single deal with full details — value, currency, probability, stage, contact, expected close date, custom-field values, activities, tasks, and history. Use this to read structured custom-field data back out of a deal (e.g. for a P&L or balance-sheet model). Deal rows also carry hasNextStep and nextAppointmentAt (null unless your key can view the calendar) when the API returns them.", {
|
|
201
|
+
server.tool("conduyt_get_deal", "Get a single deal with full details — value, currency, probability, stage, contact, expected close date, custom-field values, activities, tasks, and history. Use this to read structured custom-field data back out of a deal (e.g. for a P&L or balance-sheet model). Deal rows also carry hasNextStep and nextAppointmentAt (null unless your key can view the calendar) when the API returns them." + MIRROR_READ_DOC, {
|
|
198
202
|
id: z.string().describe("Deal UUID"),
|
|
199
203
|
}, async ({ id }) => {
|
|
200
204
|
const result = await client.get(`/api/v1/deals/${id}`);
|
|
201
205
|
return formatResult(result);
|
|
202
206
|
});
|
|
203
|
-
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).", {
|
|
207
|
+
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, {
|
|
204
208
|
title: z.string().describe("Deal title (e.g. 'Acme Corp — Enterprise Plan')"),
|
|
205
209
|
pipelineId: z.string().describe("Pipeline UUID"),
|
|
206
210
|
stageId: z.string().describe("Stage UUID within the pipeline"),
|
|
@@ -219,7 +223,7 @@ export function registerDealTools(server, client) {
|
|
|
219
223
|
const result = await client.post("/api/v1/deals", params);
|
|
220
224
|
return formatResult(result);
|
|
221
225
|
});
|
|
222
|
-
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).", {
|
|
226
|
+
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, {
|
|
223
227
|
id: z.string().describe("Deal UUID"),
|
|
224
228
|
title: z.string().optional().describe("Updated title"),
|
|
225
229
|
stageId: z.string().optional().describe("Move to a new stage UUID"),
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (parity31, batch31 #1292 Ship 4 + Ship 2) Formula custom fields, the Secure identifier rule and the binding's secureEgress list,
|
|
3
|
+
* checked before the request leaves (the server stays the authority; every answer carries its stable code).
|
|
4
|
+
*/
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
export declare const FORMULA_OPS: readonly ["add", "sub", "mul", "div"];
|
|
7
|
+
export declare const FORMULA_FORMATS: readonly ["number", "currency", "percent"];
|
|
8
|
+
/** every fieldType the custom-fields route accepts for a definition (the server's create enum, batch31) */
|
|
9
|
+
export declare const CUSTOM_FIELD_TYPES: readonly ["text", "textarea", "number", "date", "datetime", "url", "select", "radio", "multiselect", "boolean", "phone", "email", "formula"];
|
|
10
|
+
export declare const DEAL_OES_KEYS: readonly ["oes_number", "dpp_oes_raw"];
|
|
11
|
+
/** one description sentence for every record write that could carry a formula key */
|
|
12
|
+
export declare const FORMULA_WRITE_NOTE = "A customFields key that is a FORMULA field (computed at read time, never stored) is refused: 422 formula_read_only.";
|
|
13
|
+
/** one description sentence for every filter that could name a formula key */
|
|
14
|
+
export declare const FORMULA_FILTER_NOTE = "A filter naming a FORMULA custom field is refused: 422 formula_not_filterable (formulas are not filterable in v1).";
|
|
15
|
+
/** the definition-side rules, shared by the create and update tool descriptions */
|
|
16
|
+
export declare const FORMULA_DEFINITION_NOTE = "fieldType formula (#1292) is a COMPUTED field: options { op: add|sub|mul|div, left: <number field key>, right: <number field key or a number>, format: number|currency|percent }; left and right are number fields of the SAME entity (never the formula itself or another formula); the value is computed at read time (never stored), blank when an input is blank and on a division by zero; every record answer carries it in customFields plus computedFields[key] = { computed: true, readOnly: true, format }. A formula is read-only on every write path (422 formula_read_only), not filterable (422 formula_not_filterable), never required, and an input that is Secure needs a Secure formula (422 formula_secure_input; turning Secure on for an input a non-Secure formula computes from is 409 formula_secure_input naming the formulas). A formula needs a FRESH key (409 formula_key_in_use); malformed options, a non-number / formula / self input or a system-owned key is 422 formula_invalid. Deleting a field a formula computes from is 409 deletion_blocked (the formula in blockers).";
|
|
17
|
+
export declare const SECURE_IDENTIFIER_NOTE = "A phone or email field, or a deal OES # key (oes_number, dpp_oes_raw), identifies the record and can never be Secure: isSecure true on one is 422 secure_identifier_refused.";
|
|
18
|
+
/** the server's formula options object, strict */
|
|
19
|
+
export declare const formulaOptionsSchema: z.ZodObject<{
|
|
20
|
+
op: z.ZodEnum<["add", "sub", "mul", "div"]>;
|
|
21
|
+
left: z.ZodString;
|
|
22
|
+
right: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
23
|
+
format: z.ZodEnum<["number", "currency", "percent"]>;
|
|
24
|
+
}, "strict", z.ZodTypeAny, {
|
|
25
|
+
op: "add" | "sub" | "mul" | "div";
|
|
26
|
+
left: string;
|
|
27
|
+
right: string | number;
|
|
28
|
+
format: "number" | "currency" | "percent";
|
|
29
|
+
}, {
|
|
30
|
+
op: "add" | "sub" | "mul" | "div";
|
|
31
|
+
left: string;
|
|
32
|
+
right: string | number;
|
|
33
|
+
format: "number" | "currency" | "percent";
|
|
34
|
+
}>;
|
|
35
|
+
/** create: a formula carries its options object (never required); any other type never takes that object. Returns an error text or null */
|
|
36
|
+
export declare function formulaCreateProblem(p: {
|
|
37
|
+
fieldType?: unknown;
|
|
38
|
+
options?: unknown;
|
|
39
|
+
isRequired?: unknown;
|
|
40
|
+
isSecure?: unknown;
|
|
41
|
+
entityType?: unknown;
|
|
42
|
+
fieldKey?: unknown;
|
|
43
|
+
}): string | null;
|
|
44
|
+
/** update: a formula-shaped options object gets the shape check; any other option object (numberFormat, currencyCode, ...) goes to the server untouched */
|
|
45
|
+
export declare function formulaUpdateProblem(p: {
|
|
46
|
+
options?: unknown;
|
|
47
|
+
}): string | null;
|
|
48
|
+
/** the binding's secureEgress: an array of at most 100 field keys, none twice. Returns an error text or null */
|
|
49
|
+
export declare const SECURE_EGRESS_MAX = 100;
|
|
50
|
+
export declare function secureEgressProblem(binding: Record<string, unknown>): string | null;
|
|
51
|
+
export declare const fail: (text: string) => {
|
|
52
|
+
content: {
|
|
53
|
+
type: "text";
|
|
54
|
+
text: string;
|
|
55
|
+
}[];
|
|
56
|
+
isError: boolean;
|
|
57
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (parity31, batch31 #1292 Ship 4 + Ship 2) Formula custom fields, the Secure identifier rule and the binding's secureEgress list,
|
|
3
|
+
* checked before the request leaves (the server stays the authority; every answer carries its stable code).
|
|
4
|
+
*/
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
const KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
7
|
+
export const FORMULA_OPS = ["add", "sub", "mul", "div"];
|
|
8
|
+
export const FORMULA_FORMATS = ["number", "currency", "percent"];
|
|
9
|
+
/** every fieldType the custom-fields route accepts for a definition (the server's create enum, batch31) */
|
|
10
|
+
export const CUSTOM_FIELD_TYPES = ["text", "textarea", "number", "date", "datetime", "url", "select", "radio", "multiselect", "boolean", "phone", "email", "formula"];
|
|
11
|
+
export const DEAL_OES_KEYS = ["oes_number", "dpp_oes_raw"];
|
|
12
|
+
/** one description sentence for every record write that could carry a formula key */
|
|
13
|
+
export const FORMULA_WRITE_NOTE = "A customFields key that is a FORMULA field (computed at read time, never stored) is refused: 422 formula_read_only.";
|
|
14
|
+
/** one description sentence for every filter that could name a formula key */
|
|
15
|
+
export const FORMULA_FILTER_NOTE = "A filter naming a FORMULA custom field is refused: 422 formula_not_filterable (formulas are not filterable in v1).";
|
|
16
|
+
/** the definition-side rules, shared by the create and update tool descriptions */
|
|
17
|
+
export const FORMULA_DEFINITION_NOTE = "fieldType formula (#1292) is a COMPUTED field: options { op: add|sub|mul|div, left: <number field key>, right: <number field key or a number>, format: number|currency|percent }; left and right are number fields of the SAME entity (never the formula itself or another formula); the value is computed at read time (never stored), blank when an input is blank and on a division by zero; every record answer carries it in customFields plus computedFields[key] = { computed: true, readOnly: true, format }. A formula is read-only on every write path (422 formula_read_only), not filterable (422 formula_not_filterable), never required, and an input that is Secure needs a Secure formula (422 formula_secure_input; turning Secure on for an input a non-Secure formula computes from is 409 formula_secure_input naming the formulas). A formula needs a FRESH key (409 formula_key_in_use); malformed options, a non-number / formula / self input or a system-owned key is 422 formula_invalid. Deleting a field a formula computes from is 409 deletion_blocked (the formula in blockers).";
|
|
18
|
+
export const SECURE_IDENTIFIER_NOTE = "A phone or email field, or a deal OES # key (oes_number, dpp_oes_raw), identifies the record and can never be Secure: isSecure true on one is 422 secure_identifier_refused.";
|
|
19
|
+
const inputKey = z.string().trim().min(1).max(120).regex(KEY_RE);
|
|
20
|
+
/** the server's formula options object, strict */
|
|
21
|
+
export const formulaOptionsSchema = z.object({
|
|
22
|
+
op: z.enum(FORMULA_OPS),
|
|
23
|
+
left: inputKey,
|
|
24
|
+
right: z.union([inputKey, z.number().finite()]),
|
|
25
|
+
format: z.enum(FORMULA_FORMATS),
|
|
26
|
+
}).strict();
|
|
27
|
+
/** the server's four formula option keys; its other object shapes (choices, options, numberFormat, currencyCode, allowedDomains, blockedDomains, visibility) never use them */
|
|
28
|
+
const FORMULA_KEYS = ["op", "left", "right", "format"];
|
|
29
|
+
const isFormulaShaped = (o) => o !== null && typeof o === "object" && !Array.isArray(o) && Object.keys(o).some((k) => FORMULA_KEYS.includes(k));
|
|
30
|
+
/** create: a formula carries its options object (never required); any other type never takes that object. Returns an error text or null */
|
|
31
|
+
export function formulaCreateProblem(p) {
|
|
32
|
+
const isObj = isFormulaShaped(p.options);
|
|
33
|
+
if (p.fieldType === "formula") {
|
|
34
|
+
const r = formulaOptionsSchema.safeParse(p.options);
|
|
35
|
+
if (!r.success)
|
|
36
|
+
return `A formula needs options { op: ${FORMULA_OPS.join("|")}, left: <field key>, right: <field key or a number>, format: ${FORMULA_FORMATS.join("|")} } and nothing else (422 formula_invalid).`;
|
|
37
|
+
if (p.isRequired === true)
|
|
38
|
+
return "A formula is computed, never required (422 formula_invalid).";
|
|
39
|
+
}
|
|
40
|
+
else if (isObj) {
|
|
41
|
+
return "The formula options object is accepted only with fieldType formula (otherwise 422 formula_invalid); select options are an array.";
|
|
42
|
+
}
|
|
43
|
+
if (p.isSecure === true) {
|
|
44
|
+
const oes = p.entityType === "deal" && typeof p.fieldKey === "string" && DEAL_OES_KEYS.includes(p.fieldKey);
|
|
45
|
+
if (p.fieldType === "phone" || p.fieldType === "email" || oes)
|
|
46
|
+
return "A phone or email field, or a deal OES # key (oes_number, dpp_oes_raw), identifies the record and can never be Secure (422 secure_identifier_refused).";
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
/** update: a formula-shaped options object gets the shape check; any other option object (numberFormat, currencyCode, ...) goes to the server untouched */
|
|
51
|
+
export function formulaUpdateProblem(p) {
|
|
52
|
+
if (isFormulaShaped(p.options) && !formulaOptionsSchema.safeParse(p.options).success)
|
|
53
|
+
return `A formula's options are { op: ${FORMULA_OPS.join("|")}, left: <field key>, right: <field key or a number>, format: ${FORMULA_FORMATS.join("|")} } and nothing else (422 formula_invalid).`;
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
/** the binding's secureEgress: an array of at most 100 field keys, none twice. Returns an error text or null */
|
|
57
|
+
export const SECURE_EGRESS_MAX = 100;
|
|
58
|
+
const EGRESS_KEY_RE = /^[a-zA-Z_][a-zA-Z0-9_]{0,99}$/;
|
|
59
|
+
export function secureEgressProblem(binding) {
|
|
60
|
+
const e = binding.secureEgress;
|
|
61
|
+
if (e === undefined)
|
|
62
|
+
return null;
|
|
63
|
+
if (!Array.isArray(e))
|
|
64
|
+
return "secureEgress must be an array of Secure custom field keys.";
|
|
65
|
+
if (e.length > SECURE_EGRESS_MAX)
|
|
66
|
+
return `secureEgress holds at most ${SECURE_EGRESS_MAX} keys.`;
|
|
67
|
+
const seen = new Set();
|
|
68
|
+
for (let i = 0; i < e.length; i++) {
|
|
69
|
+
const k = e[i];
|
|
70
|
+
if (typeof k !== "string" || !EGRESS_KEY_RE.test(k))
|
|
71
|
+
return `secureEgress[${i}] must be a custom field key (letters, digits, underscores, not starting with a digit; at most 100 characters).`;
|
|
72
|
+
if (seen.has(k))
|
|
73
|
+
return `secureEgress[${i}] (${k}) is listed twice.`;
|
|
74
|
+
seen.add(k);
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
export const fail = (text) => ({ content: [{ type: "text", text }], isError: true });
|
package/dist/tools/lead-pool.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { FORMULA_FILTER_NOTE } from "./formula-fields.js";
|
|
2
3
|
import { formatResult } from "../client.js";
|
|
3
4
|
import { patchGeneralSettings } from "./lifecycle.js";
|
|
4
5
|
import { validateAdvancedFiltersEffective } from "./advanced-filter-rules.js";
|
|
@@ -117,7 +118,7 @@ export function registerLeadPoolTools(server, client) {
|
|
|
117
118
|
}
|
|
118
119
|
return formatResult({ data: { sets: rows, pageVersion: version } });
|
|
119
120
|
});
|
|
120
|
-
server.tool("conduyt_create_pool_filter_set", "Add a named filter set to a pool page (admin only). A new set is a DRAFT (off) unless isEnabled is true. Enabling a set that would OPEN the whole page (no rule) is refused with 409 pool_opens unless acknowledgeOpensPool is true. Every tag name a rule carries must be a live tag (422 tag_missing); a custom field must exist (422 custom_field_missing). pageVersion is the one your list read answered (409 page_version_stale when the page moved since: re-list and retry).", {
|
|
121
|
+
server.tool("conduyt_create_pool_filter_set", "Add a named filter set to a pool page (admin only). A new set is a DRAFT (off) unless isEnabled is true. Enabling a set that would OPEN the whole page (no rule) is refused with 409 pool_opens unless acknowledgeOpensPool is true. Every tag name a rule carries must be a live tag (422 tag_missing); a custom field must exist (422 custom_field_missing). pageVersion is the one your list read answered (409 page_version_stale when the page moved since: re-list and retry)." + " " + FORMULA_FILTER_NOTE, {
|
|
121
122
|
page: poolPage,
|
|
122
123
|
name: setName,
|
|
123
124
|
filters: filtersSchema,
|
|
@@ -129,7 +130,7 @@ export function registerLeadPoolTools(server, client) {
|
|
|
129
130
|
...(isEnabled !== undefined ? { isEnabled } : {}),
|
|
130
131
|
...(acknowledgeOpensPool !== undefined ? { acknowledgeOpensPool } : {}),
|
|
131
132
|
})));
|
|
132
|
-
server.tool("conduyt_update_pool_filter_set", "Rename, refilter, enable / disable or reorder a pool filter set (admin only). Pass only what changes. Switching a set on or changing its rules reconciles the open offers the page no longer shows; a change that OPENS the whole page needs acknowledgeOpensPool. pageVersion is the one your list read answered for the set's page (409 page_version_stale when the page moved since: re-list and retry).", {
|
|
133
|
+
server.tool("conduyt_update_pool_filter_set", "Rename, refilter, enable / disable or reorder a pool filter set (admin only). Pass only what changes. Switching a set on or changing its rules reconciles the open offers the page no longer shows; a change that OPENS the whole page needs acknowledgeOpensPool. pageVersion is the one your list read answered for the set's page (409 page_version_stale when the page moved since: re-list and retry)." + " " + FORMULA_FILTER_NOTE, {
|
|
133
134
|
id: z.string().uuid().describe("The set's UUID"),
|
|
134
135
|
name: setName.optional(),
|
|
135
136
|
filters: filtersSchema.optional(),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { FORMULA_FILTER_NOTE } from "./formula-fields.js";
|
|
2
3
|
import { formatResult } from "../client.js";
|
|
3
4
|
/**
|
|
4
5
|
* Personal saved filters for list pages (Velocify-style). Strictly
|
|
@@ -45,7 +46,7 @@ export function registerSavedFilterTools(server, client) {
|
|
|
45
46
|
const result = await client.get(`/api/v1/saved-filters${qs ? `?${qs}` : ""}`);
|
|
46
47
|
return formatResult(result);
|
|
47
48
|
});
|
|
48
|
-
server.tool("conduyt_create_saved_filter", "Save a named contact filter for one-click re-use — e.g. \"save a filter for Heather's Facebook leads\". Since 2026-09-24 a saved filter IS a personal Smart View (the Smart Views tab), private to the key's user for every role (max 50 per user). Requires the 'saved-filters' scope.", {
|
|
49
|
+
server.tool("conduyt_create_saved_filter", "Save a named contact filter for one-click re-use — e.g. \"save a filter for Heather's Facebook leads\". Since 2026-09-24 a saved filter IS a personal Smart View (the Smart Views tab), private to the key's user for every role (max 50 per user). Requires the 'saved-filters' scope." + " " + FORMULA_FILTER_NOTE, {
|
|
49
50
|
name: z.string().min(1).max(60).describe("Display name shown in the Saved dropdown (unique per user, max 60 chars)"),
|
|
50
51
|
filters: filtersSchema,
|
|
51
52
|
sortField: z.string().optional().describe("Sort field applied with the filter (default createdAt)"),
|
|
@@ -59,7 +60,7 @@ export function registerSavedFilterTools(server, client) {
|
|
|
59
60
|
const result = await client.post("/api/v1/smart-views", { name: params.name, filters: params.filters, sortField: params.sortField, sortOrder: params.sortOrder, icon: params.icon, personal: true });
|
|
60
61
|
return formatResult(result);
|
|
61
62
|
});
|
|
62
|
-
server.tool("conduyt_update_saved_filter", "Rename a saved filter (a personal Smart View) or replace its filters/sort. Owner-only — a personal view is its owner's for every role. Use conduyt_list_saved_filters or conduyt_list_smart_views to find the id. Requires the 'saved-filters' scope.", {
|
|
63
|
+
server.tool("conduyt_update_saved_filter", "Rename a saved filter (a personal Smart View) or replace its filters/sort. Owner-only — a personal view is its owner's for every role. Use conduyt_list_saved_filters or conduyt_list_smart_views to find the id. Requires the 'saved-filters' scope." + " " + FORMULA_FILTER_NOTE, {
|
|
63
64
|
id: z.string().uuid().describe("Saved filter UUID (from conduyt_list_saved_filters)"),
|
|
64
65
|
name: z.string().min(1).max(60).optional().describe("New display name (unique per user)"),
|
|
65
66
|
filters: filtersSchema,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { formatResult } from "../client.js";
|
|
3
|
+
import { FORMULA_FILTER_NOTE } from "./formula-fields.js";
|
|
3
4
|
export function registerSmartListTools(server, client) {
|
|
4
5
|
server.tool("conduyt_list_smart_lists", "List all smart lists (segments) with contact counts.", {}, async () => {
|
|
5
6
|
const result = await client.get("/api/v1/smart-lists");
|
|
@@ -11,7 +12,7 @@ export function registerSmartListTools(server, client) {
|
|
|
11
12
|
const result = await client.get(`/api/v1/smart-lists/${id}`);
|
|
12
13
|
return formatResult(result);
|
|
13
14
|
});
|
|
14
|
-
server.tool("conduyt_create_smart_list", "Create a new smart list (segment). Static lists have manually added contacts; dynamic lists use filter rules.", {
|
|
15
|
+
server.tool("conduyt_create_smart_list", "Create a new smart list (segment). Static lists have manually added contacts; dynamic lists use filter rules." + " " + FORMULA_FILTER_NOTE, {
|
|
15
16
|
name: z.string().describe("Smart list name"),
|
|
16
17
|
description: z.string().optional().describe("Description"),
|
|
17
18
|
type: z.enum(["static", "dynamic"]).optional().describe("List type — 'static' (manual) or 'dynamic' (filter-based). Default: static"),
|
|
@@ -20,7 +21,7 @@ export function registerSmartListTools(server, client) {
|
|
|
20
21
|
const result = await client.post("/api/v1/smart-lists", params);
|
|
21
22
|
return formatResult(result);
|
|
22
23
|
});
|
|
23
|
-
server.tool("conduyt_update_smart_list", "Update a smart list's name, description, type, or filters.", {
|
|
24
|
+
server.tool("conduyt_update_smart_list", "Update a smart list's name, description, type, or filters." + " " + FORMULA_FILTER_NOTE, {
|
|
24
25
|
id: z.string().describe("Smart list UUID"),
|
|
25
26
|
name: z.string().optional().describe("Updated name"),
|
|
26
27
|
description: z.string().optional().describe("Updated description"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-11-
|
|
3
|
-
"toolCount":
|
|
2
|
+
"generatedAt": "2026-11-13T01:41:44.165Z",
|
|
3
|
+
"toolCount": 429,
|
|
4
4
|
"totalEndpoints": 1207,
|
|
5
5
|
"counts": {
|
|
6
6
|
"covered": 378,
|
|
@@ -2501,7 +2501,8 @@
|
|
|
2501
2501
|
"POST /api/v1/custom-fields": {
|
|
2502
2502
|
"status": "covered",
|
|
2503
2503
|
"tools": [
|
|
2504
|
-
"conduyt_create_custom_field"
|
|
2504
|
+
"conduyt_create_custom_field",
|
|
2505
|
+
"conduyt_create_mirror_field"
|
|
2505
2506
|
]
|
|
2506
2507
|
},
|
|
2507
2508
|
"GET /api/v1/custom-fields/:id": {
|