conduyt-mcp 4.108.0 → 4.111.0
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/README.md +5 -0
- package/dist/register-all.js +8 -0
- package/dist/tool-annotations.js +34 -0
- package/dist/tools/automation-folders.d.ts +11 -0
- package/dist/tools/automation-folders.js +27 -0
- package/dist/tools/automations.js +1 -1
- package/dist/tools/booking-routing-forms.d.ts +12 -0
- package/dist/tools/booking-routing-forms.js +72 -0
- package/dist/tools/bulk.js +1 -1
- package/dist/tools/calls.js +18 -1
- package/dist/tools/contacts.js +2 -2
- package/dist/tools/custom-fields.js +3 -3
- package/dist/tools/deal-views.d.ts +21 -1
- package/dist/tools/deal-views.js +23 -0
- package/dist/tools/deals-page-views.js +13 -2
- package/dist/tools/deals.js +5 -3
- package/dist/tools/dialer-settings.d.ts +8 -0
- package/dist/tools/dialer-settings.js +25 -0
- package/dist/tools/drip-tracks.d.ts +11 -0
- package/dist/tools/drip-tracks.js +66 -0
- package/dist/tools/lifecycle.js +3 -3
- package/dist/tools/messaging.d.ts +2 -0
- package/dist/tools/messaging.js +6 -0
- package/dist/tools/routes66c.d.ts +22 -0
- package/dist/tools/routes66c.js +132 -0
- package/dist/tools/user-fields-doc.d.ts +2 -0
- package/dist/tools/user-fields-doc.js +2 -0
- package/package.json +1 -1
- package/scripts/coverage-manifest.json +10 -20
- package/scripts/coverage-matrix.json +162 -77
package/README.md
CHANGED
|
@@ -237,6 +237,11 @@ Text it is `conduyt_send_sms` with `invoiceId` (and `resend`).
|
|
|
237
237
|
| `conduyt_create_status_metadata` | Create a row (`stageId`, `code`, `bucket` slugs, `lifecycleStage`, drip fields, `isTerminal`, `notes`) |
|
|
238
238
|
| `conduyt_update_status_metadata` | Update a row; `expectedUpdatedAt` refuses a row changed or moved since (409 `metadata_changed` with the current row); 404 `status_metadata_not_found` |
|
|
239
239
|
| `conduyt_delete_status_metadata` | Delete a row (`expectedUpdatedAt` as above) |
|
|
240
|
+
| `conduyt_list_drip_tracks` / `conduyt_get_drip_track` | Read the drip tracks (the sequences status metadata names by `dripTrackId`) with their steps |
|
|
241
|
+
| `conduyt_create_drip_track` / `conduyt_update_drip_track` / `conduyt_delete_drip_track` | Manage a track (`name` slug, `label`, `channel`, `complianceProfile`, `steps`, `exitConditions`, `reEntryAllowed`, `isActive`); a delete clears the track from the status metadata rows that named it |
|
|
242
|
+
| `conduyt_list_booking_routing_forms` / `conduyt_get_booking_routing_form` / `conduyt_create_booking_routing_form` / `conduyt_update_booking_routing_form` / `conduyt_delete_booking_routing_form` | Booking routing forms (the questions a visitor answers before a booking page); reads need calendar:view, writes an owner / admin key; a passed `steps` list replaces the stored one |
|
|
243
|
+
| `conduyt_list_automation_folders` / `conduyt_create_automation_folder` / `conduyt_update_automation_folder` / `conduyt_delete_automation_folder` | Automation folders (name 1-80, `colorIndex` 0-5, 50 per account); a delete returns the folder's automations to Unfiled, never deletes them |
|
|
244
|
+
| `conduyt_import_drip_track_steps` | Replace the step list of up to 200 tracks by `trackName` (owner / admin key); read `errors[]` even on a 200 |
|
|
240
245
|
| `conduyt_import_status_metadata` | Set-based import (max 1000; `merge` or `replace`); read `errors[]` even on a 200; 409 `pipeline_archived` when an item names a stage of an archived pipeline |
|
|
241
246
|
|
|
242
247
|
### Mailchimp (API key scope `integrations`)
|
package/dist/register-all.js
CHANGED
|
@@ -28,6 +28,9 @@ import { registerCalendlyTools } from "./tools/calendly.js";
|
|
|
28
28
|
import { registerBoardSettingsTools } from "./tools/board-settings.js";
|
|
29
29
|
import { registerMailchimpTools } from "./tools/mailchimp.js";
|
|
30
30
|
import { registerStatusMetadataTools } from "./tools/status-metadata.js";
|
|
31
|
+
import { registerDripTrackTools } from "./tools/drip-tracks.js";
|
|
32
|
+
import { registerBookingRoutingFormTools } from "./tools/booking-routing-forms.js";
|
|
33
|
+
import { registerAutomationFolderTools } from "./tools/automation-folders.js";
|
|
31
34
|
import { registerNotificationTools } from "./tools/notifications.js";
|
|
32
35
|
import { registerChatTools } from "./tools/chat.js";
|
|
33
36
|
import { registerAiTeammateConnectTools } from "./tools/ai-teammate-connect.js";
|
|
@@ -66,6 +69,7 @@ import { registerBookingPageTools } from "./tools/booking-pages.js";
|
|
|
66
69
|
import { registerReportTools } from "./tools/reports.js";
|
|
67
70
|
import { registerReportDashboardTools } from "./tools/dashboards.js";
|
|
68
71
|
import { registerDocumentReaderTools } from "./tools/document-reader.js";
|
|
72
|
+
import { registerRoutes66cTools } from "./tools/routes66c.js";
|
|
69
73
|
/** Registers every Conduyt tool on the server; each tool gets its title + MCP annotations from src/tool-annotations.ts. */
|
|
70
74
|
export function registerAllTools(server, client) {
|
|
71
75
|
annotateRegistrations(server);
|
|
@@ -99,6 +103,9 @@ export function registerAllTools(server, client) {
|
|
|
99
103
|
registerBoardSettingsTools(server, client);
|
|
100
104
|
registerMailchimpTools(server, client);
|
|
101
105
|
registerStatusMetadataTools(server, client);
|
|
106
|
+
registerDripTrackTools(server, client);
|
|
107
|
+
registerBookingRoutingFormTools(server, client);
|
|
108
|
+
registerAutomationFolderTools(server, client);
|
|
102
109
|
registerNotificationTools(server, client);
|
|
103
110
|
registerChatTools(server, client);
|
|
104
111
|
registerAiTeammateConnectTools(server, client);
|
|
@@ -137,4 +144,5 @@ export function registerAllTools(server, client) {
|
|
|
137
144
|
registerReportTools(server, client);
|
|
138
145
|
registerReportDashboardTools(server, client);
|
|
139
146
|
registerDocumentReaderTools(server, client);
|
|
147
|
+
registerRoutes66cTools(server, client);
|
|
140
148
|
}
|
package/dist/tool-annotations.js
CHANGED
|
@@ -124,6 +124,7 @@ export const TOOL_ANNOTATIONS = {
|
|
|
124
124
|
conduyt_search_dialer_history: ro("Search Dialer History"),
|
|
125
125
|
conduyt_search_dialer_calls: ro("Search Dialer Calls"),
|
|
126
126
|
conduyt_count_unknown_callers: ro("Count Unknown Callers"),
|
|
127
|
+
conduyt_list_lead_rings: ro("List Lead Rings"),
|
|
127
128
|
conduyt_link_call: update("Link Call"),
|
|
128
129
|
conduyt_get_call: ro("Get Call"),
|
|
129
130
|
conduyt_get_post_call_insight: ro("Get Post Call Insight"),
|
|
@@ -132,6 +133,24 @@ export const TOOL_ANNOTATIONS = {
|
|
|
132
133
|
conduyt_get_dialer_settings: ro("Get Dialer Settings"),
|
|
133
134
|
conduyt_update_dialer_settings: update("Update Dialer Settings"),
|
|
134
135
|
conduyt_get_calling_hours: ro("Get Calling Hours"),
|
|
136
|
+
conduyt_get_call_late_link: ro("Get Call Late Link"),
|
|
137
|
+
// (parity66c) routes that had no tool: calendar connections / health / sync / events, mailbox connections, integrations health,
|
|
138
|
+
// the call log, the Twilio settings (non-credential fields), the duplicate contact groups
|
|
139
|
+
conduyt_list_calendar_connections: ro("List Calendar Connections"),
|
|
140
|
+
conduyt_get_calendar_health: ro("Get Calendar Health"),
|
|
141
|
+
conduyt_sync_calendar: create("Sync Calendar"), // reads the provider's events into Conduyt; each call is a new sync
|
|
142
|
+
conduyt_list_calendar_events: ro("List Calendar Events"),
|
|
143
|
+
conduyt_get_calendar_event: ro("Get Calendar Event"),
|
|
144
|
+
conduyt_create_calendar_event: create("Create Calendar Event"), // writes an event at the provider; a repeat makes another
|
|
145
|
+
conduyt_update_calendar_event: create("Update Calendar Event"), // NOT idempotent (Codex parity66c-r1): every successful PATCH calls the provider again and records another audit event
|
|
146
|
+
conduyt_delete_calendar_event: destroy("Delete Calendar Event"), // removes the event at the provider and in Conduyt
|
|
147
|
+
conduyt_list_mailbox_connections: ro("List Mailbox Connections"),
|
|
148
|
+
conduyt_get_integrations_health: ro("Get Integrations Health"),
|
|
149
|
+
conduyt_log_call: create("Log Call"), // records a call row (never dials); a repeat records another
|
|
150
|
+
conduyt_get_twilio_settings: ro("Get Twilio Settings"),
|
|
151
|
+
conduyt_update_twilio_settings: row("Update Twilio Settings", false, true, false), // destructive + not idempotent (Codex parity66c-r1): it can clear phoneNumber / twimlAppSid, release or rewire provider resources, and each save is audited; no credential is taken
|
|
152
|
+
conduyt_find_duplicate_contacts: ro("Find Duplicate Contacts"), // (callcontact66) GET /settings, the callLateLink block only
|
|
153
|
+
conduyt_update_call_late_link: update("Update Call Late Link"), // (callcontact66) PATCH /settings merges callLateLink; the same body lands on the same state; it links future calls only and deletes nothing
|
|
135
154
|
conduyt_update_calling_hours: destroy("Update Calling Hours"), // enabled:false (with acknowledgeAnyHour) switches the calling-time check off, which re-enables outreach at any hour: a compliance change like the DNC removals; a repeat saves the same window
|
|
136
155
|
conduyt_get_call_recording_settings: ro("Get Call Recording Settings"),
|
|
137
156
|
conduyt_update_call_recording_settings: update("Update Call Recording Settings"),
|
|
@@ -226,6 +245,21 @@ export const TOOL_ANNOTATIONS = {
|
|
|
226
245
|
conduyt_update_status_metadata: row("Update Status Metadata", false, false, false), // every successful write advances the concurrency version (status-metadata/[id]/route.ts:201)
|
|
227
246
|
conduyt_delete_status_metadata: destroy("Delete Status Metadata"),
|
|
228
247
|
conduyt_import_status_metadata: row("Import Status Metadata", false, true, false), // replace mode deletes and recreates rows with new ids; merge mode advances updatedAt (the concurrency version) on every call
|
|
248
|
+
conduyt_list_drip_tracks: ro("List Drip Tracks"),
|
|
249
|
+
conduyt_get_drip_track: ro("Get Drip Track"),
|
|
250
|
+
conduyt_create_drip_track: create("Create Drip Track"),
|
|
251
|
+
conduyt_update_drip_track: row("Update Drip Track", false, true, false), // a steps list REPLACES the stored one ({ steps: [] } erases every step) and every successful call appends an audit row
|
|
252
|
+
conduyt_delete_drip_track: destroy("Delete Drip Track"), // clears dripTrackId on the status metadata rows that named it
|
|
253
|
+
conduyt_import_drip_track_steps: row("Import Drip Track Steps", false, true, false), // replaces each named track's whole step list; every call appends a steps_imported audit row
|
|
254
|
+
conduyt_list_booking_routing_forms: ro("List Booking Routing Forms"),
|
|
255
|
+
conduyt_get_booking_routing_form: ro("Get Booking Routing Form"),
|
|
256
|
+
conduyt_create_booking_routing_form: create("Create Booking Routing Form"),
|
|
257
|
+
conduyt_update_booking_routing_form: row("Update Booking Routing Form", false, true, false), // a steps list REPLACES the stored questions ({ steps: [] } erases them) and every successful call appends an audit row
|
|
258
|
+
conduyt_delete_booking_routing_form: destroy("Delete Booking Routing Form"), // the form's public link stops working
|
|
259
|
+
conduyt_list_automation_folders: ro("List Automation Folders"),
|
|
260
|
+
conduyt_create_automation_folder: create("Create Automation Folder"),
|
|
261
|
+
conduyt_update_automation_folder: row("Update Automation Folder", false, false, false), // every successful call writes again and appends an audit row
|
|
262
|
+
conduyt_delete_automation_folder: destroy("Delete Automation Folder"), // never deletes an automation: they return to Unfiled
|
|
229
263
|
conduyt_list_notifications: ro("List Notifications"),
|
|
230
264
|
conduyt_create_notification: create("Create Notification"),
|
|
231
265
|
conduyt_list_chat_channels: update("List Chat Channels"),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ConduytClient } from "../client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Automation folders (app: /api/v1/automation-folders): the named, coloured folders the Automations list groups workflows in.
|
|
5
|
+
* Reads need automations:view, create automations:create, rename / recolor / delete automations:edit (a key restricted to
|
|
6
|
+
* some pipelines cannot write: 403). A folder holds no data of its own: deleting one never deletes an automation.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AUTOMATION_FOLDER_MAX_NAME = 80;
|
|
9
|
+
export declare const AUTOMATION_FOLDER_COLORS = 6;
|
|
10
|
+
export declare const AUTOMATION_FOLDER_MAX = 50;
|
|
11
|
+
export declare function registerAutomationFolderTools(server: McpServer, client: ConduytClient): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { formatResult } from "../client.js";
|
|
3
|
+
import { strictInput } from "./strict.js";
|
|
4
|
+
/**
|
|
5
|
+
* Automation folders (app: /api/v1/automation-folders): the named, coloured folders the Automations list groups workflows in.
|
|
6
|
+
* Reads need automations:view, create automations:create, rename / recolor / delete automations:edit (a key restricted to
|
|
7
|
+
* some pipelines cannot write: 403). A folder holds no data of its own: deleting one never deletes an automation.
|
|
8
|
+
*/
|
|
9
|
+
export const AUTOMATION_FOLDER_MAX_NAME = 80;
|
|
10
|
+
export const AUTOMATION_FOLDER_COLORS = 6;
|
|
11
|
+
export const AUTOMATION_FOLDER_MAX = 50;
|
|
12
|
+
const FOLDER_ERRORS = "Refusals are the server's: 400 for a name that is empty or over 80 characters, a colorIndex outside 0-5, nothing to update, or the 50-folder cap; 403 for a key restricted to some pipelines; 404 'Folder not found'.";
|
|
13
|
+
export function registerAutomationFolderTools(server, client) {
|
|
14
|
+
strictInput(server.tool("conduyt_list_automation_folders", "List the account's automation folders (GET /api/v1/automation-folders; automations:view), oldest first, each { id, name, colorIndex, automationCount, createdAt, updatedAt }. automationCount leaves out deleted automations.", {}, async () => formatResult(await client.get("/api/v1/automation-folders"))));
|
|
15
|
+
strictInput(server.tool("conduyt_create_automation_folder", "Create an automation folder (POST /api/v1/automation-folders; automations:create, active billing). name is 1-80 characters; colorIndex (integer 0-5) defaults to the next colour in turn. At most 50 folders per account. " + FOLDER_ERRORS, {
|
|
16
|
+
name: z.string().trim().min(1).max(AUTOMATION_FOLDER_MAX_NAME).describe("Folder name, 1-80 characters"),
|
|
17
|
+
colorIndex: z.number().int().min(0).max(AUTOMATION_FOLDER_COLORS - 1).optional().describe("Colour index 0-5"),
|
|
18
|
+
}, async ({ name, colorIndex }) => formatResult(await client.post("/api/v1/automation-folders", { name, colorIndex }))));
|
|
19
|
+
strictInput(server.tool("conduyt_update_automation_folder", "Rename and / or recolor an automation folder (PATCH /api/v1/automation-folders/{id}; automations:edit, active billing). Send name and / or colorIndex; neither is a 400. " + FOLDER_ERRORS, {
|
|
20
|
+
id: z.string().uuid().describe("Folder UUID"),
|
|
21
|
+
name: z.string().trim().min(1).max(AUTOMATION_FOLDER_MAX_NAME).optional().describe("New name, 1-80 characters"),
|
|
22
|
+
colorIndex: z.number().int().min(0).max(AUTOMATION_FOLDER_COLORS - 1).optional().describe("New colour index 0-5"),
|
|
23
|
+
}, async ({ id, name, colorIndex }) => formatResult(await client.patch(`/api/v1/automation-folders/${id}`, { name, colorIndex }))));
|
|
24
|
+
strictInput(server.tool("conduyt_delete_automation_folder", "Delete an automation folder (DELETE /api/v1/automation-folders/{id}; automations:edit, not gated by billing). The folder's automations are NEVER deleted: they return to Unfiled. Answers { id, deleted: true, automationsUnfiled }. " + FOLDER_ERRORS, {
|
|
25
|
+
id: z.string().uuid().describe("Folder UUID"),
|
|
26
|
+
}, async ({ id }) => formatResult(await client.del(`/api/v1/automation-folders/${id}`))));
|
|
27
|
+
}
|
|
@@ -11,7 +11,7 @@ export const SEND_ONCE_EMAIL_NOTE = " Send once per contact: send_email config {
|
|
|
11
11
|
/** (parity64, app batonaudit64, live OpenAPI POST /automations/{id}/publish) publish judges a baton step's configured stages by the rule the run applies */
|
|
12
12
|
export const BATON_STAGE_REFUSED_NOTE = " Publish checks a baton step's configured stages by the rule the run applies (app batonaudit64): a handoff_and_keep stageId that is a Won, Lost, holding or finished-work stage, or a handoff_and_keep or credit_baton_source parkedStageId that is a Won, Lost or holding stage or one without Finished work, is a publish ERROR with code baton_stage_refused (422; the key in `field`, naming the stage and the reason, in data.errors), unless that same setting (the same step, the same action, the same stage) was already live in the published graph: then it is a WARNING with the same code (in data.warnings), so the automation stays editable.";
|
|
13
13
|
/** (handoffkeep55, app) the baton hand-off actions; the catalog does not carry action config */
|
|
14
|
-
export const BATON_HANDOFF_ACTIONS_NOTE = " Baton hand-off (app handoffkeep55): handoff_and_keep config {pipelineId (required, the receiver's pipeline), stageId, assignedTo (required, the receiver: a user id or one merge field naming a user on the trigger, such as {{trigger.userId}} or {{trigger.assignedTo}}; it must render to an active member who can see the receiver's pipeline, never the card's own owner, else the step is refused with a review task), parkedStageId (required, a finished-work stage (isParked) of the run's card's OWN pipeline), destinationEntryAutomations (fire default | suppress), copyNotes, listDocuments, source}: opens a NEW card for the receiver and, in the same transaction, credits the run's card: it moves to parkedStageId with status still OPEN (never Won: no deal.won, no Hyros sale, no #wins post, no master status change, no Post-Close card) and gets a write-once receipt (deal fields handedOffAt = the credit date, handedOffToDealId, handedOffByExecutionId); a card already handed off answers skipped already_handed_off; a Won, Lost or holding stage anywhere, a finished-work stage as the receiver's stage or as the card's current stage, the receiver being the owner (same_person) or a Post-Close target or source is refused; a later webhook step reads the receiver's card as {{deal.handed_off_to_deal_id}}. credit_baton_source config {sourcePipelineId (required), parkedStageId (required), matchField and/or leadIdField (existing deal custom fields both cards carry), ownerField (an existing user or text deal field; a missing or wrong-type field blocks publish and fails the run visibly with field_missing / field_wrong_type and a review task), lookbackDays (1-90, default 30), windowMinutes (5-1440, default 120), reviewerIds}: on a receiver's card a form created, credits the ONE earlier open card of the same contact in sourcePipelineId (same receipt, same stage rule); none = nothing, two or more = no credit and a review task (default reviewers: owners and admins); decided once per card (deal fields batonResolution bound | none | ambiguous, batonBoundDealId); it refuses (too_early) until windowMinutes after the card was created, so put a delay before it." + BATON_STAGE_REFUSED_NOTE;
|
|
14
|
+
export const BATON_HANDOFF_ACTIONS_NOTE = " Baton hand-off (app handoffkeep55): handoff_and_keep config {pipelineId (required, the receiver's pipeline), stageId, assignedTo (required, the receiver: a user id or one merge field naming a user on the trigger, such as {{trigger.userId}} or {{trigger.assignedTo}}; it must render to an active member who can see the receiver's pipeline, never the card's own owner, else the step is refused with a review task), parkedStageId (required, a finished-work stage (isParked) of the run's card's OWN pipeline), destinationEntryAutomations (fire default | suppress), copyNotes, listDocuments, source}: opens a NEW card for the receiver and, in the same transaction, credits the run's card: it moves to parkedStageId with status still OPEN (never Won: no deal.won, no Hyros sale, no #wins post, no master status change, no Post-Close card) and gets a write-once receipt (deal fields handedOffAt = the credit date, handedOffToDealId, handedOffByExecutionId); a card already handed off answers skipped already_handed_off; a Won, Lost or holding stage anywhere, a finished-work stage as the receiver's stage or as the card's current stage, the receiver being the owner (same_person) or a Post-Close target or source is refused; a later webhook step reads the receiver's card as {{deal.handed_off_to_deal_id}}. credit_baton_source config {sourcePipelineId (required), parkedStageId (required), matchField and/or leadIdField (existing deal custom fields both cards carry), ownerField (an existing user or text deal field; a missing or wrong-type field blocks publish and fails the run visibly with field_missing / field_wrong_type and a review task), lookbackDays (1-90, default 30), windowMinutes (5-1440, default 120), reviewerIds}: on a receiver's card a form created, credits the ONE earlier open card of the same contact in sourcePipelineId (same receipt, same stage rule); none = nothing, two or more = no credit and a review task (default reviewers: owners and admins); decided once per card (deal fields batonResolution bound | none | ambiguous, batonBoundDealId); it refuses (too_early) until windowMinutes after the card was created, so put a delay before it. Hand Off Deal, the two-card hand-off (app handoff_deal): handoff_deal config {pipelineId (required, the target pipeline), stageId (default the target pipeline's first stage), assignedTo (a user id of an active member: the new card is assigned to them, and the step is refused when they are not one; blank = the new card is unassigned unless keepSourceOwner is true; a hand-off into the workspace's Post-Close pipeline ignores it: that card takes the originating card's owner, or is unassigned when that card has no owner or its owner is no longer an active member; whether the target is the Post-Close pipeline is read from the workspace settings when the step starts, so a settings change in that moment can apply the other rule to that one card), keepSourceOwner (true gives the new card the source card's owner as it is when the card is created, or leaves it unassigned when that card has no owner or its owner is no longer an active member; used only when assignedTo is blank and the target is not the Post-Close pipeline; default false), copyNotes (default true), listDocuments (default true), source (default the current card's source, else the contact's source, else \"Unknown (created via deal hand-off)\")}: opens a NEW card for the contact in another pipeline and the current card keeps its own outcome (unlike handoff_and_keep it is not moved to a finished-work stage)." + BATON_STAGE_REFUSED_NOTE;
|
|
15
15
|
/** (#124, automation unknown keys / types) the refusal codes the write paths answer; surfaced verbatim by the client (details JSON object last), never retried */
|
|
16
16
|
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).";
|
|
17
17
|
/** (idleoff57) the conditional switch-off, documented for an agent; (idleroute58) sent to POST /automations/:id/deactivate-if-idle */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ConduytClient } from "../client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Booking routing forms (app: /api/v1/booking-routing-forms): the question forms a visitor answers before the booking page
|
|
5
|
+
* they are sent to. Reads need calendar:view; writes need an owner / admin key and active billing. The public page that
|
|
6
|
+
* serves a form (/public/booking/routing/{slug}) is keyless and is not a tool.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ROUTING_STEP_TYPES: readonly ["select", "radio", "text"];
|
|
9
|
+
/** the server's own slug rule (lib/booking.ts normalizeSlug): the bound is judged on the NORMALISED value, so "---" (empty after
|
|
10
|
+
* normalising) is refused here and "a b" (-> "a-b") is accepted, exactly as the route does */
|
|
11
|
+
export declare function normalizeRoutingSlug(raw: string): string;
|
|
12
|
+
export declare function registerBookingRoutingFormTools(server: McpServer, client: ConduytClient): void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { formatResult } from "../client.js";
|
|
3
|
+
import { strictInput } from "./strict.js";
|
|
4
|
+
/**
|
|
5
|
+
* Booking routing forms (app: /api/v1/booking-routing-forms): the question forms a visitor answers before the booking page
|
|
6
|
+
* they are sent to. Reads need calendar:view; writes need an owner / admin key and active billing. The public page that
|
|
7
|
+
* serves a form (/public/booking/routing/{slug}) is keyless and is not a tool.
|
|
8
|
+
*/
|
|
9
|
+
export const ROUTING_STEP_TYPES = ["select", "radio", "text"];
|
|
10
|
+
/** the server's own slug rule (lib/booking.ts normalizeSlug): the bound is judged on the NORMALISED value, so "---" (empty after
|
|
11
|
+
* normalising) is refused here and "a b" (-> "a-b") is accepted, exactly as the route does */
|
|
12
|
+
export function normalizeRoutingSlug(raw) {
|
|
13
|
+
return raw.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64);
|
|
14
|
+
}
|
|
15
|
+
const slugField = z.string().refine((s) => normalizeRoutingSlug(s).length >= 3, "slug must be at least 3 characters once normalised (letters, numbers or hyphens)");
|
|
16
|
+
/** the route ignores a blank title on PATCH (a silent success) and refuses it on create: refuse it here for both */
|
|
17
|
+
const nonBlank = z.string().trim().min(1, "must not be blank");
|
|
18
|
+
const optionSchema = z.object({
|
|
19
|
+
label: z.string().min(1).describe("Option text shown to the visitor"),
|
|
20
|
+
value: z.string().min(1).describe("Option value"),
|
|
21
|
+
routeTo: z.string().optional().describe("Where this answer routes (a booking page slug or path)"),
|
|
22
|
+
}).strict();
|
|
23
|
+
const stepSchema = z.object({
|
|
24
|
+
id: z.string().min(1).describe("Step id (unique within the form)"),
|
|
25
|
+
question: z.string().min(1).describe("The question text"),
|
|
26
|
+
type: z.enum(ROUTING_STEP_TYPES).describe("select, radio or text"),
|
|
27
|
+
options: z.array(optionSchema).optional().describe("The choices of a select / radio step"),
|
|
28
|
+
required: z.boolean().optional().describe("Required (default true)"),
|
|
29
|
+
}).strict();
|
|
30
|
+
const STEPS_NOTE = "The server keeps at most 50 steps and silently drops a step with no id, no question or a type outside select / radio / text, and an option with no label or value; read the answer to see what was stored.";
|
|
31
|
+
const FORM_ERRORS = "Refusals are the server's: 400 'title is required' / 'slug is required' / 'slug must be at least 3 characters', 403 for a key that is not owner / admin, 404 'Routing form not found', 409 'A routing form with this slug already exists'.";
|
|
32
|
+
export function registerBookingRoutingFormTools(server, client) {
|
|
33
|
+
strictInput(server.tool("conduyt_list_booking_routing_forms", "List the account's booking routing forms (GET /api/v1/booking-routing-forms; calendar:view), newest first, answered { data: [form], meta: { page, per_page, total, has_more } }. Each form has id, slug, title, description, isActive and steps.", {
|
|
34
|
+
search: z.string().optional().describe("Matches title, slug or description (case-insensitive)"),
|
|
35
|
+
isActive: z.boolean().optional().describe("Only active (true) or inactive (false) forms"),
|
|
36
|
+
page: z.number().int().min(1).optional().describe("Page, from 1"),
|
|
37
|
+
perPage: z.number().int().min(1).max(200).optional().describe("Rows per page (default 50, max 200)"),
|
|
38
|
+
}, async ({ search, isActive, page, perPage }) => {
|
|
39
|
+
const qs = new URLSearchParams();
|
|
40
|
+
if (search !== undefined)
|
|
41
|
+
qs.set("search", search);
|
|
42
|
+
if (isActive !== undefined)
|
|
43
|
+
qs.set("is_active", String(isActive));
|
|
44
|
+
if (page !== undefined)
|
|
45
|
+
qs.set("page", String(page));
|
|
46
|
+
if (perPage !== undefined)
|
|
47
|
+
qs.set("per_page", String(perPage));
|
|
48
|
+
const q = qs.toString();
|
|
49
|
+
return formatResult(await client.get("/api/v1/booking-routing-forms" + (q ? "?" + q : "")));
|
|
50
|
+
}));
|
|
51
|
+
strictInput(server.tool("conduyt_get_booking_routing_form", "Get one booking routing form with its steps (GET /api/v1/booking-routing-forms/{id}; calendar:view). 404 'Routing form not found'.", {
|
|
52
|
+
id: z.string().uuid().describe("Routing form UUID"),
|
|
53
|
+
}, async ({ id }) => formatResult(await client.get(`/api/v1/booking-routing-forms/${id}`))));
|
|
54
|
+
strictInput(server.tool("conduyt_create_booking_routing_form", "Create a booking routing form (POST /api/v1/booking-routing-forms; owner / admin key, active billing). title and slug are required; the slug is normalised (lowercase letters, numbers and hyphens, at least 3 characters) and is unique across the product. isActive defaults to true. " + STEPS_NOTE + " " + FORM_ERRORS, {
|
|
55
|
+
title: nonBlank.describe("Form title"),
|
|
56
|
+
slug: slugField.describe("URL slug, e.g. 'find-your-consult' (normalised by the server)"),
|
|
57
|
+
description: z.string().nullable().optional().describe("Description, or null"),
|
|
58
|
+
isActive: z.boolean().optional().describe("Active (default true)"),
|
|
59
|
+
steps: z.array(stepSchema).max(50).optional().describe("The ordered questions"),
|
|
60
|
+
}, async ({ title, slug, description, isActive, steps }) => formatResult(await client.post("/api/v1/booking-routing-forms", { title, slug, description, isActive, steps }))));
|
|
61
|
+
strictInput(server.tool("conduyt_update_booking_routing_form", "Update a booking routing form (PATCH /api/v1/booking-routing-forms/{id}; owner / admin key, active billing). Only the fields you pass change; a passed steps list REPLACES the stored steps (an empty list clears them). " + STEPS_NOTE + " " + FORM_ERRORS, {
|
|
62
|
+
id: z.string().uuid().describe("Routing form UUID"),
|
|
63
|
+
title: nonBlank.optional().describe("Form title"),
|
|
64
|
+
slug: slugField.optional().describe("URL slug (normalised; 409 if taken)"),
|
|
65
|
+
description: z.string().nullable().optional().describe("Description, or null to clear"),
|
|
66
|
+
isActive: z.boolean().optional().describe("Active"),
|
|
67
|
+
steps: z.array(stepSchema).max(50).optional().describe("The full ordered question list (replaces the stored one)"),
|
|
68
|
+
}, async ({ id, title, slug, description, isActive, steps }) => formatResult(await client.patch(`/api/v1/booking-routing-forms/${id}`, { title, slug, description, isActive, steps }))));
|
|
69
|
+
strictInput(server.tool("conduyt_delete_booking_routing_form", "Delete a booking routing form (DELETE /api/v1/booking-routing-forms/{id}; owner / admin key, active billing). Answers { deleted: true }. The form's public link stops working. 404 'Routing form not found'.", {
|
|
70
|
+
id: z.string().uuid().describe("Routing form UUID"),
|
|
71
|
+
}, async ({ id }) => formatResult((await client.del(`/api/v1/booking-routing-forms/${id}`)) ?? { deleted: true, id })));
|
|
72
|
+
}
|
package/dist/tools/bulk.js
CHANGED
|
@@ -68,7 +68,7 @@ export function registerBulkTools(server, client) {
|
|
|
68
68
|
});
|
|
69
69
|
return formatResult(result);
|
|
70
70
|
});
|
|
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
|
+
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), last_attempt_after / last_attempt_before or no_attempt_days (the card's Last attempt, dealattempt66). Answer: { deals, meta { total, exported_at, filters_applied } } (each deal carries lastAttemptAt; the CSV export has a Last Attempt column just before Deal ID); 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, {
|
|
72
72
|
search: z.string().optional().describe("Search deal titles"),
|
|
73
73
|
status: z.string().optional().describe("Filter by status (open, won, lost, or all for every status). open = open WORK: cards in a finished-work stage (isParked) are left out, as on the board"),
|
|
74
74
|
include_parked: z.boolean().optional().describe("(stageparked53) true or false; the API's default is false = open work. With status open: true also returns the cards in a finished-work stage (isParked), i.e. every not-closed record (sent as include_parked=true); use it to find or share a card. Without status open it changes nothing, as in the API (the export route's own default is also false). Alias: includeParked."),
|
package/dist/tools/calls.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { formatResult } from "../client.js";
|
|
3
|
+
import { strictInput } from "./strict.js";
|
|
3
4
|
/** Where a call's audio is fetched (no tool carries the bytes: a binary stream does not belong in a tool result). */
|
|
4
5
|
export const RECORDING_DOWNLOAD_NOTE = "AUDIO is not returned by any tool: GET {API base}/api/v1/dialer/call/{id}/media?type=recording (or type=voicemail) streams it, with the header `Authorization: Bearer <the same API key>`; add `&download=1` (or `download=true`) for a `Content-Disposition: attachment` file named `<Contact or number>_<date>_<time>_<callId8>.mp3` (the same authorisation and the same stream; a call with no media is a 404). The conduyt CLI does this: `conduyt dialer recording download <callId> [--voicemail] [-o file]`.";
|
|
5
6
|
/** (#1262) PATCH /dialer/call/{id}: the saved outcome of a call, and how a Callback is set up. */
|
|
@@ -131,7 +132,7 @@ export function registerCallTools(server, client) {
|
|
|
131
132
|
const result = await client.get(`/api/v1/dialer/calls?${searchQuery(args)}`);
|
|
132
133
|
return formatResult(result);
|
|
133
134
|
});
|
|
134
|
-
server.tool("conduyt_count_unknown_callers", "Count a line's unknown callers since an instant (GET /api/v1/calls/unknown-callers, the toll-free quick mode counter: 'N unknown callers today, M not matched yet'). `total` = inbound calls to that line since `since` that arrived with no contact (still contact-less plus the ones the unknown-caller prompt linked since); `unmatched` = those still contact-less (list them with conduyt_search_dialer_history unmatched=true and line). `since` is the caller's start of day as an ISO instant and must be within the last 31 days. Refusals are 400 line_required, line_conflict, line_invalid, since_required, since_conflict, since_out_of_range. Read-only, counts only; requires dialer:view (a scoped member counts their own calls, contact-less calls and calls linked to a contact they can see).", {
|
|
135
|
+
server.tool("conduyt_count_unknown_callers", "Count a line's unknown callers since an instant (GET /api/v1/calls/unknown-callers, the toll-free quick mode counter: 'N unknown callers today, M not matched yet'). `total` = inbound calls to that line since `since` that arrived with no contact (still contact-less plus the ones the unknown-caller prompt linked since and, callcontact66, the ones the late link attached since: call_auto_linked, see conduyt_get_call_late_link); `unmatched` = those still contact-less (list them with conduyt_search_dialer_history unmatched=true and line). `since` is the caller's start of day as an ISO instant and must be within the last 31 days. Refusals are 400 line_required, line_conflict, line_invalid, since_required, since_conflict, since_out_of_range. Read-only, counts only; requires dialer:view (a scoped member counts their own calls, contact-less calls and calls linked to a contact they can see).", {
|
|
135
136
|
line: z.string().trim().min(1).describe("Our line (the number the callers dialed), any formatting, e.g. +18005550199"),
|
|
136
137
|
since: z.string().datetime({ offset: true }).describe("ISO instant, the caller's midnight, e.g. 2026-10-15T07:00:00.000Z; within the last 31 days"),
|
|
137
138
|
}, async ({ line, since }) => {
|
|
@@ -139,6 +140,22 @@ export function registerCallTools(server, client) {
|
|
|
139
140
|
const result = await client.get(`/api/v1/calls/unknown-callers?${params}`);
|
|
140
141
|
return formatResult(result);
|
|
141
142
|
});
|
|
143
|
+
// (mcprings71 r1 P2) strict: an unknown key (a typo such as contactID) is refused, never stripped into an unfiltered list
|
|
144
|
+
strictInput(server.tool("conduyt_list_lead_rings", "List the \"Ring the team for this lead\" rings, newest first (GET /api/v1/lead-rings, app shotgun50): who was rung, who answered, when. Each row: { id, contactId, dealId (null to a key without the deals scope), automationId (the automation that rang the team), status (open | won | expired: expired = ended without a winner, i.e. nobody answered in time, the lead could not be assigned, nobody could be rung, or the run stopped; an open ring past its time reads expired), answeredBy (the user who answered, or null), answeredAt, rung (the user ids rung), notRung ([{ userId, reason }]: the step's people left out BEFORE the ring was placed and why, e.g. not available, today's limit reached, over the ring limit; a leg that then failed to place, or was still waiting to be placed when the ring closed or ran out of time, is not listed here (nor in rung; a leg whose placement completed is in rung, even when it completed after the ring closed), so notRung is not the complete inverse of rung), createdAt, endsAt (null while the ring is still being placed), cancelFailed (true: cancelling the other phones failed at its bound, they rang on until the ring time was up) }. Owners and admins see every ring; anyone else sees only the rings that rang them. Filters: contactId (one lead), status, limit 1-100 (default 25). Read-only; requires dialer:view. Answering a ring is a person's softphone only (an API key cannot answer).", {
|
|
145
|
+
contactId: z.string().uuid().optional().describe("Only this lead's rings (contact UUID)"),
|
|
146
|
+
status: z.enum(["open", "won", "expired"]).optional().describe("open (still ringing), won (someone answered) or expired (ended without a winner: nobody answered in time, the lead could not be assigned, nobody could be rung, or the run stopped)"),
|
|
147
|
+
limit: z.number().int().min(1).max(100).optional().describe("Rows, 1-100 (default 25)"),
|
|
148
|
+
}, async ({ contactId, status, limit }) => {
|
|
149
|
+
const params = new URLSearchParams();
|
|
150
|
+
if (contactId)
|
|
151
|
+
params.set("contactId", contactId);
|
|
152
|
+
if (status)
|
|
153
|
+
params.set("status", status);
|
|
154
|
+
if (limit !== undefined)
|
|
155
|
+
params.set("limit", String(limit));
|
|
156
|
+
const result = await client.get(`/api/v1/lead-rings?${params}`);
|
|
157
|
+
return formatResult(result);
|
|
158
|
+
}));
|
|
142
159
|
server.tool("conduyt_link_call", "Link a contact-less call to an existing contact (the unknown-caller prompt's 'Search a contact' + Attach). attachNumber=true also writes the call's number into the contact's next free phone slot (empty primary, then phone_2, phone_3 ...; never overwrites; already there = no write). dryRun=true answers exactly what the request would do (attached.slot, alreadyOnContact, alreadyLinked, or the same refusal) and writes nothing: call it first to tell a human what will happen. Refusals write nothing: 409 call_already_linked, no_free_phone_slot, number_on_another_contact (another contact has it as its primary phone), number_owner_undecidable (too many contacts share the number's last seven digits to prove who owns it: link without attachNumber); 403 contact_not_editable (attach needs edit rights on the contact); 404 call_not_found / contact_not_found; 422 number_unusable. A repeat of a successful link is idempotent (alreadyLinked=true). To create a NEW lead from the call instead, use conduyt_create_contact with callId. Requires dialer:create, plus contacts:edit when attachNumber is true.", {
|
|
143
160
|
id: z.string().uuid().describe("Call UUID (a contact-less call, e.g. from conduyt_list_calls)"),
|
|
144
161
|
contactId: z.string().uuid().describe("The contact to link the call to"),
|
package/dist/tools/contacts.js
CHANGED
|
@@ -188,7 +188,7 @@ export function registerContactTools(server, client) {
|
|
|
188
188
|
company: z.string().optional().describe("Company name"),
|
|
189
189
|
source: z.string().trim().min(1).max(100).optional().describe("Lead source (e.g. 'website', 'referral', 'import') — FIRST-WRITE-WINS acquisition truth for the lead; later inbound events do not overwrite it. 1-100 chars. Refused together with callId."),
|
|
190
190
|
assignedTo: z.string().min(1).optional().describe("Owner (user ID) of the new lead. Refused together with callId: a lead made from a call is owned by the rep who took it."),
|
|
191
|
-
masterStatus: z.string().trim().min(1).max(40).optional().describe("Lifecycle status of the LEAD (master record), distinct from any deal's status: 'open' (default), 'won', 'lost', 'abandoned', 'disqualified', or an account-defined custom status. A terminal status (won/lost/abandoned/disqualified)
|
|
191
|
+
masterStatus: z.string().trim().min(1).max(40).optional().describe("Lifecycle status of the LEAD (master record), distinct from any deal's status: 'open' (default), 'won', 'lost', 'abandoned', 'disqualified', or an account-defined custom status. A terminal status (won/lost/abandoned/disqualified) stops this contact's drips, sequences and playbooks; (wonmail66) automations, scheduled automation sends included, still act for a contact in any lead status (a workflow that must leave closed leads alone adds a contact.masterStatus condition). Consent (opt-out, DNC, litigator, GDPR forget) still applies everywhere. Use conduyt_get_lifecycle_settings to see the account's configured statuses."),
|
|
192
192
|
tags: z.array(z.string()).optional().describe("Tag UUIDs to apply (tags must already exist — create them with conduyt_create_tag first)"),
|
|
193
193
|
customFields: z.record(z.any()).optional().describe("Structured custom-field values keyed by field key, e.g. { lead_temperature: 'hot', budget: 50000 }. Define fields first with conduyt_create_custom_field (entity 'contact')."),
|
|
194
194
|
custom_fields: z.record(z.any()).optional().describe("Alias for customFields (snake_case). Provide only one of customFields / custom_fields."),
|
|
@@ -220,7 +220,7 @@ export function registerContactTools(server, client) {
|
|
|
220
220
|
assignedTo: z.string().trim().min(1).max(100).nullable().optional().describe("Reassign the lead: the new owner's user ID; null unassigns. The previous owner is released (they lose the lead unless something else explains their access) unless keepPreviousOwnerAsCollaborator is true."),
|
|
221
221
|
keepPreviousOwnerAsCollaborator: z.boolean().optional().describe("With assignedTo set to another user: keep the previous owner as a collaborator of this contact (read-only access to the lead and its cards) instead of releasing them. Default false. Refused 400 without assignedTo in the same request."),
|
|
222
222
|
source: z.string().trim().min(1).max(100).nullable().optional().describe("Correct the lead's first-touch source (normally first-write-wins and set at creation — update only to FIX bad attribution). Pass null to clear."),
|
|
223
|
-
masterStatus: z.string().trim().min(1).max(40).optional().describe("Lifecycle status of the LEAD (master record), distinct from any deal's status: 'open' (default), 'won', 'lost', 'abandoned', 'disqualified', or an account-defined custom status. A terminal status (won/lost/abandoned/disqualified)
|
|
223
|
+
masterStatus: z.string().trim().min(1).max(40).optional().describe("Lifecycle status of the LEAD (master record), distinct from any deal's status: 'open' (default), 'won', 'lost', 'abandoned', 'disqualified', or an account-defined custom status. A terminal status (won/lost/abandoned/disqualified) stops this contact's drips, sequences and playbooks; (wonmail66) automations, scheduled automation sends included, still act for a contact in any lead status (a workflow that must leave closed leads alone adds a contact.masterStatus condition). Consent (opt-out, DNC, litigator, GDPR forget) still applies everywhere. Use conduyt_get_lifecycle_settings to see the account's configured statuses."),
|
|
224
224
|
customFields: z.record(z.any()).optional().describe("Structured custom-field values to merge, keyed by field key. Omit a key to leave it unchanged."),
|
|
225
225
|
custom_fields: z.record(z.any()).optional().describe("Alias for customFields (snake_case). Provide only one of customFields / custom_fields."),
|
|
226
226
|
addTags: z.array(z.string().min(1)).max(100).optional().describe("Tags to add: tag NAMES or tag ids, at most 100. An unknown name is 400 unknown_tag_name, an unknown id 422 unknown_tag_id, more than 100 in a list 400 too_many_tags, the same tag in addTags and removeTags 400 tag_add_remove_conflict. A tag the contact already has is reported, not an error (tagChanges.unchanged.alreadyTagged)."),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ConduytApiError, formatResult } from "../client.js";
|
|
3
|
-
import { USER_NOTE } from "./user-fields-doc.js";
|
|
3
|
+
import { NUMBER_DATE_TYPE_CHANGE_NOTE, USER_NOTE } from "./user-fields-doc.js";
|
|
4
4
|
import { OPTIONS_CAP_NOTE, OPTIONS_MAX, TYPE_CHANGE_NOTE } from "./lender-options.js";
|
|
5
5
|
import { REMOVE_NOTE, RESOLVE_NOTE, SEARCH_NOTE, SET_NOTE, STORE_LIST_NOTE, STORE_UPDATE_NOTE, optionRowSchema, setRowsProblem, storeCreateProblem, storeUpdateProblem, writeFlags, writeQuery } from "./store-options.js";
|
|
6
6
|
import { CUSTOM_FIELD_TYPES, DELANCEY_ID_NOTE, fail, formulaCreateProblem, formulaUpdateProblem, FORMULA_DEFINITION_NOTE, FORMULA_EXPRESSION_NOTE, SECURE_IDENTIFIER_NOTE } from "./formula-fields.js";
|
|
@@ -54,7 +54,7 @@ export function registerCustomFieldTools(server, client) {
|
|
|
54
54
|
const result = await client.post("/api/v1/custom-fields", { ...params, ...(store ?? {}) });
|
|
55
55
|
return formatResult(result);
|
|
56
56
|
});
|
|
57
|
-
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, or expression / format: an expression the parser refuses is 400 formula_expression_invalid with reason and position), Secure flag and required flag are re-judged with its inputs locked: 422 formula_invalid, 422 formula_secure_input; a text field an expression formula reads cannot become a user field (409 field_type_change_refused naming the formulas); 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 + " " + OPTIONS_CAP_NOTE + " " + TYPE_CHANGE_NOTE + " " + DELANCEY_ID_NOTE + " " + USER_NOTE + " " + STORE_UPDATE_NOTE, {
|
|
57
|
+
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, or expression / format: an expression the parser refuses is 400 formula_expression_invalid with reason and position), Secure flag and required flag are re-judged with its inputs locked: 422 formula_invalid, 422 formula_secure_input; a text field an expression formula reads cannot become a user field (409 field_type_change_refused naming the formulas); 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 + " " + OPTIONS_CAP_NOTE + " " + TYPE_CHANGE_NOTE + " " + DELANCEY_ID_NOTE + " " + USER_NOTE + " " + STORE_UPDATE_NOTE + NUMBER_DATE_TYPE_CHANGE_NOTE, {
|
|
58
58
|
id: z.string().describe("Custom field UUID"),
|
|
59
59
|
label: z.string().optional().describe("Updated label"),
|
|
60
60
|
section: z.string().max(120).nullable().optional().describe("Updated section grouping (null clears); the one place besides sortOrder a deal MIRROR can be edited"),
|
|
@@ -80,7 +80,7 @@ export function registerCustomFieldTools(server, client) {
|
|
|
80
80
|
const result = await client.patch(`/api/v1/custom-fields/${id}`, { ...rest, ...(store ?? {}) });
|
|
81
81
|
return formatResult(result);
|
|
82
82
|
});
|
|
83
|
-
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). A BDA-sized field can take longer than the server's impact budget to read: DELETE answers 503 custom_field_impact_timeout with Retry-After 5 (nothing was deleted: the transaction rolled back and no lock is held), a RETRYABLE answer: wait the Retry-After seconds and call this tool again (this tool does not replay a delete itself); if it keeps answering 503 after a few tries, stop and report the code. GET /api/v1/custom-fields/{id}/impact (the Settings delete preview) answers the same 503 (\"Impact preview timed out, the delete still works.\"). The same 503 also answers the delete's pre-check (the read that produces the 409 counts) and a dry run; nothing changes either way. The 409 with counts is unchanged." + " " + DELANCEY_ID_NOTE, {
|
|
83
|
+
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). A BDA-sized field can take longer than the server's impact budget to read: DELETE answers 503 custom_field_impact_timeout with Retry-After 5 (nothing was deleted: the transaction rolled back and no lock is held), a RETRYABLE answer: wait the Retry-After seconds and call this tool again (this tool does not replay a delete itself); if it keeps answering 503 after a few tries, stop and report the code. GET /api/v1/custom-fields/{id}/impact (the Settings delete preview) answers the same 503 (\"Impact preview timed out, the delete still works.\"). The same 503 also answers the delete's pre-check (the read that produces the 409 counts) and a dry run; nothing changes either way. The 409 with counts is unchanged." + " " + DELANCEY_ID_NOTE + NUMBER_DATE_TYPE_CHANGE_NOTE, {
|
|
84
84
|
id: z.string().describe("Custom field UUID"),
|
|
85
85
|
}, async ({ id }) => {
|
|
86
86
|
const result = await client.del(`/api/v1/custom-fields/${id}`);
|
|
@@ -3,6 +3,23 @@ import { z } from "zod";
|
|
|
3
3
|
/** the caps the API applies (conduyt-app lib/deal-filter-params.ts MAX_OWNER_FILTERS / MAX_TAG_FILTERS) */
|
|
4
4
|
export declare const MAX_OWNER_FILTERS = 25;
|
|
5
5
|
export declare const MAX_TAG_FILTERS = 25;
|
|
6
|
+
/** (dealattempt66, app lib/deal-attempt-filter.ts) the card's Last attempt filters GET /deals and GET /deals/export both read */
|
|
7
|
+
export declare const NO_ATTEMPT_DAYS_MAX = 3650;
|
|
8
|
+
/** the API's own sentence for the conflict (400 query_param_conflict); refused here before any request */
|
|
9
|
+
export declare const NO_ATTEMPT_DAYS_CONFLICT = "no_attempt_days cannot be combined with last_attempt_after or last_attempt_before.";
|
|
10
|
+
export declare const dealAttemptFilterShape: {
|
|
11
|
+
last_attempt_after: z.ZodOptional<z.ZodString>;
|
|
12
|
+
last_attempt_before: z.ZodOptional<z.ZodString>;
|
|
13
|
+
no_attempt_days: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
};
|
|
15
|
+
export declare const DEAL_ATTEMPT_DOC = " LAST ATTEMPT (dealattempt66): each deal carries lastAttemptAt (ISO or null, read-only): the newest outbound call, text or e-mail for THAT deal (the one it was made from via dealId on the send / call, else the contact's only open deal, else the sender's own open deals); kept about a minute after the attempt; null = no attempt since the field shipped (no history backfill). Filter with last_attempt_after / last_attempt_before or no_attempt_days.";
|
|
16
|
+
type AttemptFilters = {
|
|
17
|
+
last_attempt_after?: string;
|
|
18
|
+
last_attempt_before?: string;
|
|
19
|
+
no_attempt_days?: number;
|
|
20
|
+
};
|
|
21
|
+
/** appends the Last attempt filters (sent as given; the API judges the dates); the days filter with a bound is refused here */
|
|
22
|
+
export declare function appendDealAttemptFilters(qp: URLSearchParams, p: AttemptFilters): void;
|
|
6
23
|
/** the extra GET /deals/export filters (the board's), beside search / status / pipeline / contact_timezone which the tool already had */
|
|
7
24
|
export declare const dealExportFilterShape: {
|
|
8
25
|
assigned_to: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -14,8 +31,11 @@ export declare const dealExportFilterShape: {
|
|
|
14
31
|
needsAction: z.ZodOptional<z.ZodBoolean>;
|
|
15
32
|
stale: z.ZodOptional<z.ZodBoolean>;
|
|
16
33
|
health: z.ZodOptional<z.ZodString>;
|
|
34
|
+
last_attempt_after: z.ZodOptional<z.ZodString>;
|
|
35
|
+
last_attempt_before: z.ZodOptional<z.ZodString>;
|
|
36
|
+
no_attempt_days: z.ZodOptional<z.ZodNumber>;
|
|
17
37
|
};
|
|
18
|
-
type ExportFilters = {
|
|
38
|
+
type ExportFilters = AttemptFilters & {
|
|
19
39
|
assigned_to?: string | string[];
|
|
20
40
|
tag_ids?: string | string[];
|
|
21
41
|
created_after?: string;
|
package/dist/tools/deal-views.js
CHANGED
|
@@ -4,8 +4,30 @@ import { z } from "zod";
|
|
|
4
4
|
export const MAX_OWNER_FILTERS = 25;
|
|
5
5
|
export const MAX_TAG_FILTERS = 25;
|
|
6
6
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
7
|
+
/** (dealattempt66, app lib/deal-attempt-filter.ts) the card's Last attempt filters GET /deals and GET /deals/export both read */
|
|
8
|
+
export const NO_ATTEMPT_DAYS_MAX = 3650;
|
|
9
|
+
/** the API's own sentence for the conflict (400 query_param_conflict); refused here before any request */
|
|
10
|
+
export const NO_ATTEMPT_DAYS_CONFLICT = "no_attempt_days cannot be combined with last_attempt_after or last_attempt_before.";
|
|
11
|
+
export const dealAttemptFilterShape = {
|
|
12
|
+
last_attempt_after: z.string().optional().describe("(dealattempt66) Deals whose Last attempt (lastAttemptAt) is on or after this day: YYYY-MM-DD (from the start of that day in the account's time zone) or a full ISO 8601 datetime with offset; an invalid date is 400 invalid_last_attempt_range. Not with no_attempt_days"),
|
|
13
|
+
last_attempt_before: z.string().optional().describe("(dealattempt66) Deals whose Last attempt is on or before this day: YYYY-MM-DD (through the end of that day in the account's time zone) or a full ISO 8601 datetime with offset; same rules as last_attempt_after"),
|
|
14
|
+
no_attempt_days: z.number().int().min(1).max(NO_ATTEMPT_DAYS_MAX).optional().describe(`(dealattempt66) Deals with no attempt in the last N days (1 to ${NO_ATTEMPT_DAYS_MAX}), a deal never attempted included. Not with last_attempt_after / last_attempt_before (refused before any request; the API answers 400 query_param_conflict)`),
|
|
15
|
+
};
|
|
16
|
+
export const DEAL_ATTEMPT_DOC = " LAST ATTEMPT (dealattempt66): each deal carries lastAttemptAt (ISO or null, read-only): the newest outbound call, text or e-mail for THAT deal (the one it was made from via dealId on the send / call, else the contact's only open deal, else the sender's own open deals); kept about a minute after the attempt; null = no attempt since the field shipped (no history backfill). Filter with last_attempt_after / last_attempt_before or no_attempt_days.";
|
|
17
|
+
/** appends the Last attempt filters (sent as given; the API judges the dates); the days filter with a bound is refused here */
|
|
18
|
+
export function appendDealAttemptFilters(qp, p) {
|
|
19
|
+
if (p.no_attempt_days !== undefined && (p.last_attempt_after !== undefined || p.last_attempt_before !== undefined))
|
|
20
|
+
throw new Error(NO_ATTEMPT_DAYS_CONFLICT);
|
|
21
|
+
if (p.last_attempt_after !== undefined)
|
|
22
|
+
qp.set("last_attempt_after", p.last_attempt_after);
|
|
23
|
+
if (p.last_attempt_before !== undefined)
|
|
24
|
+
qp.set("last_attempt_before", p.last_attempt_before);
|
|
25
|
+
if (p.no_attempt_days !== undefined)
|
|
26
|
+
qp.set("no_attempt_days", String(p.no_attempt_days));
|
|
27
|
+
}
|
|
7
28
|
/** the extra GET /deals/export filters (the board's), beside search / status / pipeline / contact_timezone which the tool already had */
|
|
8
29
|
export const dealExportFilterShape = {
|
|
30
|
+
...dealAttemptFilterShape,
|
|
9
31
|
assigned_to: z.union([z.string(), z.array(z.string())]).optional().describe("Only deals owned by these users: a user UUID or `unassigned`, one string or an array (each value is sent as its own repeated assigned_to parameter; a comma list inside a value is read too). ANY of them. At most 25 distinct owners (refused before any request)"),
|
|
10
32
|
tag_ids: z.union([z.string(), z.array(z.string())]).optional().describe("Only deals with one of these tags: tag UUIDs, one string or an array (each value sent as its own repeated tag_ids parameter), ANY match. At most 25 entries (refused before any request)"),
|
|
11
33
|
created_after: z.string().optional().describe("Created on or after this date: YYYY-MM-DD (the account time zone) or a full ISO datetime with offset"),
|
|
@@ -50,6 +72,7 @@ export function appendDealExportFilters(qp, p) {
|
|
|
50
72
|
qp.set("stale", "true");
|
|
51
73
|
if (p.health)
|
|
52
74
|
qp.set("health", p.health);
|
|
75
|
+
appendDealAttemptFilters(qp, p);
|
|
53
76
|
}
|
|
54
77
|
export const DEAL_VIEW_RULES_DOC = "A view's `filters` is a flat ARRAY of rules { field, operator, value } that are ANDed; value is always a STRING (a comma-separated list for operator in; every rule carries a value: send \"\" for is_empty / is_not_empty). Fields and operators: title, status, priority, currency, lostReason (equals, not_equals, contains, not_contains, starts_with, in, is_empty, is_not_empty); value (equals, not_equals, gt, gte, lt, lte, is_empty, is_not_empty; a plain number); pipelineId, stageId, assignedTo, contactId, companyId (UUIDs; equals, not_equals, in, is_empty, is_not_empty); createdAt, updatedAt, expectedCloseDate, wonAt, lostAt (within / not_within with a duration like 7d, 24h or 30m; before / after with an ISO calendar date; is_empty, is_not_empty); contactTimezone (the linked contact's time zone; equals, in; each value a group word eastern, central, mountain, pacific, alaska, hawaii, unknown, or an IANA id, the same values as conduyt_list_deals contact_timezone, at most 25 distinct). The API validates every rule and answers 400 with the reason (a custom-field mirror key is 422 mirror_not_filterable).";
|
|
55
78
|
export const DEAL_VIEW_AUDIENCE_DOC = "AUDIENCE: an admin or owner creates a SHARED view and must pass members ([{ userId }] for the picked reps, or [] for everyone), else 400 audience_required; any other user creates a PERSONAL view, which has no audience (members on a personal view update is 400 personal_no_audience). Only an admin edits or deletes a shared view; a personal view is its owner's; a system view's name, filters, icon and sort cannot be changed and it cannot be deleted (403).";
|
|
@@ -8,12 +8,14 @@ const UUID = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-
|
|
|
8
8
|
const VIEW_ID_RE = new RegExp(`^(?:${DEALS_PAGE_VIEW_BUILTIN_IDS.join("|")}|${UUID})$`);
|
|
9
9
|
const DATE_RE = /^(?:\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01]))?$/;
|
|
10
10
|
const AMOUNT_RE = /^(?:\d{1,10}(?:\.\d{1,2})?)?$/;
|
|
11
|
+
/** (dealattempt66) "" or 1..3650 with no leading zero (the app's NO_ATTEMPT_DAYS_RE, lib/deal-views.ts) */
|
|
12
|
+
const NO_ATTEMPT_DAYS_RE = /^(?:|[1-9]\d{0,2}|[1-2]\d{3}|3[0-5]\d{2}|36[0-4]\d|3650)$/;
|
|
11
13
|
/** the API's rules for one view (lib/validators/deal-views.ts at the app's dealviewsaved53 branch), mirrored so a bad body is refused before any request */
|
|
12
14
|
const viewId = (what) => z.string().regex(VIEW_ID_RE, "a built-in id (all | open | mine | won | lost) or a view UUID").describe(what);
|
|
13
15
|
const nameSchema = z.string().min(1).max(60).regex(/\S/, "not blank").describe("View name, 1-60 characters, not blank; one name per person (any case), built-in names taken");
|
|
14
16
|
const statusSchema = z.enum(["all", "open", "won", "lost"]).describe("Which deals: all | open | won | lost");
|
|
15
17
|
const sortSchema = z.object({
|
|
16
|
-
field: z.enum(["name", "value", "closeDate", "created"]).describe("name | value | closeDate | created (a view with no sort opens on created, newest first)"),
|
|
18
|
+
field: z.enum(["name", "value", "closeDate", "created", "lastAttempt"]).describe("name | value | closeDate | created | lastAttempt (the card's Last attempt, dealattempt66; a view with no sort opens on created, newest first)"),
|
|
17
19
|
dir: z.enum(["asc", "desc"]).describe("asc | desc"),
|
|
18
20
|
}).strict();
|
|
19
21
|
/** (dealviewsaved53 r6, Codex r5 P3) the API's own filter rules (the app's lib/deal-views parseDealViewFilters), refused before any
|
|
@@ -35,13 +37,22 @@ const filtersSchema = z.object({
|
|
|
35
37
|
contactTimezones: noRepeats(z.array(z.enum(["eastern", "central", "mountain", "pacific", "alaska", "hawaii", "unknown"])).max(7)).optional().describe("The linked contact's time zone group: eastern | central | mountain | pacific | alaska | hawaii | unknown"),
|
|
36
38
|
valueMin: z.string().regex(AMOUNT_RE, "an amount string, at most two decimals, or \"\"").optional().describe("Deal value at least, an amount STRING like \"5000\" or \"99.50\"; \"\" = no bound"),
|
|
37
39
|
valueMax: z.string().regex(AMOUNT_RE, "an amount string, at most two decimals, or \"\"").optional().describe("Deal value at most, same form as valueMin (the API refuses min above max)"),
|
|
40
|
+
// (dealattempt66, app lib/deal-views.ts) the card's Last attempt: a day range, or none in the last N days; "" = no filter
|
|
41
|
+
attemptFrom: z.string().regex(DATE_RE, "YYYY-MM-DD or \"\"").refine(realDateOrBlank, "attemptFrom: a date (YYYY-MM-DD).").optional().describe("Last attempt on or after, YYYY-MM-DD; \"\" = no bound"),
|
|
42
|
+
attemptTo: z.string().regex(DATE_RE, "YYYY-MM-DD or \"\"").refine(realDateOrBlank, "attemptTo: a date (YYYY-MM-DD).").optional().describe("Last attempt on or before, YYYY-MM-DD; \"\" = no bound (the API refuses from after to)"),
|
|
43
|
+
noAttemptDays: z.string().regex(NO_ATTEMPT_DAYS_RE, "noAttemptDays: a whole number of days from 1 to 3650.").optional().describe("No attempt in the last N days, a whole number STRING \"1\"..\"3650\" (no leading zero), a deal never attempted included; \"\" = no filter; not with attemptFrom / attemptTo"),
|
|
38
44
|
}).strict().superRefine((f, ctx) => {
|
|
39
45
|
// (r6, Codex r5 P3) the API's cross-field rules (parseDealViewFilters): a range is never reversed
|
|
40
46
|
if (f.createdFrom && f.createdTo && f.createdFrom > f.createdTo)
|
|
41
47
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "createdFrom is after createdTo", path: ["createdFrom"] });
|
|
42
48
|
if (f.valueMin && f.valueMax && Number(f.valueMin) > Number(f.valueMax))
|
|
43
49
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "valueMin is above valueMax", path: ["valueMin"] });
|
|
44
|
-
|
|
50
|
+
// (dealattempt66) the API's two Last attempt rules (parseDealViewFilters)
|
|
51
|
+
if (f.attemptFrom && f.attemptTo && f.attemptFrom > f.attemptTo)
|
|
52
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "attemptFrom is after attemptTo.", path: ["attemptFrom"] });
|
|
53
|
+
if (f.noAttemptDays && (f.attemptFrom || f.attemptTo))
|
|
54
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "noAttemptDays cannot be combined with attemptFrom or attemptTo.", path: ["noAttemptDays"] });
|
|
55
|
+
}).describe("The Deals page's filters (no other key): ownerIds, createdFrom, createdTo, tagIds, contactTimezones, valueMin, valueMax, attemptFrom, attemptTo, noAttemptDays; every key optional");
|
|
45
56
|
const VIEW_DOC = "A view is { id, name, builtin, status (all | open | won | lost), filters, listSort ({ field, dir } or null), savedListSort, shared, mine, canEdit, owner ({ id, name } or null), revision (16 hex characters, on every view but a built-in: the revision of what the view saves; pass it back as expectedRevision on an update), count? }. These are the Deals page's views, per person per workspace (needs deals.view); they are NOT the board's saved view tabs of conduyt_list_deal_views (GET /deals/views).";
|
|
46
57
|
export function registerDealsPageViewTools(server, client) {
|
|
47
58
|
strictInput(server.tool("conduyt_list_deals_page_views", "List the Deals page's saved views you see (GET /api/v1/deal-views): { views, defaultViewId, canShare }. The five built-ins come first in this order: all \"All deals\", open \"Open deals\", mine \"My deals\" (your own OPEN deals), won \"Won\", lost \"Lost and disqualified\"; then your own views and the views shared in the workspace. defaultViewId = the view the page opens on (your starred one, else all); canShare = whether you may share views (the Manager permission deals.view_all). With pipeline every view also carries count: its deals on that pipeline as GET /deals counts them for you (null when a count could not be read). Read-only. 400 invalid_pipeline (not a UUID), unknown_query_param, query_param_conflict. " + VIEW_DOC, { pipeline: z.string().uuid().optional().describe("Pipeline UUID: adds each view's count of deals on that pipeline") }, async ({ pipeline }) => {
|
package/dist/tools/deals.js
CHANGED
|
@@ -7,7 +7,7 @@ import { FORMULA_WRITE_NOTE } from "./formula-fields.js";
|
|
|
7
7
|
import { strictInput } from "./strict.js";
|
|
8
8
|
import { KEEP_PREVIOUS_OWNER_NEEDS_ASSIGNEE } from "./contacts.js";
|
|
9
9
|
import { CONTACT_TIMEZONE_NOTE, appendContactTimezone, contactTimezoneSchema } from "./contact-timezone.js";
|
|
10
|
-
import { DEAL_VIEW_AUDIENCE_DOC, DEAL_VIEW_RULES_DOC, dealViewFields } from "./deal-views.js";
|
|
10
|
+
import { DEAL_ATTEMPT_DOC, DEAL_VIEW_AUDIENCE_DOC, DEAL_VIEW_RULES_DOC, appendDealAttemptFilters, dealAttemptFilterShape, dealViewFields } from "./deal-views.js";
|
|
11
11
|
// (mirror1292, batch31 #1292 Ship 3) deal MIRROR fields: a write-through view of a contact / company field, named on the deal tools
|
|
12
12
|
/** (parity64, app dealupdate63, live OpenAPI POST /imports importMode and ImportJobRead.unchangedRows) updating existing deals from the deal import */
|
|
13
13
|
export const DEAL_IMPORT_UPDATE_DOC = " UPDATING deals (app dealupdate63): importMode create_and_update (the default when omitted) updates the deal a row's dealId names and creates the rows without one; update_only updates by dealId and never creates (a row without a dealId is not applied); create_only creates every row (a dealId is not read: the create behaviour above). The ONLY matching key is the Deal ID, the deal's UUID (from conduyt_list_deals, or the last column, Deal ID, of conduyt_export_deals); nothing else (title, contact) ever matches a deal. An update writes only the non-blank cells that differ from the deal (a blank cell keeps the stored value; there is no clear), through the same write as PATCH /deals/{id} (its validation, permission, row-level edit rule and side effects: deal.updated webhooks and automations, activities, mirrors, audit), so, unlike the create path, an update DOES fire them. It never changes the stage, pipeline or status (a differing cell is noted on the row, code stage_status_not_changed). A dealId that is malformed, unknown, of another account, deleted, or of a deal the importer may not edit: the row is not applied, with one note (the same text for each). A field value that cannot be applied is noted (code deal_field_not_applied) and the row's other fields still apply. A matched row with nothing to change is unchanged (no write, no event). A non-blank cell of a Secure custom field is always written, never compared, so the outcome never tells whether it matched the stored value. A mirrored field the linked record refuses is not applied (deal_field_not_applied) and the row's other fields still apply. The answer counts updatedRows and unchangedRows beside the created / skipped / duplicate counts (unchangedRows are also counted in skippedRows: skippedRows = failedRows + duplicateRows + unchangedRows on a deal import); stage_status_not_changed and deal_field_not_applied come back in errorLog like the other row notes. title and pipelineName are required only on a create row.";
|
|
@@ -63,7 +63,7 @@ function boardSnapshotColumns(a, f) {
|
|
|
63
63
|
return a.board_columns.map((c) => (c.limit === undefined ? c.stageId : `${c.stageId}:${c.limit}`)).join(",");
|
|
64
64
|
}
|
|
65
65
|
export function registerDealTools(server, client) {
|
|
66
|
-
strictInput(server.tool("conduyt_list_deals", "List deals with filtering by pipeline, stage, assignee, or status. Returns deal title, value, stage, contact, and dates. Paged: meta.has_more says whether another page exists; page by has_more, never by meta.total (the total can be left out). 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, include_parked, search, contact_timezone, view_id, page, per_page, sort, order, list_order, 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, {
|
|
66
|
+
strictInput(server.tool("conduyt_list_deals", "List deals with filtering by pipeline, stage, assignee, or status. Returns deal title, value, stage, contact, and dates. Paged: meta.has_more says whether another page exists; page by has_more, never by meta.total (the total can be left out). 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, include_parked, search, contact_timezone, view_id, page, per_page, sort, order, list_order, board_snapshot, board_columns, health_summary, health_check, health_limit, health_offset, health_cursor, health_rows_only, last_attempt_after, last_attempt_before, no_attempt_days), 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 + DEAL_ATTEMPT_DOC + LIST_USERS_DOC, {
|
|
67
67
|
pipeline: z.string().optional().describe("Filter by pipeline UUID (canonical). Aliases: pipelineId, pipeline_id."),
|
|
68
68
|
pipelineId: z.string().optional().describe("Filter by pipeline UUID (alias of pipeline)."),
|
|
69
69
|
pipeline_id: z.string().optional().describe("snake_case alias of pipelineId."),
|
|
@@ -83,7 +83,8 @@ export function registerDealTools(server, client) {
|
|
|
83
83
|
view_id: z.string().optional().describe("Apply this SAVED DEAL VIEW (a UUID from conduyt_list_deal_views; sent as view_id, the canonical name in the OpenAPI, which also documents the alias viewId): the list is the set the view defines, ANDed with every other filter given here (the API combines them; nothing is resolved by this tool). 404 when the view does not exist, is disabled or is not visible to you; 422 when its stored rules are invalid or unsupported; 400 for a blank or non-UUID id (forwarded as given). Works with health_summary and board_snapshot too."),
|
|
84
84
|
page: z.number().optional().describe("Page number (default 1)"),
|
|
85
85
|
per_page: z.number().int().min(1).max(BOARD_SNAPSHOT_MAX_COLUMN_ROWS).optional().describe("Results per page, an integer 1-1000 (server default 50, max 1000; with board_snapshot it is the default rows per column)"),
|
|
86
|
-
|
|
86
|
+
...dealAttemptFilterShape,
|
|
87
|
+
sort: z.enum(["createdAt", "updatedAt", "title", "value", "expectedCloseDate", "lastAttemptAt"]).optional().describe("Sort field (server default createdAt). lastAttemptAt = the card's Last attempt (dealattempt66; a deal never attempted sorts last both ways). A missing value / expectedCloseDate sorts last both ways under list_order. Without list_order the board's order (stage, card position) comes first and sort only breaks ties."),
|
|
87
88
|
order: z.enum(["asc", "desc"]).optional().describe("Sort direction (server default desc)."),
|
|
88
89
|
list_order: z.boolean().optional().describe("true: sort is the PRIMARY order of the whole filtered set (the Deals page's list: page 2 continues the same order across every stage), then id. Refused before any request with health_summary or board_snapshot (sort and order are refused with health_summary too; with board_snapshot they break ties in the board order and are sent)."),
|
|
89
90
|
health_summary: z.boolean().optional().describe("true: answer the Pipeline health shape (totalOpenDeals, atRiskValue, checks[], deals) for the filtered set instead of the deal list."),
|
|
@@ -152,6 +153,7 @@ export function registerDealTools(server, client) {
|
|
|
152
153
|
appendContactTimezone(params, a.contact_timezone);
|
|
153
154
|
if (a.view_id !== undefined)
|
|
154
155
|
params.set("view_id", a.view_id);
|
|
156
|
+
appendDealAttemptFilters(params, a);
|
|
155
157
|
if (page)
|
|
156
158
|
params.set("page", String(page));
|
|
157
159
|
if (per_page)
|