@jclvsh/iris 0.7.0 → 0.8.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/dist/cli-utils.d.ts +54 -0
- package/dist/cli-utils.js +94 -1
- package/dist/tools/agent-credits.js +3 -18
- package/dist/tools/ai.js +5 -36
- package/dist/tools/analytics.js +6 -42
- package/dist/tools/billing.js +2 -9
- package/dist/tools/campaigns.js +12 -99
- package/dist/tools/channels.js +4 -27
- package/dist/tools/contacts.js +9 -72
- package/dist/tools/conversations.js +6 -45
- package/dist/tools/discovery.js +5 -36
- package/dist/tools/keys.js +5 -33
- package/dist/tools/messages.js +7 -54
- package/dist/tools/notifications.js +5 -36
- package/dist/tools/webhooks.js +9 -72
- package/package.json +1 -1
package/dist/cli-utils.d.ts
CHANGED
|
@@ -1,4 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI + MCP output helpers.
|
|
3
|
+
*
|
|
4
|
+
* The CLI consumes these for terminal output (table / JSON / structured exit
|
|
5
|
+
* codes). MCP tools consume `formatMcpError` so error responses surface the
|
|
6
|
+
* structured `{success, error: {code, message}}` envelope to the LLM instead
|
|
7
|
+
* of a flattened message string — lets the model branch on `error.code`
|
|
8
|
+
* without regex-extracting the bracketed prefix.
|
|
9
|
+
*/
|
|
1
10
|
export declare function formatOutput(data: unknown, format?: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Map an iris error-code prefix to a CLI exit code.
|
|
13
|
+
*
|
|
14
|
+
* Convention so shell scripts can branch on failure type without parsing stderr:
|
|
15
|
+
* - 0: success (not handled here)
|
|
16
|
+
* - 1: generic / unknown
|
|
17
|
+
* - 2: input / validation (SERVER_VALIDATION_FAILED, SERVER_BAD_REQUEST)
|
|
18
|
+
* - 3: rate limit
|
|
19
|
+
* - 4: auth (AUTH_*, APIKEY_*)
|
|
20
|
+
* - 5: payment / billing (PAYMENT_*, BILLING_*)
|
|
21
|
+
* - 6: not found (any *_NOT_FOUND)
|
|
22
|
+
*
|
|
23
|
+
* Domain-specific codes (CAMP_001, CONTACT_001, etc.) are categorized by their
|
|
24
|
+
* suffix shape — *_NOT_FOUND maps to 6, others fall through to 1.
|
|
25
|
+
*/
|
|
26
|
+
export declare function exitCodeForMessage(message: string): number;
|
|
2
27
|
export declare function handleError(error: unknown): never;
|
|
28
|
+
/**
|
|
29
|
+
* Parse the `[CODE] message (field: x)` string format that IrisClient.handleError
|
|
30
|
+
* builds, recovering the structured fields.
|
|
31
|
+
*
|
|
32
|
+
* Returns `{code, message, field?}`. Falls back to `{code: "UNKNOWN_ERROR", message}`
|
|
33
|
+
* when no bracketed code is present (shouldn't happen for API errors, but safe
|
|
34
|
+
* for client-side throws like network timeouts).
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseErrorMessage(raw: string): {
|
|
37
|
+
code: string;
|
|
38
|
+
message: string;
|
|
39
|
+
field?: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Format an error caught in an MCP tool handler as the structured response
|
|
43
|
+
* the MCP SDK returns to the model.
|
|
44
|
+
*
|
|
45
|
+
* Returns the canonical iris error envelope `{success: false, error: {code, message, field?}}`
|
|
46
|
+
* as JSON text inside the MCP `content` block, plus `isError: true` so the SDK
|
|
47
|
+
* surfaces it as an error to the model. Lets the LLM read `error.code`
|
|
48
|
+
* structurally instead of regexing it out of a flattened message.
|
|
49
|
+
*/
|
|
50
|
+
export declare function formatMcpError(error: unknown): {
|
|
51
|
+
content: Array<{
|
|
52
|
+
type: "text";
|
|
53
|
+
text: string;
|
|
54
|
+
}>;
|
|
55
|
+
isError: true;
|
|
56
|
+
};
|
|
3
57
|
export declare function getFormat(opts: Record<string, unknown>): string;
|
|
4
58
|
export declare function parseList(value: string): string[];
|
package/dist/cli-utils.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI + MCP output helpers.
|
|
3
|
+
*
|
|
4
|
+
* The CLI consumes these for terminal output (table / JSON / structured exit
|
|
5
|
+
* codes). MCP tools consume `formatMcpError` so error responses surface the
|
|
6
|
+
* structured `{success, error: {code, message}}` envelope to the LLM instead
|
|
7
|
+
* of a flattened message string — lets the model branch on `error.code`
|
|
8
|
+
* without regex-extracting the bracketed prefix.
|
|
9
|
+
*/
|
|
1
10
|
export function formatOutput(data, format = "json") {
|
|
2
11
|
if (format === "table" && typeof data === "object" && data !== null) {
|
|
3
12
|
const obj = data;
|
|
@@ -16,10 +25,94 @@ export function formatOutput(data, format = "json") {
|
|
|
16
25
|
}
|
|
17
26
|
console.log(JSON.stringify(data, null, 2));
|
|
18
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Map an iris error-code prefix to a CLI exit code.
|
|
30
|
+
*
|
|
31
|
+
* Convention so shell scripts can branch on failure type without parsing stderr:
|
|
32
|
+
* - 0: success (not handled here)
|
|
33
|
+
* - 1: generic / unknown
|
|
34
|
+
* - 2: input / validation (SERVER_VALIDATION_FAILED, SERVER_BAD_REQUEST)
|
|
35
|
+
* - 3: rate limit
|
|
36
|
+
* - 4: auth (AUTH_*, APIKEY_*)
|
|
37
|
+
* - 5: payment / billing (PAYMENT_*, BILLING_*)
|
|
38
|
+
* - 6: not found (any *_NOT_FOUND)
|
|
39
|
+
*
|
|
40
|
+
* Domain-specific codes (CAMP_001, CONTACT_001, etc.) are categorized by their
|
|
41
|
+
* suffix shape — *_NOT_FOUND maps to 6, others fall through to 1.
|
|
42
|
+
*/
|
|
43
|
+
export function exitCodeForMessage(message) {
|
|
44
|
+
const codeMatch = message.match(/\[([A-Z]+)_(\d+|[A-Z_]+)\]/);
|
|
45
|
+
if (!codeMatch)
|
|
46
|
+
return 1;
|
|
47
|
+
const prefix = codeMatch[1];
|
|
48
|
+
const suffix = codeMatch[2];
|
|
49
|
+
// Suffix-based: *_NOT_FOUND → 6 regardless of prefix
|
|
50
|
+
if (suffix.includes("NOT_FOUND"))
|
|
51
|
+
return 6;
|
|
52
|
+
switch (prefix) {
|
|
53
|
+
case "AUTH":
|
|
54
|
+
case "APIKEY":
|
|
55
|
+
return 4;
|
|
56
|
+
case "RATE":
|
|
57
|
+
return 3;
|
|
58
|
+
case "PAYMENT":
|
|
59
|
+
case "BILLING":
|
|
60
|
+
return 5;
|
|
61
|
+
case "SERVER":
|
|
62
|
+
// SERVER_002/005 = validation; SERVER_003 = not found; rest = generic
|
|
63
|
+
if (suffix === "002" || suffix === "005")
|
|
64
|
+
return 2;
|
|
65
|
+
if (suffix === "003")
|
|
66
|
+
return 6;
|
|
67
|
+
return 1;
|
|
68
|
+
default:
|
|
69
|
+
return 1;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
19
72
|
export function handleError(error) {
|
|
20
73
|
const message = error instanceof Error ? error.message : String(error);
|
|
21
74
|
console.error(`error: ${message}`);
|
|
22
|
-
process.exit(
|
|
75
|
+
process.exit(exitCodeForMessage(message));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Parse the `[CODE] message (field: x)` string format that IrisClient.handleError
|
|
79
|
+
* builds, recovering the structured fields.
|
|
80
|
+
*
|
|
81
|
+
* Returns `{code, message, field?}`. Falls back to `{code: "UNKNOWN_ERROR", message}`
|
|
82
|
+
* when no bracketed code is present (shouldn't happen for API errors, but safe
|
|
83
|
+
* for client-side throws like network timeouts).
|
|
84
|
+
*/
|
|
85
|
+
export function parseErrorMessage(raw) {
|
|
86
|
+
// Format: "[CODE] message (field: x)" — code optional, field optional
|
|
87
|
+
const match = raw.match(/^\[([A-Z_0-9]+)\]\s+(.*?)(?:\s+\(field:\s+([^)]+)\))?$/);
|
|
88
|
+
if (!match)
|
|
89
|
+
return { code: "UNKNOWN_ERROR", message: raw };
|
|
90
|
+
return {
|
|
91
|
+
code: match[1],
|
|
92
|
+
message: match[2],
|
|
93
|
+
...(match[3] && { field: match[3] }),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Format an error caught in an MCP tool handler as the structured response
|
|
98
|
+
* the MCP SDK returns to the model.
|
|
99
|
+
*
|
|
100
|
+
* Returns the canonical iris error envelope `{success: false, error: {code, message, field?}}`
|
|
101
|
+
* as JSON text inside the MCP `content` block, plus `isError: true` so the SDK
|
|
102
|
+
* surfaces it as an error to the model. Lets the LLM read `error.code`
|
|
103
|
+
* structurally instead of regexing it out of a flattened message.
|
|
104
|
+
*/
|
|
105
|
+
export function formatMcpError(error) {
|
|
106
|
+
const raw = error instanceof Error ? error.message : String(error);
|
|
107
|
+
const parsed = parseErrorMessage(raw);
|
|
108
|
+
const envelope = {
|
|
109
|
+
success: false,
|
|
110
|
+
error: parsed,
|
|
111
|
+
};
|
|
112
|
+
return {
|
|
113
|
+
content: [{ type: "text", text: JSON.stringify(envelope, null, 2) }],
|
|
114
|
+
isError: true,
|
|
115
|
+
};
|
|
23
116
|
}
|
|
24
117
|
export function getFormat(opts) {
|
|
25
118
|
if (opts.json)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
1
2
|
/**
|
|
2
3
|
* Agent credit tools.
|
|
3
4
|
*
|
|
@@ -12,15 +13,7 @@ export function registerAgentCreditTools(server, client) {
|
|
|
12
13
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
13
14
|
}
|
|
14
15
|
catch (error) {
|
|
15
|
-
return
|
|
16
|
-
content: [
|
|
17
|
-
{
|
|
18
|
-
type: "text",
|
|
19
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
isError: true,
|
|
23
|
-
};
|
|
16
|
+
return formatMcpError(error);
|
|
24
17
|
}
|
|
25
18
|
});
|
|
26
19
|
server.tool("purchase_credit_pack", "purchase a 5-credit pack via MPP ($12.00 USD). x402 agents use per-campaign pricing instead. API key users do not need credits.", {}, async () => {
|
|
@@ -29,15 +22,7 @@ export function registerAgentCreditTools(server, client) {
|
|
|
29
22
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
30
23
|
}
|
|
31
24
|
catch (error) {
|
|
32
|
-
return
|
|
33
|
-
content: [
|
|
34
|
-
{
|
|
35
|
-
type: "text",
|
|
36
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
isError: true,
|
|
40
|
-
};
|
|
25
|
+
return formatMcpError(error);
|
|
41
26
|
}
|
|
42
27
|
});
|
|
43
28
|
}
|
package/dist/tools/ai.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
2
3
|
export function registerAiTools(server, client) {
|
|
3
4
|
server.tool("generate_content", "generate AI content for a specific contact conversation (email draft, follow-up, reply). requires generate scope.", {
|
|
4
5
|
contact_id: z.string().uuid().describe("contact ID"),
|
|
@@ -11,15 +12,7 @@ export function registerAiTools(server, client) {
|
|
|
11
12
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
12
13
|
}
|
|
13
14
|
catch (error) {
|
|
14
|
-
return
|
|
15
|
-
content: [
|
|
16
|
-
{
|
|
17
|
-
type: "text",
|
|
18
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
isError: true,
|
|
22
|
-
};
|
|
15
|
+
return formatMcpError(error);
|
|
23
16
|
}
|
|
24
17
|
});
|
|
25
18
|
server.tool("generate_campaign_content", "generate campaign-level outreach content (email sequence, templates) from a campaign brief. content-first: takes the strategy inline, not a campaign id. requires generate scope.", {
|
|
@@ -34,15 +27,7 @@ export function registerAiTools(server, client) {
|
|
|
34
27
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
35
28
|
}
|
|
36
29
|
catch (error) {
|
|
37
|
-
return
|
|
38
|
-
content: [
|
|
39
|
-
{
|
|
40
|
-
type: "text",
|
|
41
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
isError: true,
|
|
45
|
-
};
|
|
30
|
+
return formatMcpError(error);
|
|
46
31
|
}
|
|
47
32
|
});
|
|
48
33
|
server.tool("analyze_response", "analyze an inbound message using AI to determine sentiment, intent, and suggested actions. requires generate scope.", {
|
|
@@ -54,15 +39,7 @@ export function registerAiTools(server, client) {
|
|
|
54
39
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
55
40
|
}
|
|
56
41
|
catch (error) {
|
|
57
|
-
return
|
|
58
|
-
content: [
|
|
59
|
-
{
|
|
60
|
-
type: "text",
|
|
61
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
isError: true,
|
|
65
|
-
};
|
|
42
|
+
return formatMcpError(error);
|
|
66
43
|
}
|
|
67
44
|
});
|
|
68
45
|
server.tool("get_ai_usage", "get AI generation usage limits and current counts for the billing period. requires read scope.", {}, async () => {
|
|
@@ -71,15 +48,7 @@ export function registerAiTools(server, client) {
|
|
|
71
48
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
72
49
|
}
|
|
73
50
|
catch (error) {
|
|
74
|
-
return
|
|
75
|
-
content: [
|
|
76
|
-
{
|
|
77
|
-
type: "text",
|
|
78
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
isError: true,
|
|
82
|
-
};
|
|
51
|
+
return formatMcpError(error);
|
|
83
52
|
}
|
|
84
53
|
});
|
|
85
54
|
}
|
package/dist/tools/analytics.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
2
3
|
export function registerAnalyticsTools(server, client) {
|
|
3
4
|
server.tool("get_analytics_overview", "get a high-level overview of all campaign analytics. requires read scope.", {}, async () => {
|
|
4
5
|
try {
|
|
@@ -6,15 +7,7 @@ export function registerAnalyticsTools(server, client) {
|
|
|
6
7
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
7
8
|
}
|
|
8
9
|
catch (error) {
|
|
9
|
-
return
|
|
10
|
-
content: [
|
|
11
|
-
{
|
|
12
|
-
type: "text",
|
|
13
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
isError: true,
|
|
17
|
-
};
|
|
10
|
+
return formatMcpError(error);
|
|
18
11
|
}
|
|
19
12
|
});
|
|
20
13
|
server.tool("get_campaign_analytics", "get detailed analytics for a specific campaign. requires read scope.", {
|
|
@@ -25,15 +18,7 @@ export function registerAnalyticsTools(server, client) {
|
|
|
25
18
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
26
19
|
}
|
|
27
20
|
catch (error) {
|
|
28
|
-
return
|
|
29
|
-
content: [
|
|
30
|
-
{
|
|
31
|
-
type: "text",
|
|
32
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
isError: true,
|
|
36
|
-
};
|
|
21
|
+
return formatMcpError(error);
|
|
37
22
|
}
|
|
38
23
|
});
|
|
39
24
|
server.tool("get_performance_metrics", "get email performance metrics over time. requires read scope.", {
|
|
@@ -50,15 +35,7 @@ export function registerAnalyticsTools(server, client) {
|
|
|
50
35
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
51
36
|
}
|
|
52
37
|
catch (error) {
|
|
53
|
-
return
|
|
54
|
-
content: [
|
|
55
|
-
{
|
|
56
|
-
type: "text",
|
|
57
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
isError: true,
|
|
61
|
-
};
|
|
38
|
+
return formatMcpError(error);
|
|
62
39
|
}
|
|
63
40
|
});
|
|
64
41
|
server.tool("get_response_time", "get average response time analytics. requires read scope.", {
|
|
@@ -72,15 +49,7 @@ export function registerAnalyticsTools(server, client) {
|
|
|
72
49
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
73
50
|
}
|
|
74
51
|
catch (error) {
|
|
75
|
-
return
|
|
76
|
-
content: [
|
|
77
|
-
{
|
|
78
|
-
type: "text",
|
|
79
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
isError: true,
|
|
83
|
-
};
|
|
52
|
+
return formatMcpError(error);
|
|
84
53
|
}
|
|
85
54
|
});
|
|
86
55
|
server.tool("get_contact_types", "get breakdown of contacts by type/source. requires read scope.", {}, async () => {
|
|
@@ -89,12 +58,7 @@ export function registerAnalyticsTools(server, client) {
|
|
|
89
58
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
90
59
|
}
|
|
91
60
|
catch (error) {
|
|
92
|
-
return
|
|
93
|
-
content: [
|
|
94
|
-
{ type: "text", text: `error: ${error instanceof Error ? error.message : String(error)}` },
|
|
95
|
-
],
|
|
96
|
-
isError: true,
|
|
97
|
-
};
|
|
61
|
+
return formatMcpError(error);
|
|
98
62
|
}
|
|
99
63
|
});
|
|
100
64
|
}
|
package/dist/tools/billing.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
1
2
|
export function registerBillingTools(server, client) {
|
|
2
3
|
server.tool("get_billing_plans", "get all available billing plans with pricing and feature limits. requires read scope.", {}, async () => {
|
|
3
4
|
try {
|
|
@@ -5,15 +6,7 @@ export function registerBillingTools(server, client) {
|
|
|
5
6
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
6
7
|
}
|
|
7
8
|
catch (error) {
|
|
8
|
-
return
|
|
9
|
-
content: [
|
|
10
|
-
{
|
|
11
|
-
type: "text",
|
|
12
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
isError: true,
|
|
16
|
-
};
|
|
9
|
+
return formatMcpError(error);
|
|
17
10
|
}
|
|
18
11
|
});
|
|
19
12
|
}
|
package/dist/tools/campaigns.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
2
3
|
const CAMPAIGN_STATUSES = ["draft", "active", "paused", "completed", "deleted"];
|
|
3
4
|
const OBJECTIVE_TYPES = ["venue_dj", "venue_host", "product_promotion", "custom"];
|
|
4
5
|
const TARGET_PROFILE_TYPES = [
|
|
@@ -30,15 +31,7 @@ export function registerCampaignTools(server, client) {
|
|
|
30
31
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
31
32
|
}
|
|
32
33
|
catch (error) {
|
|
33
|
-
return
|
|
34
|
-
content: [
|
|
35
|
-
{
|
|
36
|
-
type: "text",
|
|
37
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
isError: true,
|
|
41
|
-
};
|
|
34
|
+
return formatMcpError(error);
|
|
42
35
|
}
|
|
43
36
|
});
|
|
44
37
|
server.tool("create_campaign", "create a new outreach campaign. requires write scope.", {
|
|
@@ -57,15 +50,7 @@ export function registerCampaignTools(server, client) {
|
|
|
57
50
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
58
51
|
}
|
|
59
52
|
catch (error) {
|
|
60
|
-
return
|
|
61
|
-
content: [
|
|
62
|
-
{
|
|
63
|
-
type: "text",
|
|
64
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
isError: true,
|
|
68
|
-
};
|
|
53
|
+
return formatMcpError(error);
|
|
69
54
|
}
|
|
70
55
|
});
|
|
71
56
|
server.tool("get_campaign", "get a campaign by ID with stats. requires read scope.", {
|
|
@@ -76,15 +61,7 @@ export function registerCampaignTools(server, client) {
|
|
|
76
61
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
77
62
|
}
|
|
78
63
|
catch (error) {
|
|
79
|
-
return
|
|
80
|
-
content: [
|
|
81
|
-
{
|
|
82
|
-
type: "text",
|
|
83
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
isError: true,
|
|
87
|
-
};
|
|
64
|
+
return formatMcpError(error);
|
|
88
65
|
}
|
|
89
66
|
});
|
|
90
67
|
server.tool("update_campaign", "update a campaign's details. requires write scope.", {
|
|
@@ -100,15 +77,7 @@ export function registerCampaignTools(server, client) {
|
|
|
100
77
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
101
78
|
}
|
|
102
79
|
catch (error) {
|
|
103
|
-
return
|
|
104
|
-
content: [
|
|
105
|
-
{
|
|
106
|
-
type: "text",
|
|
107
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
isError: true,
|
|
111
|
-
};
|
|
80
|
+
return formatMcpError(error);
|
|
112
81
|
}
|
|
113
82
|
});
|
|
114
83
|
server.tool("delete_campaign", "soft-delete a campaign (sets status to deleted). requires write scope.", {
|
|
@@ -119,15 +88,7 @@ export function registerCampaignTools(server, client) {
|
|
|
119
88
|
return { content: [{ type: "text", text: `campaign ${id} deleted` }] };
|
|
120
89
|
}
|
|
121
90
|
catch (error) {
|
|
122
|
-
return
|
|
123
|
-
content: [
|
|
124
|
-
{
|
|
125
|
-
type: "text",
|
|
126
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
isError: true,
|
|
130
|
-
};
|
|
91
|
+
return formatMcpError(error);
|
|
131
92
|
}
|
|
132
93
|
});
|
|
133
94
|
server.tool("list_campaign_contacts", "list contacts in a campaign with optional status filter. requires read scope.", {
|
|
@@ -151,15 +112,7 @@ export function registerCampaignTools(server, client) {
|
|
|
151
112
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
152
113
|
}
|
|
153
114
|
catch (error) {
|
|
154
|
-
return
|
|
155
|
-
content: [
|
|
156
|
-
{
|
|
157
|
-
type: "text",
|
|
158
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
isError: true,
|
|
162
|
-
};
|
|
115
|
+
return formatMcpError(error);
|
|
163
116
|
}
|
|
164
117
|
});
|
|
165
118
|
server.tool("get_campaign_usage", "get usage limits and current counts for a campaign. requires read scope.", {
|
|
@@ -170,15 +123,7 @@ export function registerCampaignTools(server, client) {
|
|
|
170
123
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
171
124
|
}
|
|
172
125
|
catch (error) {
|
|
173
|
-
return
|
|
174
|
-
content: [
|
|
175
|
-
{
|
|
176
|
-
type: "text",
|
|
177
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
178
|
-
},
|
|
179
|
-
],
|
|
180
|
-
isError: true,
|
|
181
|
-
};
|
|
126
|
+
return formatMcpError(error);
|
|
182
127
|
}
|
|
183
128
|
});
|
|
184
129
|
server.tool("analyze_campaign", "trigger AI analysis of a campaign to generate target profiles and recommendations. requires write scope.", {
|
|
@@ -189,15 +134,7 @@ export function registerCampaignTools(server, client) {
|
|
|
189
134
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
190
135
|
}
|
|
191
136
|
catch (error) {
|
|
192
|
-
return
|
|
193
|
-
content: [
|
|
194
|
-
{
|
|
195
|
-
type: "text",
|
|
196
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
197
|
-
},
|
|
198
|
-
],
|
|
199
|
-
isError: true,
|
|
200
|
-
};
|
|
137
|
+
return formatMcpError(error);
|
|
201
138
|
}
|
|
202
139
|
});
|
|
203
140
|
server.tool("list_target_profiles", "list target profiles for a campaign. requires read scope.", {
|
|
@@ -208,15 +145,7 @@ export function registerCampaignTools(server, client) {
|
|
|
208
145
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
209
146
|
}
|
|
210
147
|
catch (error) {
|
|
211
|
-
return
|
|
212
|
-
content: [
|
|
213
|
-
{
|
|
214
|
-
type: "text",
|
|
215
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
216
|
-
},
|
|
217
|
-
],
|
|
218
|
-
isError: true,
|
|
219
|
-
};
|
|
148
|
+
return formatMcpError(error);
|
|
220
149
|
}
|
|
221
150
|
});
|
|
222
151
|
server.tool("create_target_profile", "create a target profile for a campaign. requires write scope.", {
|
|
@@ -236,15 +165,7 @@ export function registerCampaignTools(server, client) {
|
|
|
236
165
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
237
166
|
}
|
|
238
167
|
catch (error) {
|
|
239
|
-
return
|
|
240
|
-
content: [
|
|
241
|
-
{
|
|
242
|
-
type: "text",
|
|
243
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
244
|
-
},
|
|
245
|
-
],
|
|
246
|
-
isError: true,
|
|
247
|
-
};
|
|
168
|
+
return formatMcpError(error);
|
|
248
169
|
}
|
|
249
170
|
});
|
|
250
171
|
server.tool("delete_target_profile", "delete a target profile from a campaign. requires write scope.", {
|
|
@@ -256,15 +177,7 @@ export function registerCampaignTools(server, client) {
|
|
|
256
177
|
return { content: [{ type: "text", text: `target profile ${profile_id} deleted` }] };
|
|
257
178
|
}
|
|
258
179
|
catch (error) {
|
|
259
|
-
return
|
|
260
|
-
content: [
|
|
261
|
-
{
|
|
262
|
-
type: "text",
|
|
263
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
264
|
-
},
|
|
265
|
-
],
|
|
266
|
-
isError: true,
|
|
267
|
-
};
|
|
180
|
+
return formatMcpError(error);
|
|
268
181
|
}
|
|
269
182
|
});
|
|
270
183
|
}
|
package/dist/tools/channels.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
2
3
|
const CHANNELS = ["email", "instagram", "twitter"];
|
|
3
4
|
export function registerChannelTools(server, client) {
|
|
4
5
|
server.tool("list_connected_accounts", "list all connected social media accounts. requires read scope.", {}, async () => {
|
|
@@ -7,15 +8,7 @@ export function registerChannelTools(server, client) {
|
|
|
7
8
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
8
9
|
}
|
|
9
10
|
catch (error) {
|
|
10
|
-
return
|
|
11
|
-
content: [
|
|
12
|
-
{
|
|
13
|
-
type: "text",
|
|
14
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
isError: true,
|
|
18
|
-
};
|
|
11
|
+
return formatMcpError(error);
|
|
19
12
|
}
|
|
20
13
|
});
|
|
21
14
|
server.tool("check_channel_availability", "check which outreach channels are available and configured. requires read scope.", {}, async () => {
|
|
@@ -24,15 +17,7 @@ export function registerChannelTools(server, client) {
|
|
|
24
17
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
25
18
|
}
|
|
26
19
|
catch (error) {
|
|
27
|
-
return
|
|
28
|
-
content: [
|
|
29
|
-
{
|
|
30
|
-
type: "text",
|
|
31
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
isError: true,
|
|
35
|
-
};
|
|
20
|
+
return formatMcpError(error);
|
|
36
21
|
}
|
|
37
22
|
});
|
|
38
23
|
server.tool("send_channel_message", "send a message through a specific channel in a conversation. requires send scope.", {
|
|
@@ -50,15 +35,7 @@ export function registerChannelTools(server, client) {
|
|
|
50
35
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
51
36
|
}
|
|
52
37
|
catch (error) {
|
|
53
|
-
return
|
|
54
|
-
content: [
|
|
55
|
-
{
|
|
56
|
-
type: "text",
|
|
57
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
isError: true,
|
|
61
|
-
};
|
|
38
|
+
return formatMcpError(error);
|
|
62
39
|
}
|
|
63
40
|
});
|
|
64
41
|
}
|
package/dist/tools/contacts.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
2
3
|
export function registerContactTools(server, client) {
|
|
3
4
|
server.tool("list_contacts", "list all contacts with optional search. requires read scope.", {
|
|
4
5
|
page: z.number().int().positive().optional().describe("page number (default 1)"),
|
|
@@ -17,15 +18,7 @@ export function registerContactTools(server, client) {
|
|
|
17
18
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
18
19
|
}
|
|
19
20
|
catch (error) {
|
|
20
|
-
return
|
|
21
|
-
content: [
|
|
22
|
-
{
|
|
23
|
-
type: "text",
|
|
24
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
isError: true,
|
|
28
|
-
};
|
|
21
|
+
return formatMcpError(error);
|
|
29
22
|
}
|
|
30
23
|
});
|
|
31
24
|
server.tool("create_contact", "create a new contact. requires write scope.", {
|
|
@@ -43,15 +36,7 @@ export function registerContactTools(server, client) {
|
|
|
43
36
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
44
37
|
}
|
|
45
38
|
catch (error) {
|
|
46
|
-
return
|
|
47
|
-
content: [
|
|
48
|
-
{
|
|
49
|
-
type: "text",
|
|
50
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
isError: true,
|
|
54
|
-
};
|
|
39
|
+
return formatMcpError(error);
|
|
55
40
|
}
|
|
56
41
|
});
|
|
57
42
|
server.tool("get_contact", "get a contact by ID. requires read scope.", {
|
|
@@ -62,15 +47,7 @@ export function registerContactTools(server, client) {
|
|
|
62
47
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
63
48
|
}
|
|
64
49
|
catch (error) {
|
|
65
|
-
return
|
|
66
|
-
content: [
|
|
67
|
-
{
|
|
68
|
-
type: "text",
|
|
69
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
isError: true,
|
|
73
|
-
};
|
|
50
|
+
return formatMcpError(error);
|
|
74
51
|
}
|
|
75
52
|
});
|
|
76
53
|
server.tool("update_contact", "update a contact's details. requires write scope.", {
|
|
@@ -89,15 +66,7 @@ export function registerContactTools(server, client) {
|
|
|
89
66
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
90
67
|
}
|
|
91
68
|
catch (error) {
|
|
92
|
-
return
|
|
93
|
-
content: [
|
|
94
|
-
{
|
|
95
|
-
type: "text",
|
|
96
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
isError: true,
|
|
100
|
-
};
|
|
69
|
+
return formatMcpError(error);
|
|
101
70
|
}
|
|
102
71
|
});
|
|
103
72
|
server.tool("delete_contact", "soft-delete a contact. requires write scope.", {
|
|
@@ -108,15 +77,7 @@ export function registerContactTools(server, client) {
|
|
|
108
77
|
return { content: [{ type: "text", text: `contact ${id} deleted` }] };
|
|
109
78
|
}
|
|
110
79
|
catch (error) {
|
|
111
|
-
return
|
|
112
|
-
content: [
|
|
113
|
-
{
|
|
114
|
-
type: "text",
|
|
115
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
isError: true,
|
|
119
|
-
};
|
|
80
|
+
return formatMcpError(error);
|
|
120
81
|
}
|
|
121
82
|
});
|
|
122
83
|
server.tool("bulk_import_contacts", "import multiple contacts at once, optionally adding them to a campaign. requires write scope.", {
|
|
@@ -139,15 +100,7 @@ export function registerContactTools(server, client) {
|
|
|
139
100
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
140
101
|
}
|
|
141
102
|
catch (error) {
|
|
142
|
-
return
|
|
143
|
-
content: [
|
|
144
|
-
{
|
|
145
|
-
type: "text",
|
|
146
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
isError: true,
|
|
150
|
-
};
|
|
103
|
+
return formatMcpError(error);
|
|
151
104
|
}
|
|
152
105
|
});
|
|
153
106
|
server.tool("get_contact_usage", "get contact usage limits and current counts for the billing period. requires read scope.", {}, async () => {
|
|
@@ -156,15 +109,7 @@ export function registerContactTools(server, client) {
|
|
|
156
109
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
157
110
|
}
|
|
158
111
|
catch (error) {
|
|
159
|
-
return
|
|
160
|
-
content: [
|
|
161
|
-
{
|
|
162
|
-
type: "text",
|
|
163
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
isError: true,
|
|
167
|
-
};
|
|
112
|
+
return formatMcpError(error);
|
|
168
113
|
}
|
|
169
114
|
});
|
|
170
115
|
server.tool("list_contact_conversations", "list all conversations for a specific contact. requires read scope.", {
|
|
@@ -175,15 +120,7 @@ export function registerContactTools(server, client) {
|
|
|
175
120
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
176
121
|
}
|
|
177
122
|
catch (error) {
|
|
178
|
-
return
|
|
179
|
-
content: [
|
|
180
|
-
{
|
|
181
|
-
type: "text",
|
|
182
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
isError: true,
|
|
186
|
-
};
|
|
123
|
+
return formatMcpError(error);
|
|
187
124
|
}
|
|
188
125
|
});
|
|
189
126
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
2
3
|
const CONVERSATION_STATUSES = ["active", "completed", "failed", "human_review"];
|
|
3
4
|
export function registerConversationTools(server, client) {
|
|
4
5
|
server.tool("list_conversations", "list conversations with optional filtering. requires read scope.", {
|
|
@@ -21,15 +22,7 @@ export function registerConversationTools(server, client) {
|
|
|
21
22
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
22
23
|
}
|
|
23
24
|
catch (error) {
|
|
24
|
-
return
|
|
25
|
-
content: [
|
|
26
|
-
{
|
|
27
|
-
type: "text",
|
|
28
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
isError: true,
|
|
32
|
-
};
|
|
25
|
+
return formatMcpError(error);
|
|
33
26
|
}
|
|
34
27
|
});
|
|
35
28
|
server.tool("get_conversation", "get a conversation by ID with contact and campaign details. requires read scope.", {
|
|
@@ -40,15 +33,7 @@ export function registerConversationTools(server, client) {
|
|
|
40
33
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
41
34
|
}
|
|
42
35
|
catch (error) {
|
|
43
|
-
return
|
|
44
|
-
content: [
|
|
45
|
-
{
|
|
46
|
-
type: "text",
|
|
47
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
isError: true,
|
|
51
|
-
};
|
|
36
|
+
return formatMcpError(error);
|
|
52
37
|
}
|
|
53
38
|
});
|
|
54
39
|
server.tool("get_conversation_messages", "get all messages in a conversation. requires read scope.", {
|
|
@@ -59,15 +44,7 @@ export function registerConversationTools(server, client) {
|
|
|
59
44
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
60
45
|
}
|
|
61
46
|
catch (error) {
|
|
62
|
-
return
|
|
63
|
-
content: [
|
|
64
|
-
{
|
|
65
|
-
type: "text",
|
|
66
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
isError: true,
|
|
70
|
-
};
|
|
47
|
+
return formatMcpError(error);
|
|
71
48
|
}
|
|
72
49
|
});
|
|
73
50
|
server.tool("mark_conversation_read", "mark a conversation as read. requires write scope.", {
|
|
@@ -78,15 +55,7 @@ export function registerConversationTools(server, client) {
|
|
|
78
55
|
return { content: [{ type: "text", text: `conversation ${id} marked as read` }] };
|
|
79
56
|
}
|
|
80
57
|
catch (error) {
|
|
81
|
-
return
|
|
82
|
-
content: [
|
|
83
|
-
{
|
|
84
|
-
type: "text",
|
|
85
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
isError: true,
|
|
89
|
-
};
|
|
58
|
+
return formatMcpError(error);
|
|
90
59
|
}
|
|
91
60
|
});
|
|
92
61
|
server.tool("get_engagement_metrics", "get overall engagement metrics across all conversations. requires read scope.", {}, async () => {
|
|
@@ -95,15 +64,7 @@ export function registerConversationTools(server, client) {
|
|
|
95
64
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
96
65
|
}
|
|
97
66
|
catch (error) {
|
|
98
|
-
return
|
|
99
|
-
content: [
|
|
100
|
-
{
|
|
101
|
-
type: "text",
|
|
102
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
isError: true,
|
|
106
|
-
};
|
|
67
|
+
return formatMcpError(error);
|
|
107
68
|
}
|
|
108
69
|
});
|
|
109
70
|
}
|
package/dist/tools/discovery.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
2
3
|
const DISCOVERY_SOURCES = ["google_maps", "instagram", "twitter", "tiktok", "reddit"];
|
|
3
4
|
const PROFILE_TYPES = [
|
|
4
5
|
"local_business",
|
|
@@ -49,15 +50,7 @@ export function registerDiscoveryTools(server, client) {
|
|
|
49
50
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
50
51
|
}
|
|
51
52
|
catch (error) {
|
|
52
|
-
return
|
|
53
|
-
content: [
|
|
54
|
-
{
|
|
55
|
-
type: "text",
|
|
56
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
isError: true,
|
|
60
|
-
};
|
|
53
|
+
return formatMcpError(error);
|
|
61
54
|
}
|
|
62
55
|
});
|
|
63
56
|
server.tool("search_campaign_contacts", "search for contacts matching a campaign's target profiles. requires generate scope.", {
|
|
@@ -69,15 +62,7 @@ export function registerDiscoveryTools(server, client) {
|
|
|
69
62
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
70
63
|
}
|
|
71
64
|
catch (error) {
|
|
72
|
-
return
|
|
73
|
-
content: [
|
|
74
|
-
{
|
|
75
|
-
type: "text",
|
|
76
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
isError: true,
|
|
80
|
-
};
|
|
65
|
+
return formatMcpError(error);
|
|
81
66
|
}
|
|
82
67
|
});
|
|
83
68
|
server.tool("get_discovery_job", "get the status, progress, and contacts of a discovery job. status values: pending, running, completed, failed. contacts populated only when status=completed. requires read scope.", {
|
|
@@ -88,15 +73,7 @@ export function registerDiscoveryTools(server, client) {
|
|
|
88
73
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
89
74
|
}
|
|
90
75
|
catch (error) {
|
|
91
|
-
return
|
|
92
|
-
content: [
|
|
93
|
-
{
|
|
94
|
-
type: "text",
|
|
95
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
isError: true,
|
|
99
|
-
};
|
|
76
|
+
return formatMcpError(error);
|
|
100
77
|
}
|
|
101
78
|
});
|
|
102
79
|
server.tool("list_discovery_sources", "list available discovery data sources and their status. requires read scope.", {}, async () => {
|
|
@@ -105,15 +82,7 @@ export function registerDiscoveryTools(server, client) {
|
|
|
105
82
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
106
83
|
}
|
|
107
84
|
catch (error) {
|
|
108
|
-
return
|
|
109
|
-
content: [
|
|
110
|
-
{
|
|
111
|
-
type: "text",
|
|
112
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
isError: true,
|
|
116
|
-
};
|
|
85
|
+
return formatMcpError(error);
|
|
117
86
|
}
|
|
118
87
|
});
|
|
119
88
|
}
|
package/dist/tools/keys.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
2
3
|
// Five-verb scope vocabulary. iris uses soft-deletes everywhere, so DELETE
|
|
3
4
|
// routes gate on `write` — there is no separate `delete` scope.
|
|
4
5
|
//
|
|
@@ -15,12 +16,7 @@ export function registerKeyTools(server, client) {
|
|
|
15
16
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
16
17
|
}
|
|
17
18
|
catch (error) {
|
|
18
|
-
return
|
|
19
|
-
content: [
|
|
20
|
-
{ type: "text", text: `error: ${error instanceof Error ? error.message : String(error)}` },
|
|
21
|
-
],
|
|
22
|
-
isError: true,
|
|
23
|
-
};
|
|
19
|
+
return formatMcpError(error);
|
|
24
20
|
}
|
|
25
21
|
});
|
|
26
22
|
server.tool("list_api_keys", "list all API keys for the account. requires admin scope.", {
|
|
@@ -37,15 +33,7 @@ export function registerKeyTools(server, client) {
|
|
|
37
33
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38
34
|
}
|
|
39
35
|
catch (error) {
|
|
40
|
-
return
|
|
41
|
-
content: [
|
|
42
|
-
{
|
|
43
|
-
type: "text",
|
|
44
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
isError: true,
|
|
48
|
-
};
|
|
36
|
+
return formatMcpError(error);
|
|
49
37
|
}
|
|
50
38
|
});
|
|
51
39
|
server.tool("create_api_key", "create a new API key. requires admin scope.", {
|
|
@@ -63,15 +51,7 @@ export function registerKeyTools(server, client) {
|
|
|
63
51
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
64
52
|
}
|
|
65
53
|
catch (error) {
|
|
66
|
-
return
|
|
67
|
-
content: [
|
|
68
|
-
{
|
|
69
|
-
type: "text",
|
|
70
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
isError: true,
|
|
74
|
-
};
|
|
54
|
+
return formatMcpError(error);
|
|
75
55
|
}
|
|
76
56
|
});
|
|
77
57
|
server.tool("revoke_api_key", "revoke (delete) an API key. requires admin scope.", {
|
|
@@ -82,15 +62,7 @@ export function registerKeyTools(server, client) {
|
|
|
82
62
|
return { content: [{ type: "text", text: `API key ${id} revoked` }] };
|
|
83
63
|
}
|
|
84
64
|
catch (error) {
|
|
85
|
-
return
|
|
86
|
-
content: [
|
|
87
|
-
{
|
|
88
|
-
type: "text",
|
|
89
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
isError: true,
|
|
93
|
-
};
|
|
65
|
+
return formatMcpError(error);
|
|
94
66
|
}
|
|
95
67
|
});
|
|
96
68
|
}
|
package/dist/tools/messages.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
2
3
|
export function registerMessageTools(server, client) {
|
|
3
4
|
server.tool("list_pending_messages", "list messages awaiting approval before sending. requires read scope.", {
|
|
4
5
|
page: z.number().int().positive().optional().describe("page number (default 1)"),
|
|
@@ -17,15 +18,7 @@ export function registerMessageTools(server, client) {
|
|
|
17
18
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
18
19
|
}
|
|
19
20
|
catch (error) {
|
|
20
|
-
return
|
|
21
|
-
content: [
|
|
22
|
-
{
|
|
23
|
-
type: "text",
|
|
24
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
isError: true,
|
|
28
|
-
};
|
|
21
|
+
return formatMcpError(error);
|
|
29
22
|
}
|
|
30
23
|
});
|
|
31
24
|
server.tool("approve_message", "approve a pending message for sending. requires send scope.", {
|
|
@@ -36,15 +29,7 @@ export function registerMessageTools(server, client) {
|
|
|
36
29
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
37
30
|
}
|
|
38
31
|
catch (error) {
|
|
39
|
-
return
|
|
40
|
-
content: [
|
|
41
|
-
{
|
|
42
|
-
type: "text",
|
|
43
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
isError: true,
|
|
47
|
-
};
|
|
32
|
+
return formatMcpError(error);
|
|
48
33
|
}
|
|
49
34
|
});
|
|
50
35
|
server.tool("reject_message", "reject a pending message with an optional reason. requires send scope.", {
|
|
@@ -56,15 +41,7 @@ export function registerMessageTools(server, client) {
|
|
|
56
41
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
57
42
|
}
|
|
58
43
|
catch (error) {
|
|
59
|
-
return
|
|
60
|
-
content: [
|
|
61
|
-
{
|
|
62
|
-
type: "text",
|
|
63
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
isError: true,
|
|
67
|
-
};
|
|
44
|
+
return formatMcpError(error);
|
|
68
45
|
}
|
|
69
46
|
});
|
|
70
47
|
server.tool("retry_message", "retry sending a failed message. requires send scope.", {
|
|
@@ -75,15 +52,7 @@ export function registerMessageTools(server, client) {
|
|
|
75
52
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
76
53
|
}
|
|
77
54
|
catch (error) {
|
|
78
|
-
return
|
|
79
|
-
content: [
|
|
80
|
-
{
|
|
81
|
-
type: "text",
|
|
82
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
isError: true,
|
|
86
|
-
};
|
|
55
|
+
return formatMcpError(error);
|
|
87
56
|
}
|
|
88
57
|
});
|
|
89
58
|
server.tool("submit_message_feedback", "submit feedback on an AI-generated message to improve future generations. requires send scope.", {
|
|
@@ -95,15 +64,7 @@ export function registerMessageTools(server, client) {
|
|
|
95
64
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
96
65
|
}
|
|
97
66
|
catch (error) {
|
|
98
|
-
return
|
|
99
|
-
content: [
|
|
100
|
-
{
|
|
101
|
-
type: "text",
|
|
102
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
isError: true,
|
|
106
|
-
};
|
|
67
|
+
return formatMcpError(error);
|
|
107
68
|
}
|
|
108
69
|
});
|
|
109
70
|
server.tool("bulk_message_action", "approve or reject multiple messages at once. requires send scope.", {
|
|
@@ -115,15 +76,7 @@ export function registerMessageTools(server, client) {
|
|
|
115
76
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
116
77
|
}
|
|
117
78
|
catch (error) {
|
|
118
|
-
return
|
|
119
|
-
content: [
|
|
120
|
-
{
|
|
121
|
-
type: "text",
|
|
122
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
isError: true,
|
|
126
|
-
};
|
|
79
|
+
return formatMcpError(error);
|
|
127
80
|
}
|
|
128
81
|
});
|
|
129
82
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
2
3
|
export function registerNotificationTools(server, client) {
|
|
3
4
|
server.tool("list_notifications", "list user notifications. requires read scope.", {
|
|
4
5
|
page: z.number().int().positive().optional().describe("page number (default 1)"),
|
|
@@ -14,15 +15,7 @@ export function registerNotificationTools(server, client) {
|
|
|
14
15
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
15
16
|
}
|
|
16
17
|
catch (error) {
|
|
17
|
-
return
|
|
18
|
-
content: [
|
|
19
|
-
{
|
|
20
|
-
type: "text",
|
|
21
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
isError: true,
|
|
25
|
-
};
|
|
18
|
+
return formatMcpError(error);
|
|
26
19
|
}
|
|
27
20
|
});
|
|
28
21
|
server.tool("update_notification", "update a notification (e.g., mark as read). requires write scope.", {
|
|
@@ -34,15 +27,7 @@ export function registerNotificationTools(server, client) {
|
|
|
34
27
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
35
28
|
}
|
|
36
29
|
catch (error) {
|
|
37
|
-
return
|
|
38
|
-
content: [
|
|
39
|
-
{
|
|
40
|
-
type: "text",
|
|
41
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
isError: true,
|
|
45
|
-
};
|
|
30
|
+
return formatMcpError(error);
|
|
46
31
|
}
|
|
47
32
|
});
|
|
48
33
|
server.tool("delete_notification", "delete a notification. requires write scope.", {
|
|
@@ -53,15 +38,7 @@ export function registerNotificationTools(server, client) {
|
|
|
53
38
|
return { content: [{ type: "text", text: `notification ${id} deleted` }] };
|
|
54
39
|
}
|
|
55
40
|
catch (error) {
|
|
56
|
-
return
|
|
57
|
-
content: [
|
|
58
|
-
{
|
|
59
|
-
type: "text",
|
|
60
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
isError: true,
|
|
64
|
-
};
|
|
41
|
+
return formatMcpError(error);
|
|
65
42
|
}
|
|
66
43
|
});
|
|
67
44
|
server.tool("mark_all_notifications_read", "mark all notifications as read. requires write scope.", {}, async () => {
|
|
@@ -70,15 +47,7 @@ export function registerNotificationTools(server, client) {
|
|
|
70
47
|
return { content: [{ type: "text", text: "all notifications marked as read" }] };
|
|
71
48
|
}
|
|
72
49
|
catch (error) {
|
|
73
|
-
return
|
|
74
|
-
content: [
|
|
75
|
-
{
|
|
76
|
-
type: "text",
|
|
77
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
isError: true,
|
|
81
|
-
};
|
|
50
|
+
return formatMcpError(error);
|
|
82
51
|
}
|
|
83
52
|
});
|
|
84
53
|
}
|
package/dist/tools/webhooks.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { formatMcpError } from "../cli-utils.js";
|
|
2
3
|
// Mirrors WEBHOOK_EVENTS in src/lib/api/webhooks/events.ts (server-side source of truth).
|
|
3
4
|
// Keep in sync — anything not on this list is rejected by validateWebhookEvents at the route layer.
|
|
4
5
|
const WEBHOOK_EVENTS = [
|
|
@@ -34,15 +35,7 @@ export function registerWebhookTools(server, client) {
|
|
|
34
35
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
35
36
|
}
|
|
36
37
|
catch (error) {
|
|
37
|
-
return
|
|
38
|
-
content: [
|
|
39
|
-
{
|
|
40
|
-
type: "text",
|
|
41
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
isError: true,
|
|
45
|
-
};
|
|
38
|
+
return formatMcpError(error);
|
|
46
39
|
}
|
|
47
40
|
});
|
|
48
41
|
server.tool("create_webhook", "create a new webhook endpoint. requires admin scope.", {
|
|
@@ -59,15 +52,7 @@ export function registerWebhookTools(server, client) {
|
|
|
59
52
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
60
53
|
}
|
|
61
54
|
catch (error) {
|
|
62
|
-
return
|
|
63
|
-
content: [
|
|
64
|
-
{
|
|
65
|
-
type: "text",
|
|
66
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
isError: true,
|
|
70
|
-
};
|
|
55
|
+
return formatMcpError(error);
|
|
71
56
|
}
|
|
72
57
|
});
|
|
73
58
|
server.tool("get_webhook", "get a webhook by ID. requires admin scope.", {
|
|
@@ -78,15 +63,7 @@ export function registerWebhookTools(server, client) {
|
|
|
78
63
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
79
64
|
}
|
|
80
65
|
catch (error) {
|
|
81
|
-
return
|
|
82
|
-
content: [
|
|
83
|
-
{
|
|
84
|
-
type: "text",
|
|
85
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
isError: true,
|
|
89
|
-
};
|
|
66
|
+
return formatMcpError(error);
|
|
90
67
|
}
|
|
91
68
|
});
|
|
92
69
|
server.tool("update_webhook", "update a webhook's configuration. requires admin scope.", {
|
|
@@ -105,15 +82,7 @@ export function registerWebhookTools(server, client) {
|
|
|
105
82
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
106
83
|
}
|
|
107
84
|
catch (error) {
|
|
108
|
-
return
|
|
109
|
-
content: [
|
|
110
|
-
{
|
|
111
|
-
type: "text",
|
|
112
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
isError: true,
|
|
116
|
-
};
|
|
85
|
+
return formatMcpError(error);
|
|
117
86
|
}
|
|
118
87
|
});
|
|
119
88
|
server.tool("delete_webhook", "delete a webhook. requires admin scope.", {
|
|
@@ -124,15 +93,7 @@ export function registerWebhookTools(server, client) {
|
|
|
124
93
|
return { content: [{ type: "text", text: `webhook ${id} deleted` }] };
|
|
125
94
|
}
|
|
126
95
|
catch (error) {
|
|
127
|
-
return
|
|
128
|
-
content: [
|
|
129
|
-
{
|
|
130
|
-
type: "text",
|
|
131
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
isError: true,
|
|
135
|
-
};
|
|
96
|
+
return formatMcpError(error);
|
|
136
97
|
}
|
|
137
98
|
});
|
|
138
99
|
server.tool("test_webhook", "send a test event to a webhook endpoint to verify it's working. requires admin scope.", {
|
|
@@ -143,15 +104,7 @@ export function registerWebhookTools(server, client) {
|
|
|
143
104
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
144
105
|
}
|
|
145
106
|
catch (error) {
|
|
146
|
-
return
|
|
147
|
-
content: [
|
|
148
|
-
{
|
|
149
|
-
type: "text",
|
|
150
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
isError: true,
|
|
154
|
-
};
|
|
107
|
+
return formatMcpError(error);
|
|
155
108
|
}
|
|
156
109
|
});
|
|
157
110
|
server.tool("rotate_webhook_secret", "rotate the signing secret for a webhook. the new secret is returned in the response. the old secret is invalidated immediately — receivers must update their HMAC verification before the next delivery. requires admin scope.", {
|
|
@@ -162,15 +115,7 @@ export function registerWebhookTools(server, client) {
|
|
|
162
115
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
163
116
|
}
|
|
164
117
|
catch (error) {
|
|
165
|
-
return
|
|
166
|
-
content: [
|
|
167
|
-
{
|
|
168
|
-
type: "text",
|
|
169
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
isError: true,
|
|
173
|
-
};
|
|
118
|
+
return formatMcpError(error);
|
|
174
119
|
}
|
|
175
120
|
});
|
|
176
121
|
server.tool("list_webhook_deliveries", "list delivery history for a webhook. requires admin scope.", {
|
|
@@ -188,15 +133,7 @@ export function registerWebhookTools(server, client) {
|
|
|
188
133
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
189
134
|
}
|
|
190
135
|
catch (error) {
|
|
191
|
-
return
|
|
192
|
-
content: [
|
|
193
|
-
{
|
|
194
|
-
type: "text",
|
|
195
|
-
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
isError: true,
|
|
199
|
-
};
|
|
136
|
+
return formatMcpError(error);
|
|
200
137
|
}
|
|
201
138
|
});
|
|
202
139
|
}
|