conduyt-mcp 4.105.36 → 4.105.38
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 +1 -0
- package/dist/register-all.js +2 -0
- package/dist/tool-annotations.js +7 -0
- package/dist/tools/automations.d.ts +2 -0
- package/dist/tools/automations.js +14 -0
- package/dist/tools/deals-page-views.d.ts +9 -0
- package/dist/tools/deals-page-views.js +92 -0
- package/dist/tools/deals.js +18 -1
- package/package.json +1 -1
- package/scripts/coverage-matrix.json +46 -4
package/README.md
CHANGED
|
@@ -48,6 +48,7 @@ MCP server for [Conduyt CRM](https://conduyt.app) — expose your CRM as AI-acce
|
|
|
48
48
|
| `conduyt_create_deal` | Create a deal with full attributes — currency (e.g. GBP), probability, priority, expected close date, contact/company, and structured custom-field values |
|
|
49
49
|
| `conduyt_update_deal` | Move stage, change value/currency, set probability or close date, reassign (`keepPreviousOwnerAsCollaborator: true` keeps the previous owner as a read-only collaborator of the contact; 400 without `assignedTo` or with a contact change), mark won/lost, or write custom-field values; optional `expectedUpdatedAt` pins the `updatedAt` you read, and a stale pin returns 409 `deal_changed` with the current `updatedAt` and writes nothing |
|
|
50
50
|
| `conduyt_import_deals` | Bulk-import deals (pipeline/stage by name, contact by email) via the canonical import engine — dedupes, side-effect-free, owner/admin only |
|
|
51
|
+
| `conduyt_list_deals_page_views` / `conduyt_create_deals_page_view` / `conduyt_update_deals_page_view` / `conduyt_delete_deals_page_view` / `conduyt_duplicate_deals_page_view` / `conduyt_set_deals_page_view_prefs` | The Deals page's saved views, per person per workspace (`/deal-views`, deals.view): the five built-ins (all, open, mine, won, lost) then your own and the shared views, with `?pipeline=` counts; save, change, delete (owner only), duplicate any readable view as your own, and set your default view / per-view list sort (`PUT /deal-views/prefs`). Not the board's saved view tabs (`conduyt_*_deal_view`, `/deals/views`) |
|
|
51
52
|
|
|
52
53
|
### Tasks
|
|
53
54
|
| Tool | Description |
|
package/dist/register-all.js
CHANGED
|
@@ -3,6 +3,7 @@ import { registerDiscoveryTools } from "./tools/discovery.js";
|
|
|
3
3
|
import { registerContactTools } from "./tools/contacts.js";
|
|
4
4
|
import { registerDealTools } from "./tools/deals.js";
|
|
5
5
|
import { registerDealProfileTools } from "./tools/deal-profile.js";
|
|
6
|
+
import { registerDealsPageViewTools } from "./tools/deals-page-views.js";
|
|
6
7
|
import { registerEmailSignatureTools } from "./tools/email-signature.js";
|
|
7
8
|
import { registerTaskTools } from "./tools/tasks.js";
|
|
8
9
|
import { registerPipelineTools } from "./tools/pipelines.js";
|
|
@@ -71,6 +72,7 @@ export function registerAllTools(server, client) {
|
|
|
71
72
|
registerContactTools(server, client);
|
|
72
73
|
registerDealTools(server, client);
|
|
73
74
|
registerDealProfileTools(server, client);
|
|
75
|
+
registerDealsPageViewTools(server, client);
|
|
74
76
|
registerEmailSignatureTools(server, client);
|
|
75
77
|
registerTaskTools(server, client);
|
|
76
78
|
registerPipelineTools(server, client);
|
package/dist/tool-annotations.js
CHANGED
|
@@ -48,6 +48,13 @@ export const TOOL_ANNOTATIONS = {
|
|
|
48
48
|
conduyt_create_deal_view: create("Create Deal View"),
|
|
49
49
|
conduyt_update_deal_view: update("Update Deal View"),
|
|
50
50
|
conduyt_delete_deal_view: destroy("Delete Deal View"),
|
|
51
|
+
// (dealviewsaved53) the Deals page's own saved views (GET|POST /deal-views, PATCH|DELETE /deal-views/{id}, duplicate, prefs)
|
|
52
|
+
conduyt_list_deals_page_views: ro("List Deals Page Views"),
|
|
53
|
+
conduyt_create_deals_page_view: create("Create Deals Page View"),
|
|
54
|
+
conduyt_update_deals_page_view: update("Update Deals Page View"),
|
|
55
|
+
conduyt_delete_deals_page_view: destroy("Delete Deals Page View"),
|
|
56
|
+
conduyt_duplicate_deals_page_view: create("Duplicate Deals Page View"),
|
|
57
|
+
conduyt_set_deals_page_view_prefs: update("Set Deals Page View Preferences"),
|
|
51
58
|
conduyt_list_tasks: ro("List Tasks"),
|
|
52
59
|
conduyt_create_task: create("Create Task"),
|
|
53
60
|
conduyt_get_task: ro("Get Task"),
|
|
@@ -6,6 +6,8 @@ export declare const CARD_OWNERSHIP_ACTIONS_NOTE = " Card ownership per lane: as
|
|
|
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
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
|
+
/** (idleoff57) the conditional switch-off, documented for an agent; (idleroute58) sent to POST /automations/:id/deactivate-if-idle */
|
|
10
|
+
export declare const IF_IDLE_DOC = "Conditional switch-off: send ONLY isActive false with ifIdle true (it is sent to POST /api/v1/automations/:id/deactivate-if-idle, never as a PATCH: an app build without the feature answers 404 there and changes nothing, so an older server can never turn it into an unconditional switch-off; the result's data.isActive is false either way, and an automation that was already off answers the same success). The automation is switched off only if none of its work is in flight (a run that has not finished, a parked step such as a delay / wait / retry, a queued chase, a queued tag or consent hand-off, a contact held at a drip step, a due schedule slot, an event wake, an n8n delivery being retried), decided in one transaction that also keeps any new run from starting until the switch-off commits. Nothing in flight: the same result as isActive false alone. 409: in-flight work, or a concurrent change; retry. Either way the API changes NOTHING. With code automation_has_inflight_work it is in-flight work: its inFlight object counts each class, earliestResumeAt is the earliest due time; wait and call again. A 409 without that code is a concurrent change (another change to the automation committed at the same moment): read it again and call again. 503 code automation_lock_timeout (Retry-After seconds): the automation was busy, nothing changed, call again. Without ifIdle, isActive false switches off unconditionally (a parked run is then dropped at its next step).";
|
|
9
11
|
/** GET /automations/:id answers { data: { ...automation, configRevision } } (jsonResponse wraps): the revision lives under `data` */
|
|
10
12
|
export declare function configRevisionOf(raw: unknown): number | undefined;
|
|
11
13
|
export declare function registerAutomationTools(server: McpServer, client: ConduytClient): void;
|
|
@@ -7,6 +7,8 @@ export const CARD_OWNERSHIP_ACTIONS_NOTE = " Card ownership per lane: assign_to_
|
|
|
7
7
|
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).";
|
|
8
8
|
/** (#124, automation unknown keys / types) the refusal codes the write paths answer; surfaced verbatim by the client (details JSON object last), never retried */
|
|
9
9
|
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).";
|
|
10
|
+
/** (idleoff57) the conditional switch-off, documented for an agent; (idleroute58) sent to POST /automations/:id/deactivate-if-idle */
|
|
11
|
+
export const IF_IDLE_DOC = "Conditional switch-off: send ONLY isActive false with ifIdle true (it is sent to POST /api/v1/automations/:id/deactivate-if-idle, never as a PATCH: an app build without the feature answers 404 there and changes nothing, so an older server can never turn it into an unconditional switch-off; the result's data.isActive is false either way, and an automation that was already off answers the same success). The automation is switched off only if none of its work is in flight (a run that has not finished, a parked step such as a delay / wait / retry, a queued chase, a queued tag or consent hand-off, a contact held at a drip step, a due schedule slot, an event wake, an n8n delivery being retried), decided in one transaction that also keeps any new run from starting until the switch-off commits. Nothing in flight: the same result as isActive false alone. 409: in-flight work, or a concurrent change; retry. Either way the API changes NOTHING. With code automation_has_inflight_work it is in-flight work: its inFlight object counts each class, earliestResumeAt is the earliest due time; wait and call again. A 409 without that code is a concurrent change (another change to the automation committed at the same moment): read it again and call again. 503 code automation_lock_timeout (Retry-After seconds): the automation was busy, nothing changed, call again. Without ifIdle, isActive false switches off unconditionally (a parked run is then dropped at its next step).";
|
|
10
12
|
/** GET /automations/:id answers { data: { ...automation, configRevision } } (jsonResponse wraps): the revision lives under `data` */
|
|
11
13
|
export function configRevisionOf(raw) {
|
|
12
14
|
const row = raw && typeof raw === "object" && "data" in raw ? raw.data : raw;
|
|
@@ -61,6 +63,7 @@ export function registerAutomationTools(server, client) {
|
|
|
61
63
|
.optional()
|
|
62
64
|
.describe("Updated trigger conditions (replaces the object). Same keys as create — e.g. { untouchedDays: 7 } on 'contact.untouched'. (#16 tri-surface parity: the UI and API could set this; MCP could not.)"),
|
|
63
65
|
isActive: z.boolean().optional().describe("Enable or disable the automation"),
|
|
66
|
+
ifIdle: z.literal(true).optional().describe(IF_IDLE_DOC),
|
|
64
67
|
expectedConfigRevision: z.number().int().nonnegative().optional().describe("REQUIRED whenever `actions` is replaced: the configRevision of the automation you read (conduyt_get_automation) before preparing the new graph. It is sent unchanged; if the automation was saved since, the API answers 409 with the current revision and nothing is overwritten, so re-read, re-apply your change and call again. Not needed for an update that leaves `actions` alone"),
|
|
65
68
|
actions: z.any().optional().describe("Updated actions graph (same shape as create; e.g. enroll_in_sequence {sequenceId, enrollAction: 'add' | 'remove'}) A delay node waits for a fixed duration by default; waitType 'until_field_date' (with fieldKey = a deal DATE / DATETIME custom field key and offsetHours = signed hours added to its date, default 0, e.g. 24 = a day after it) waits until that date stored on the deal, re-read at every wake (an empty or past value continues immediately)." + CARD_OWNERSHIP_ACTIONS_NOTE + DEAL_NODES_ACTIONS_NOTE + ""),
|
|
66
69
|
schedule: z.string().optional().describe("Updated cron schedule"),
|
|
@@ -76,6 +79,17 @@ export function registerAutomationTools(server, client) {
|
|
|
76
79
|
if (updates.actions !== undefined && updates.expectedConfigRevision === undefined) {
|
|
77
80
|
return formatToolError("Replacing `actions` needs expectedConfigRevision: read the automation first (conduyt_get_automation) and pass its configRevision. Nothing was sent.");
|
|
78
81
|
}
|
|
82
|
+
// (idleoff57) the conditional switch-off is exactly { isActive: false, ifIdle: true }: any other field beside it is refused by the
|
|
83
|
+
// API (400 invalid_if_idle); said here first, before anything is sent
|
|
84
|
+
if (updates.ifIdle !== undefined) {
|
|
85
|
+
const others = Object.keys(updates).filter((k) => k !== "ifIdle" && updates[k] !== undefined);
|
|
86
|
+
if (updates.isActive !== false || others.length !== 1) {
|
|
87
|
+
return formatToolError("ifIdle is the conditional switch-off: send only isActive false and ifIdle true (no other field). Nothing was sent.");
|
|
88
|
+
}
|
|
89
|
+
// (idleroute58) the conditional switch-off goes to its OWN endpoint, never the PATCH: an app build without the feature ignores
|
|
90
|
+
// ifIdle in a PATCH and switches off unconditionally, while it does not have this path at all (404 / 405, nothing changed)
|
|
91
|
+
return formatResult(await client.post(`/api/v1/automations/${id}/deactivate-if-idle`, {}));
|
|
92
|
+
}
|
|
79
93
|
const result = await client.patch(`/api/v1/automations/${id}`, updates);
|
|
80
94
|
return formatResult(result);
|
|
81
95
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (dealviewsaved53) the Deals page's saved views, per person per workspace (GET|POST /deal-views, PATCH|DELETE /deal-views/{id},
|
|
3
|
+
* POST /deal-views/{id}/duplicate, PUT /deal-views/prefs). Not the board's saved view tabs of GET|POST /deals/views (deal-views.ts,
|
|
4
|
+
* conduyt_*_deal_view): a different family with its own ids, filters and access rules, hence the `deals_page_view` names.
|
|
5
|
+
*/
|
|
6
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
|
+
import { ConduytClient } from "../client.js";
|
|
8
|
+
export declare const DEALS_PAGE_VIEW_BUILTIN_IDS: readonly ["all", "open", "mine", "won", "lost"];
|
|
9
|
+
export declare function registerDealsPageViewTools(server: McpServer, client: ConduytClient): void;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { formatResult } from "../client.js";
|
|
3
|
+
import { strictInput } from "./strict.js";
|
|
4
|
+
export const DEALS_PAGE_VIEW_BUILTIN_IDS = ["all", "open", "mine", "won", "lost"];
|
|
5
|
+
// (dealviewsaved53 r4, Codex r3 P3) as the API judges them: the built-in ids and "unassigned" EXACTLY (lowercase); only a UUID's
|
|
6
|
+
// hex digits may be either case
|
|
7
|
+
const UUID = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}";
|
|
8
|
+
const VIEW_ID_RE = new RegExp(`^(?:${DEALS_PAGE_VIEW_BUILTIN_IDS.join("|")}|${UUID})$`);
|
|
9
|
+
const DATE_RE = /^(?:\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01]))?$/;
|
|
10
|
+
const AMOUNT_RE = /^(?:\d{1,10}(?:\.\d{1,2})?)?$/;
|
|
11
|
+
/** 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
|
+
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
|
+
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
|
+
const statusSchema = z.enum(["all", "open", "won", "lost"]).describe("Which deals: all | open | won | lost");
|
|
15
|
+
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)"),
|
|
17
|
+
dir: z.enum(["asc", "desc"]).describe("asc | desc"),
|
|
18
|
+
}).strict();
|
|
19
|
+
/** (dealviewsaved53 r6, Codex r5 P3) the API's own filter rules (the app's lib/deal-views parseDealViewFilters), refused before any
|
|
20
|
+
* request: no repeated owner / tag / time zone, real calendar dates, no reversed date or value range. The case table
|
|
21
|
+
* src/tools/fixtures/deal-view-filter-cases.json is the app's, pinned by the same hash on both sides, so the two cannot drift. */
|
|
22
|
+
const noRepeats = (a) => a.refine((xs) => new Set(xs).size === xs.length, "no repeats");
|
|
23
|
+
const realDateOrBlank = (v) => {
|
|
24
|
+
if (v === "")
|
|
25
|
+
return true;
|
|
26
|
+
const [y, m, d] = v.split("-").map(Number);
|
|
27
|
+
const dt = new Date(Date.UTC(y, m - 1, d));
|
|
28
|
+
return dt.getUTCFullYear() === y && dt.getUTCMonth() === m - 1 && dt.getUTCDate() === d;
|
|
29
|
+
};
|
|
30
|
+
const filtersSchema = z.object({
|
|
31
|
+
ownerIds: noRepeats(z.array(z.string().regex(new RegExp(`^(?:${UUID}|unassigned)$`), "a user UUID or unassigned (lowercase)")).max(25)).optional().describe("Owners: user UUIDs or `unassigned`, ANY of them, at most 25"),
|
|
32
|
+
createdFrom: z.string().regex(DATE_RE, "YYYY-MM-DD or \"\"").refine(realDateOrBlank, "a real calendar date").optional().describe("Created on or after, YYYY-MM-DD; \"\" = no bound"),
|
|
33
|
+
createdTo: z.string().regex(DATE_RE, "YYYY-MM-DD or \"\"").refine(realDateOrBlank, "a real calendar date").optional().describe("Created on or before, YYYY-MM-DD; \"\" = no bound (the API refuses from after to)"),
|
|
34
|
+
tagIds: noRepeats(z.array(z.string().regex(new RegExp(`^${UUID}$`), "a tag UUID")).max(25)).optional().describe("Tags: tag UUIDs, ANY of them, at most 25"),
|
|
35
|
+
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
|
+
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
|
+
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)"),
|
|
38
|
+
}).strict().superRefine((f, ctx) => {
|
|
39
|
+
// (r6, Codex r5 P3) the API's cross-field rules (parseDealViewFilters): a range is never reversed
|
|
40
|
+
if (f.createdFrom && f.createdTo && f.createdFrom > f.createdTo)
|
|
41
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "createdFrom is after createdTo", path: ["createdFrom"] });
|
|
42
|
+
if (f.valueMin && f.valueMax && Number(f.valueMin) > Number(f.valueMax))
|
|
43
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "valueMin is above valueMax", path: ["valueMin"] });
|
|
44
|
+
}).describe("The Deals page's filters (no other key): ownerIds, createdFrom, createdTo, tagIds, contactTimezones, valueMin, valueMax; every key optional");
|
|
45
|
+
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), 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
|
+
export function registerDealsPageViewTools(server, client) {
|
|
47
|
+
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 }) => {
|
|
48
|
+
// two literal paths (the coverage gate derives a tool's endpoints from its literal client calls: a path ending in a template
|
|
49
|
+
// placeholder would not match the catalog's GET /api/v1/deal-views)
|
|
50
|
+
if (!pipeline)
|
|
51
|
+
return formatResult(await client.get("/api/v1/deal-views"));
|
|
52
|
+
return formatResult(await client.get(`/api/v1/deal-views?${new URLSearchParams({ pipeline })}`));
|
|
53
|
+
}));
|
|
54
|
+
strictInput(server.tool("conduyt_create_deals_page_view", "Save a Deals page view (POST /api/v1/deal-views, the page's \"Save current filters as a view\"): 201 { view, defaultViewId }. makeDefault: true also makes it the view the page opens on. 409 deal_view_name_taken (a name you already use, any case, or a built-in name), 409 deal_view_limit (50 views per person), 403 deal_view_share_forbidden (shared: true without the Manager permission deals.view_all), 400 invalid_request / invalid_filters. " + VIEW_DOC, {
|
|
55
|
+
name: nameSchema,
|
|
56
|
+
status: statusSchema,
|
|
57
|
+
filters: filtersSchema.optional(),
|
|
58
|
+
listSort: sortSchema.nullable().optional().describe("The list sort saved with the view, { field, dir }, or null"),
|
|
59
|
+
shared: z.boolean().optional().describe("true = shared in the workspace (managers only)"),
|
|
60
|
+
makeDefault: z.boolean().optional().describe("true = also your default view"),
|
|
61
|
+
}, async (params) => formatResult(await client.post("/api/v1/deal-views", params))));
|
|
62
|
+
strictInput(server.tool("conduyt_update_deals_page_view", "Change one of YOUR Deals page views (PATCH /api/v1/deal-views/{id}): only the fields you pass change; filters REPLACES the whole filter set; listSort null clears the saved sort. Answers { view }. Owner only: 403 deal_view_builtin (id is a built-in), 403 deal_view_read_only (a view shared by someone else: duplicate it with conduyt_duplicate_deals_page_view), 403 deal_view_share_forbidden (changing shared without deals.view_all), 404 deal_view_not_found (missing or another person's private view), 409 deal_view_name_taken, 400 invalid_request / invalid_filters. Nothing to change is refused before any request. " + VIEW_DOC, {
|
|
63
|
+
id: viewId("The view's id"),
|
|
64
|
+
name: nameSchema.optional(),
|
|
65
|
+
status: statusSchema.optional(),
|
|
66
|
+
filters: filtersSchema.optional(),
|
|
67
|
+
listSort: sortSchema.nullable().optional().describe("The saved list sort { field, dir }; null clears it"),
|
|
68
|
+
shared: z.boolean().optional().describe("Share in the workspace or stop sharing (managers only)"),
|
|
69
|
+
}, async ({ id, ...updates }) => {
|
|
70
|
+
if (Object.keys(updates).length === 0)
|
|
71
|
+
throw new Error("Nothing to change: pass name, status, filters, listSort or shared.");
|
|
72
|
+
return formatResult(await client.patch(`/api/v1/deal-views/${encodeURIComponent(id)}`, updates));
|
|
73
|
+
}));
|
|
74
|
+
strictInput(server.tool("conduyt_delete_deals_page_view", "Delete one of YOUR Deals page views (DELETE /api/v1/deal-views/{id}): { id, deleted: true }. The deals are untouched; anyone whose default it was opens on All deals from then on. Not undoable. Owner only: 403 deal_view_builtin, 403 deal_view_read_only (a view shared by someone else), 404 deal_view_not_found.", { id: viewId("The view's id") }, async ({ id }) => formatResult(await client.del(`/api/v1/deal-views/${encodeURIComponent(id)}`))));
|
|
75
|
+
strictInput(server.tool("conduyt_duplicate_deals_page_view", "Duplicate a Deals page view as a new view of YOUR OWN (POST /api/v1/deal-views/{id}/duplicate, \"Duplicate as new view\"): the copy takes the source's status, filters and the list sort you see on it. id may be a built-in (all | open | mine | won | lost), your own view or a shared one. 201 { view, defaultViewId }. 404 deal_view_not_found, 409 deal_view_name_taken, 409 deal_view_limit, 403 deal_view_share_forbidden, 400 invalid_request. " + VIEW_DOC, {
|
|
76
|
+
id: viewId("The source view's id"),
|
|
77
|
+
name: nameSchema,
|
|
78
|
+
shared: z.boolean().optional().describe("true = the copy is shared in the workspace (managers only)"),
|
|
79
|
+
makeDefault: z.boolean().optional().describe("true = the copy becomes your default view"),
|
|
80
|
+
}, async ({ id, ...body }) => formatResult(await client.post(`/api/v1/deal-views/${encodeURIComponent(id)}/duplicate`, body))));
|
|
81
|
+
strictInput(server.tool("conduyt_set_deals_page_view_prefs", "Set your Deals page preferences in this workspace (PUT /api/v1/deal-views/prefs; stored on the server, they follow you to any device): defaultViewId (\"Set as my default\": a built-in id or a view id you can read) and/or listSort { viewId, sort } (the list sort remembered for that view; sort null forgets it). Answers { defaultViewId, listSorts }. 404 deal_view_not_found for a view you cannot read; 400 invalid_request. Nothing to change is refused before any request.", {
|
|
82
|
+
defaultViewId: viewId("The view the Deals page opens on").optional(),
|
|
83
|
+
listSort: z.object({
|
|
84
|
+
viewId: viewId("The view whose list sort is remembered"),
|
|
85
|
+
sort: sortSchema.nullable().describe("{ field, dir }, or null to forget it"),
|
|
86
|
+
}).strict().optional(),
|
|
87
|
+
}, async (body) => {
|
|
88
|
+
if (body.defaultViewId === undefined && body.listSort === undefined)
|
|
89
|
+
throw new Error("Nothing to change: pass defaultViewId or listSort.");
|
|
90
|
+
return formatResult(await client.put("/api/v1/deal-views/prefs", body));
|
|
91
|
+
}));
|
|
92
|
+
}
|
package/dist/tools/deals.js
CHANGED
|
@@ -35,6 +35,9 @@ function boardSnapshotColumns(a, f) {
|
|
|
35
35
|
conflicts.push(...health);
|
|
36
36
|
if (a.page !== undefined)
|
|
37
37
|
conflicts.push("page");
|
|
38
|
+
// (dealviewsaved53 r3) a snapshot keeps the board's order: sort / order break ties in it (sent), list_order cannot apply
|
|
39
|
+
if (a.list_order !== undefined)
|
|
40
|
+
conflicts.push("list_order");
|
|
38
41
|
if (conflicts.length > 0) {
|
|
39
42
|
throw new Error(`board_snapshot=true cannot be combined with ${conflicts.join(", ")}: it answers every named column's first rows, rows only.`);
|
|
40
43
|
}
|
|
@@ -58,7 +61,7 @@ function boardSnapshotColumns(a, f) {
|
|
|
58
61
|
return a.board_columns.map((c) => (c.limit === undefined ? c.stageId : `${c.stageId}:${c.limit}`)).join(",");
|
|
59
62
|
}
|
|
60
63
|
export function registerDealTools(server, client) {
|
|
61
|
-
strictInput(server.tool("conduyt_list_deals", "List deals with filtering by pipeline, stage, assignee, or status. Returns deal title, value, stage, contact, and dates. Filter by pipeline/stage NAME (the same names you import with) or by UUID — both camelCase (pipelineName) and snake_case (pipeline_name) argument names are accepted. An unknown name returns a clear error, never the whole account. Each deal row carries hasNextStep (boolean: an open task or a booked appointment from a day ago on; the Needs next action rule's own answer) and nextAppointmentAt (ISO string or null; null unless your key can view the calendar, even when hasNextStep is true). PIPELINE HEALTH: pass health_summary=true to get the Pipeline health strip for the same filtered set instead of the deal list: { totalOpenDeals, atRiskValue, checks[] (key, label, severity, color, rule, count, value; the six checks high_value_idle, stale, unassigned, needs_action, missing_close_date, missing_contact, ordered by money at risk), deals }. Add health_check to also get that check's first page of deals (highest value first) as deals: { check, offset, items, hasMore, nextCursor, total }; deals is null without a check. Page with health_cursor (the previous nextCursor, passed back UNCHANGED: an opaque signed token) or health_offset, and health_rows_only=true to get just the page without the summary: the answer is {data:{deals:{check, offset, items, hasMore, nextCursor}}} (the page sits under data.deals). " + HEALTH_ERRORS + " " + BOARD_SNAPSHOT_DOC + " " + BUSY_503_DOC + MIRROR_READ_DOC + " A mirror key is not filterable (422 mirror_not_filterable). The API judges the query NAMES (batch32, #1313): a name GET /deals does not read is 400 unknown_query_param { message, unknown[], accepted[] (every name it reads), didYouMean { name: accepted twin } for the camelCase / snake_case twin of an accepted name } and is never silently ignored (it used to answer the unfiltered list); two different values for a single-value name (status, contact_id, search, stale, needsAction, summary, latest_updated, system_occupancy, sort, order, page, per_page, value_min / minValue, value_max / maxValue) are 400 query_param_conflict { message, param }, an exact repeat is accepted. This tool sends only accepted names (pipeline, pipeline_name, stage, stage_name, assigned_to, status, search, contact_timezone, page, per_page, board_snapshot, board_columns, health_summary, health_check, health_limit, health_offset, health_cursor, health_rows_only), so these two codes mean an older or newer server than this MCP expects; they reach you as `Conduyt API 400: <message>` with the code. The API judges sort and order (batch32): an unknown sort field, or an order other than asc / desc, is 400 sort_invalid { message, param, accepted } (the sent spelling in param) and is never silently replaced by the default order. The deal value bounds are judged too: value_min / minValue and value_max / maxValue that are non-numeric or outside the deal value column range (-9999999999.99..9999999999.99) are 400 invalid_value_min / invalid_value_max { message, param, accepted } (absent or empty = no filter; an alias spelling answers the same code with the sent spelling in param)." + " " + ROLE_COLUMNS_NOTE + " TIME ZONE (#1312): " + CONTACT_TIMEZONE_NOTE + LIST_USERS_DOC, {
|
|
64
|
+
strictInput(server.tool("conduyt_list_deals", "List deals with filtering by pipeline, stage, assignee, or status. Returns deal title, value, stage, contact, and dates. Filter by pipeline/stage NAME (the same names you import with) or by UUID — both camelCase (pipelineName) and snake_case (pipeline_name) argument names are accepted. An unknown name returns a clear error, never the whole account. Each deal row carries hasNextStep (boolean: an open task or a booked appointment from a day ago on; the Needs next action rule's own answer) and nextAppointmentAt (ISO string or null; null unless your key can view the calendar, even when hasNextStep is true). PIPELINE HEALTH: pass health_summary=true to get the Pipeline health strip for the same filtered set instead of the deal list: { totalOpenDeals, atRiskValue, checks[] (key, label, severity, color, rule, count, value; the six checks high_value_idle, stale, unassigned, needs_action, missing_close_date, missing_contact, ordered by money at risk), deals }. Add health_check to also get that check's first page of deals (highest value first) as deals: { check, offset, items, hasMore, nextCursor, total }; deals is null without a check. Page with health_cursor (the previous nextCursor, passed back UNCHANGED: an opaque signed token) or health_offset, and health_rows_only=true to get just the page without the summary: the answer is {data:{deals:{check, offset, items, hasMore, nextCursor}}} (the page sits under data.deals). " + HEALTH_ERRORS + " " + BOARD_SNAPSHOT_DOC + " " + BUSY_503_DOC + MIRROR_READ_DOC + " A mirror key is not filterable (422 mirror_not_filterable). The API judges the query NAMES (batch32, #1313): a name GET /deals does not read is 400 unknown_query_param { message, unknown[], accepted[] (every name it reads), didYouMean { name: accepted twin } for the camelCase / snake_case twin of an accepted name } and is never silently ignored (it used to answer the unfiltered list); two different values for a single-value name (status, contact_id, search, stale, needsAction, summary, latest_updated, system_occupancy, sort, order, page, per_page, value_min / minValue, value_max / maxValue) are 400 query_param_conflict { message, param }, an exact repeat is accepted. This tool sends only accepted names (pipeline, pipeline_name, stage, stage_name, assigned_to, status, search, contact_timezone, page, per_page, 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, {
|
|
62
65
|
pipeline: z.string().optional().describe("Filter by pipeline UUID (canonical). Aliases: pipelineId, pipeline_id."),
|
|
63
66
|
pipelineId: z.string().optional().describe("Filter by pipeline UUID (alias of pipeline)."),
|
|
64
67
|
pipeline_id: z.string().optional().describe("snake_case alias of pipelineId."),
|
|
@@ -76,6 +79,9 @@ export function registerDealTools(server, client) {
|
|
|
76
79
|
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."),
|
|
77
80
|
page: z.number().optional().describe("Page number (default 1)"),
|
|
78
81
|
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)"),
|
|
82
|
+
sort: z.enum(["createdAt", "updatedAt", "title", "value", "expectedCloseDate"]).optional().describe("Sort field (server default createdAt). 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."),
|
|
83
|
+
order: z.enum(["asc", "desc"]).optional().describe("Sort direction (server default desc)."),
|
|
84
|
+
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)."),
|
|
79
85
|
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."),
|
|
80
86
|
health_check: healthCheckSchema.optional().describe("With health_summary: one check whose deals are added to `deals`, highest value first."),
|
|
81
87
|
health_limit: z.number().int().min(1).max(100).optional().describe("With health_summary and health_check: deals per page, 1-100 (default 5)."),
|
|
@@ -136,6 +142,17 @@ export function registerDealTools(server, client) {
|
|
|
136
142
|
params.set("page", String(page));
|
|
137
143
|
if (per_page)
|
|
138
144
|
params.set("per_page", String(per_page));
|
|
145
|
+
// (dealviewsaved53 r3) the health answer has its own order (highest value first): a list sort with it is refused here,
|
|
146
|
+
// never silently dropped by the server
|
|
147
|
+
if (a.health_summary === true && (a.sort !== undefined || a.order !== undefined || a.list_order !== undefined)) {
|
|
148
|
+
throw new Error("health_summary=true cannot be combined with sort, order or list_order: the Pipeline health answer has its own order (highest value first).");
|
|
149
|
+
}
|
|
150
|
+
if (a.sort !== undefined)
|
|
151
|
+
params.set("sort", a.sort);
|
|
152
|
+
if (a.order !== undefined)
|
|
153
|
+
params.set("order", a.order);
|
|
154
|
+
if (a.list_order !== undefined)
|
|
155
|
+
params.set("list_order", String(a.list_order));
|
|
139
156
|
// Pipeline health strip: sent only when given, the cursor byte for byte (it is signed; never trimmed or re-encoded by hand)
|
|
140
157
|
if (a.health_summary !== undefined)
|
|
141
158
|
params.set("health_summary", String(a.health_summary));
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-11-
|
|
3
|
-
"toolCount":
|
|
4
|
-
"totalEndpoints":
|
|
2
|
+
"generatedAt": "2026-11-22T07:10:20.755Z",
|
|
3
|
+
"toolCount": 452,
|
|
4
|
+
"totalEndpoints": 1229,
|
|
5
5
|
"counts": {
|
|
6
|
-
"covered":
|
|
6
|
+
"covered": 402,
|
|
7
7
|
"excluded": 376,
|
|
8
8
|
"planned": 451,
|
|
9
9
|
"uncategorized": 0
|
|
@@ -813,6 +813,12 @@
|
|
|
813
813
|
"status": "planned",
|
|
814
814
|
"reason": "automation subroutes beyond the workflow-builder tools (step-logs detail, node ops)"
|
|
815
815
|
},
|
|
816
|
+
"POST /api/v1/automations/:id/deactivate-if-idle": {
|
|
817
|
+
"status": "covered",
|
|
818
|
+
"tools": [
|
|
819
|
+
"conduyt_update_automation"
|
|
820
|
+
]
|
|
821
|
+
},
|
|
816
822
|
"GET /api/v1/automations/:id/dependency-audit": {
|
|
817
823
|
"status": "planned",
|
|
818
824
|
"reason": "automation subroutes beyond the workflow-builder tools (step-logs detail, node ops)"
|
|
@@ -2653,6 +2659,42 @@
|
|
|
2653
2659
|
"status": "planned",
|
|
2654
2660
|
"reason": "data-model quality reporting"
|
|
2655
2661
|
},
|
|
2662
|
+
"GET /api/v1/deal-views": {
|
|
2663
|
+
"status": "covered",
|
|
2664
|
+
"tools": [
|
|
2665
|
+
"conduyt_list_deals_page_views"
|
|
2666
|
+
]
|
|
2667
|
+
},
|
|
2668
|
+
"POST /api/v1/deal-views": {
|
|
2669
|
+
"status": "covered",
|
|
2670
|
+
"tools": [
|
|
2671
|
+
"conduyt_create_deals_page_view"
|
|
2672
|
+
]
|
|
2673
|
+
},
|
|
2674
|
+
"PATCH /api/v1/deal-views/:id": {
|
|
2675
|
+
"status": "covered",
|
|
2676
|
+
"tools": [
|
|
2677
|
+
"conduyt_update_deals_page_view"
|
|
2678
|
+
]
|
|
2679
|
+
},
|
|
2680
|
+
"DELETE /api/v1/deal-views/:id": {
|
|
2681
|
+
"status": "covered",
|
|
2682
|
+
"tools": [
|
|
2683
|
+
"conduyt_delete_deals_page_view"
|
|
2684
|
+
]
|
|
2685
|
+
},
|
|
2686
|
+
"POST /api/v1/deal-views/:id/duplicate": {
|
|
2687
|
+
"status": "covered",
|
|
2688
|
+
"tools": [
|
|
2689
|
+
"conduyt_duplicate_deals_page_view"
|
|
2690
|
+
]
|
|
2691
|
+
},
|
|
2692
|
+
"PUT /api/v1/deal-views/prefs": {
|
|
2693
|
+
"status": "covered",
|
|
2694
|
+
"tools": [
|
|
2695
|
+
"conduyt_set_deals_page_view_prefs"
|
|
2696
|
+
]
|
|
2697
|
+
},
|
|
2656
2698
|
"GET /api/v1/deals": {
|
|
2657
2699
|
"status": "covered",
|
|
2658
2700
|
"tools": [
|