@anychat-ai/mcp 0.1.1 → 0.2.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.
@@ -11,45 +11,27 @@ const tool_1 = require("../tool");
11
11
  * (2026-08-09) — instruction blocks now live on each Playbook as
12
12
  * `procedures[]`.
13
13
  */
14
- const agentId = zod_1.z
15
- .string()
16
- .min(1)
17
- .describe('Agent id (the friendly agent id, e.g. "acme-sales-bot")');
18
- const templateIdArg = (kind, example) => zod_1.z
19
- .string()
20
- .min(1)
21
- .describe(`Catalog ${kind} template id, e.g. "${example}". Discover ids with the catalog tools.`);
14
+ const agentId = zod_1.z.string().min(1);
15
+ const templateIdArg = (kind, example) => zod_1.z.string().min(1).describe(`Catalog ${kind} template id, e.g. "${example}"`);
22
16
  const derivedFrom = zod_1.z
23
17
  .object({
24
- templateId: zod_1.z.string().describe('Catalog template id this content was imported from'),
25
- version: zod_1.z.string().describe('Template version at import time'),
18
+ templateId: zod_1.z.string(),
19
+ version: zod_1.z.string(),
26
20
  })
27
21
  .optional()
28
- .describe('Provenance pointer for template-derived content (normally left to the API)');
22
+ .describe('Template provenance; set by import — normally omit');
29
23
  // ---------------------------------------------------------------------------
30
24
  // Identity
31
25
  // ---------------------------------------------------------------------------
32
26
  const identityFields = {
33
- smallLogoUrl: zod_1.z.string().nullable().optional().describe('URL of the small/square logo'),
34
- largeBannerUrl: zod_1.z
35
- .string()
36
- .nullable()
37
- .optional()
38
- .describe('URL of the wide banner image'),
39
- brandColor: zod_1.z
40
- .string()
41
- .nullable()
42
- .optional()
43
- .describe('Brand color as hex, e.g. "#1a73e8"'),
44
- contactEmail: zod_1.z.string().nullable().optional().describe('Business contact email'),
45
- contactPhone: zod_1.z
46
- .string()
47
- .nullable()
48
- .optional()
49
- .describe('Business contact phone (E.164)'),
50
- websiteUrl: zod_1.z.string().nullable().optional().describe('Business website URL'),
51
- privacyPolicyUrl: zod_1.z.string().nullable().optional().describe('Privacy policy URL'),
52
- termsOfServiceUrl: zod_1.z.string().nullable().optional().describe('Terms of service URL'),
27
+ smallLogoUrl: zod_1.z.string().nullable().optional().describe('Small/square logo URL'),
28
+ largeBannerUrl: zod_1.z.string().nullable().optional().describe('Wide banner image URL'),
29
+ brandColor: zod_1.z.string().nullable().optional().describe('Hex, e.g. "#1a73e8"'),
30
+ contactEmail: zod_1.z.string().nullable().optional(),
31
+ contactPhone: zod_1.z.string().nullable().optional().describe('E.164'),
32
+ websiteUrl: zod_1.z.string().nullable().optional(),
33
+ privacyPolicyUrl: zod_1.z.string().nullable().optional(),
34
+ termsOfServiceUrl: zod_1.z.string().nullable().optional(),
53
35
  contactAvailability: zod_1.z
54
36
  .string()
55
37
  .nullable()
@@ -59,22 +41,18 @@ const identityFields = {
59
41
  .string()
60
42
  .nullable()
61
43
  .optional()
62
- .describe('Short agent-level "who is talking" line composed into every system prompt, e.g. "You are Acme Corp\'s sales development agent." Behavior lives in the Default Playbook, not here.'),
44
+ .describe('Short "who is talking" line in every system prompt, e.g. "You are Acme Corp\'s sales development agent." Behavior belongs in the Default Playbook.'),
63
45
  };
64
46
  // ---------------------------------------------------------------------------
65
47
  // Objectives
66
48
  // ---------------------------------------------------------------------------
67
49
  const objectiveItem = zod_1.z
68
50
  .object({
69
- id: zod_1.z.string().describe('Short slug, unique within the agent, e.g. "qualify-lead"'),
70
- name: zod_1.z.string().describe('Display name'),
71
- description: zod_1.z
72
- .string()
73
- .optional()
74
- .describe('Human-readable summary (operator-facing)'),
75
- body: zod_1.z.string().describe('The prompt fragment the agent uses (LLM-facing)'),
76
- priority: zod_1.z.number().describe('Rank; lower wins when objectives compete on a turn'),
77
- derivedFrom,
51
+ id: zod_1.z.string().describe('Slug, unique within the agent, e.g. "qualify-lead"'),
52
+ name: zod_1.z.string(),
53
+ description: zod_1.z.string().optional().describe('Operator-facing summary'),
54
+ body: zod_1.z.string().describe('LLM-facing prompt fragment'),
55
+ priority: zod_1.z.number().describe('Rank; lower wins when objectives compete'),
78
56
  })
79
57
  .passthrough();
80
58
  // ---------------------------------------------------------------------------
@@ -82,14 +60,8 @@ const objectiveItem = zod_1.z
82
60
  // ---------------------------------------------------------------------------
83
61
  const guardrailListOp = zod_1.z
84
62
  .object({
85
- add: zod_1.z
86
- .array(zod_1.z.string())
87
- .optional()
88
- .describe('Strings to append (deduplicated against the current list)'),
89
- remove: zod_1.z
90
- .array(zod_1.z.string())
91
- .optional()
92
- .describe('Strings to remove (case-sensitive exact match)'),
63
+ add: zod_1.z.array(zod_1.z.string()).optional().describe('Append (deduplicated)'),
64
+ remove: zod_1.z.array(zod_1.z.string()).optional().describe('Remove (exact match)'),
93
65
  })
94
66
  .optional();
95
67
  // ---------------------------------------------------------------------------
@@ -100,39 +72,32 @@ const playbookOutreach = zod_1.z
100
72
  eligible: zod_1.z
101
73
  .boolean()
102
74
  .optional()
103
- .describe('Offer this Playbook in the outreach send dialog (isOutbound: true implies eligibility)'),
75
+ .describe('Offer this Playbook in the outreach send dialog (implied by isOutbound)'),
104
76
  openingTemplateId: zod_1.z
105
77
  .string()
106
78
  .optional()
107
- .describe("Id of one of the agent's message templates sent as the deterministic opening when an outreach send selects this Playbook. Must reference an existing message template."),
79
+ .describe('Existing message template id sent as the deterministic opening'),
108
80
  exclusive: zod_1.z
109
81
  .boolean()
110
82
  .optional()
111
- .describe('Outreach-only: the runtime never offers it as a switch_playbook target; a conversation enters it only via an outreach send. Cannot be combined with isDefault.'),
83
+ .describe('Outreach-only: entered only via an outreach send, never by switch_playbook. Cannot be the default.'),
112
84
  })
113
85
  .describe('Playbook-first outreach binding');
114
86
  const playbookExamples = zod_1.z
115
87
  .array(zod_1.z.array(zod_1.z.object({
116
- role: zod_1.z.enum(['user', 'agent']).describe('Who is speaking'),
117
- content: zod_1.z.string().describe('Message text'),
88
+ role: zod_1.z.enum(['user', 'agent']),
89
+ content: zod_1.z.string(),
118
90
  })))
119
91
  .optional()
120
- .describe('Example exchanges — an array of conversations, each an array of turns');
92
+ .describe('Example conversations, each an array of turns');
121
93
  const playbookProcedure = zod_1.z
122
94
  .object({
123
- id: zod_1.z.string().describe('Short slug, unique within the Playbook'),
124
- name: zod_1.z.string().describe('Display name'),
95
+ id: zod_1.z.string().describe('Slug, unique within the Playbook'),
96
+ name: zod_1.z.string(),
125
97
  description: zod_1.z.string().optional().describe('Operator-facing summary'),
126
98
  body: zod_1.z.string().describe('LLM-facing instruction block'),
127
- requiredTools: zod_1.z
128
- .array(zod_1.z.string())
129
- .optional()
130
- .describe('Capability actions (catalog tool ids) the procedure uses'),
131
- config: zod_1.z
132
- .record(zod_1.z.string(), zod_1.z.any())
133
- .optional()
134
- .describe('Procedure-specific configuration'),
135
- derivedFrom,
99
+ requiredTools: zod_1.z.array(zod_1.z.string()).optional().describe('Catalog tool ids it uses'),
100
+ config: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
136
101
  })
137
102
  .passthrough();
138
103
  const playbookContentFields = {
@@ -140,58 +105,57 @@ const playbookContentFields = {
140
105
  whenToUse: zod_1.z
141
106
  .string()
142
107
  .optional()
143
- .describe('LLM-facing activation context — when the runtime should switch into this Playbook'),
108
+ .describe('LLM-facing activation context — when to switch into this Playbook'),
144
109
  examples: playbookExamples,
145
- toolRefs: zod_1.z
146
- .array(zod_1.z.string())
147
- .optional()
148
- .describe('Catalog tool ids this Playbook may invoke'),
110
+ toolRefs: zod_1.z.array(zod_1.z.string()).optional().describe('Catalog tool ids it may invoke'),
149
111
  messageTemplateRefs: zod_1.z
150
112
  .array(zod_1.z.string())
151
113
  .optional()
152
- .describe('Ids of message templates this Playbook may deploy'),
114
+ .describe('Message template ids it may deploy'),
153
115
  isDefault: zod_1.z
154
116
  .boolean()
155
117
  .optional()
156
- .describe('Make this the Default Playbook (exactly one per agent — setting true clears the previous default). Prefer set_default_playbook.'),
118
+ .describe('Make this the Default Playbook (exactly one per agent). Prefer set_default_playbook.'),
157
119
  isOutbound: zod_1.z
158
120
  .boolean()
159
121
  .optional()
160
- .describe('Make this the outreach default (at most one per agent — setting true clears the previous one)'),
122
+ .describe('Make this the outreach default (at most one per agent)'),
161
123
  };
162
124
  // ---------------------------------------------------------------------------
163
125
  // Message templates
164
126
  // ---------------------------------------------------------------------------
165
127
  const messageTemplateFields = {
166
- name: zod_1.z.string().min(1).describe('Display name'),
128
+ name: zod_1.z.string().min(1),
167
129
  description: zod_1.z.string().optional().describe('Operator-facing description'),
168
130
  body: zod_1.z
169
131
  .string()
170
- .describe('Message text with {slot} placeholders, e.g. "Hi {person.firstName | \\"there\\"} — thanks for stopping by {agent.companyName}." Slots read from person.* (firstName, lastName, fullName, email, phone, company, title, productInterest, source, customFields.<key>) and agent.* (name, companyName, companyDescription, contactEmail, contactPhone, websiteUrl). Inline fallback after a pipe: a quoted literal, or omit-sentence / omit-message / block-send. Bodies with unknown slots are rejected.'),
132
+ .describe('Text with {slot} placeholders, e.g. "Hi {person.firstName | \\"there\\"} — thanks for stopping by {agent.companyName}." Slots: person.* (firstName, lastName, fullName, email, phone, company, title, productInterest, source, customFields.<key>), agent.* (name, companyName, companyDescription, contactEmail, contactPhone, websiteUrl). Fallback after a pipe: quoted literal, omit-sentence, omit-message or block-send. Unknown slots are rejected.'),
171
133
  defaultOnMissingSlot: zod_1.z
172
134
  .enum(['omit-sentence', 'omit-message', 'block-send'])
173
135
  .optional()
174
- .describe('Policy for slots that are missing and have no inline fallback'),
136
+ .describe('Policy for missing slots without an inline fallback'),
175
137
  };
176
138
  exports.definitionTools = [
177
139
  // ---- Identity -----------------------------------------------------------
178
140
  (0, tool_1.defineTool)({
179
141
  name: 'get_identity',
180
142
  title: 'Get agent identity',
181
- description: "Read the agent's Identity — logos, brand color, contact email/phone, website, policy URLs, contact availability and the identityPreamble. This is the single source of truth for brand contact info and seeds new channel bindings. Maps to GET /v1/orgs/{org}/agents/{agent}/identity.",
143
+ description: "Read the agent's Identity — logos, brand color, contact email/phone, website, policy URLs, contact availability, identityPreamble. Source of truth for brand contact info; seeds new channel bindings. Maps to GET /v1/orgs/{org}/agents/{agent}/identity.",
182
144
  kind: 'read',
183
145
  scope: 'agents:read',
184
146
  roleFloor: 'viewer',
147
+ profile: 'core',
185
148
  input: { agentId },
186
149
  run: async ({ client }, { agentId }) => client.get(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/identity`)),
187
150
  }),
188
151
  (0, tool_1.defineTool)({
189
152
  name: 'update_identity',
190
153
  title: 'Update agent identity',
191
- description: 'Update only the Identity fields you send (others are left as-is; send null to clear a field). Returns the full identity. Edits do not propagate to existing channel bindings. Maps to PATCH /v1/orgs/{org}/agents/{agent}/identity.',
154
+ description: 'Update only the Identity fields you send (null clears a field). Returns the full identity. Does not propagate to existing channel bindings. Maps to PATCH /v1/orgs/{org}/agents/{agent}/identity.',
192
155
  kind: 'write',
193
156
  scope: 'agents:write',
194
157
  roleFloor: 'editor',
158
+ profile: 'core',
195
159
  input: { agentId, ...identityFields },
196
160
  run: async ({ client }, { agentId, ...body }) => client.patch(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/identity`), body),
197
161
  }),
@@ -203,20 +167,22 @@ exports.definitionTools = [
203
167
  kind: 'read',
204
168
  scope: 'agents:read',
205
169
  roleFloor: 'viewer',
170
+ profile: 'core',
206
171
  input: { agentId },
207
172
  run: async ({ client }, { agentId }) => client.get(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/personality`)),
208
173
  }),
209
174
  (0, tool_1.defineTool)({
210
175
  name: 'set_personality',
211
176
  title: 'Set agent personality',
212
- description: "Replace the agent's Personality wholesale (`text` is required; omitted fields are dropped). Read it first with get_personality if you only want to tweak wording. Returns the saved personality. Maps to PUT /v1/orgs/{org}/agents/{agent}/personality.",
177
+ description: "Replace the agent's Personality wholesale (`text` required; omitted fields dropped) — read first with get_personality to tweak wording. Maps to PUT /v1/orgs/{org}/agents/{agent}/personality.",
213
178
  kind: 'write',
214
179
  scope: 'agents:write',
215
180
  roleFloor: 'editor',
181
+ profile: 'core',
216
182
  input: {
217
183
  agentId,
218
- text: zod_1.z.string().describe('The prompt fragment the agent uses (voice and tone)'),
219
- description: zod_1.z.string().optional().describe('Human-readable summary'),
184
+ text: zod_1.z.string().describe('Voice/tone prompt fragment'),
185
+ description: zod_1.z.string().optional().describe('Operator-facing summary'),
220
186
  derivedFrom,
221
187
  },
222
188
  run: async ({ client }, { agentId, ...body }) => client.put(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/personality`), body),
@@ -224,7 +190,7 @@ exports.definitionTools = [
224
190
  (0, tool_1.defineTool)({
225
191
  name: 'import_personality_template',
226
192
  title: 'Import personality template',
227
- description: 'Copy a system Personality Template from the catalog onto the agent, replacing the current personality and stamping derivedFrom (edit freely afterward). Returns the imported personality. Maps to POST /v1/orgs/{org}/agents/{agent}/personality/import.',
193
+ description: 'Copy a catalog Personality Template onto the agent, replacing the current personality and stamping derivedFrom (edit freely afterward). Maps to POST /v1/orgs/{org}/agents/{agent}/personality/import.',
228
194
  kind: 'write',
229
195
  scope: 'templates:apply',
230
196
  roleFloor: 'editor',
@@ -238,42 +204,39 @@ exports.definitionTools = [
238
204
  (0, tool_1.defineTool)({
239
205
  name: 'get_objectives',
240
206
  title: 'Get agent objectives',
241
- description: "List the agent's Objectives — ranked SMART-style goals ({ id, name, description?, body, priority, derivedFrom? }; lower priority wins). Returns { data: AgentObjective[] }. Maps to GET /v1/orgs/{org}/agents/{agent}/objectives.",
207
+ description: "List the agent's Objectives — ranked goals { id, name, description?, body, priority, derivedFrom? } (lower priority wins). Maps to GET /v1/orgs/{org}/agents/{agent}/objectives.",
242
208
  kind: 'read',
243
209
  scope: 'agents:read',
244
210
  roleFloor: 'viewer',
211
+ profile: 'core',
245
212
  input: { agentId },
246
213
  run: async ({ client }, { agentId }) => client.get(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/objectives`)),
247
214
  }),
248
215
  (0, tool_1.defineTool)({
249
216
  name: 'set_objectives',
250
217
  title: 'Set agent objectives',
251
- description: 'Replace the full Objectives list — send every objective you want to keep (read with get_objectives first; anything omitted is removed). Use this to add, edit, reorder or delete objectives. Returns { data: AgentObjective[] }. Maps to PUT /v1/orgs/{org}/agents/{agent}/objectives.',
218
+ description: 'Replace the full Objectives list — send every objective to keep (read with get_objectives first; omitted ones are removed). Use to add, edit, reorder or delete. Maps to PUT /v1/orgs/{org}/agents/{agent}/objectives.',
252
219
  kind: 'write',
253
220
  scope: 'agents:write',
254
221
  roleFloor: 'editor',
222
+ profile: 'core',
255
223
  input: {
256
224
  agentId,
257
- objectives: zod_1.z
258
- .array(objectiveItem)
259
- .describe('The complete ordered list of objectives for the agent'),
225
+ objectives: zod_1.z.array(objectiveItem).describe('Complete ordered list'),
260
226
  },
261
227
  run: async ({ client }, { agentId, objectives }) => client.put(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/objectives`), { objectives }),
262
228
  }),
263
229
  (0, tool_1.defineTool)({
264
230
  name: 'import_objective_template',
265
231
  title: 'Import objective template',
266
- description: 'Append one objective derived from a system Objective Template in the catalog (re-importing the same template replaces that objective in place). `priority` defaults to end of list + 1. Returns { data: AgentObjective[] }. Maps to POST /v1/orgs/{org}/agents/{agent}/objectives/import.',
232
+ description: 'Append one objective from a catalog Objective Template (re-importing the same template replaces that objective in place). Returns the full list. Maps to POST /v1/orgs/{org}/agents/{agent}/objectives/import.',
267
233
  kind: 'write',
268
234
  scope: 'templates:apply',
269
235
  roleFloor: 'editor',
270
236
  input: {
271
237
  agentId,
272
238
  templateId: templateIdArg('objective', '@anychat/objective-template.qualify-lead'),
273
- priority: zod_1.z
274
- .number()
275
- .optional()
276
- .describe('Priority for the imported objective (lower wins); default end of list + 1'),
239
+ priority: zod_1.z.number().optional().describe('Lower wins; default end of list + 1'),
277
240
  },
278
241
  run: async ({ client }, { agentId, templateId, priority }) => client.post(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/objectives/import`), priority === undefined ? { templateId } : { templateId, priority }),
279
242
  }),
@@ -285,64 +248,54 @@ exports.definitionTools = [
285
248
  kind: 'read',
286
249
  scope: 'agents:read',
287
250
  roleFloor: 'viewer',
251
+ profile: 'core',
288
252
  input: { agentId },
289
253
  run: async ({ client }, { agentId }) => client.get(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/guardrails`)),
290
254
  }),
291
255
  (0, tool_1.defineTool)({
292
256
  name: 'set_guardrails',
293
257
  title: 'Set agent guardrails',
294
- description: 'Replace the Guardrails block wholesale — send every list you want to keep (read with get_guardrails first; omitted lists are cleared). For incremental add/remove prefer update_guardrails. Returns the saved guardrails. Maps to PUT /v1/orgs/{org}/agents/{agent}/guardrails.',
258
+ description: 'Replace the Guardrails wholesale — send every list to keep (omitted lists are cleared). For incremental add/remove prefer update_guardrails. Maps to PUT /v1/orgs/{org}/agents/{agent}/guardrails.',
295
259
  kind: 'write',
296
260
  scope: 'agents:write',
297
261
  roleFloor: 'editor',
262
+ profile: 'core',
298
263
  input: {
299
264
  agentId,
300
- topicsToAvoid: zod_1.z
301
- .array(zod_1.z.string())
302
- .optional()
303
- .describe('Topics the agent must not discuss'),
304
- claimsNotToMake: zod_1.z
305
- .array(zod_1.z.string())
306
- .optional()
307
- .describe('Claims the agent must never make'),
308
- requiredDisclaimers: zod_1.z
309
- .array(zod_1.z.string())
310
- .optional()
311
- .describe('Disclaimers the agent must include where relevant'),
312
- additionalRules: zod_1.z
313
- .string()
314
- .optional()
315
- .describe('Free-form hard rules that do not fit the lists'),
265
+ topicsToAvoid: zod_1.z.array(zod_1.z.string()).optional(),
266
+ claimsNotToMake: zod_1.z.array(zod_1.z.string()).optional(),
267
+ requiredDisclaimers: zod_1.z.array(zod_1.z.string()).optional(),
268
+ additionalRules: zod_1.z.string().optional().describe('Free-form hard rules'),
316
269
  derivedFromTemplates: zod_1.z
317
270
  .array(zod_1.z.string())
318
271
  .optional()
319
- .describe('Back-links to imported guardrail template ids (normally managed by import)'),
272
+ .describe('Imported guardrail template ids (normally managed by import)'),
320
273
  },
321
274
  run: async ({ client }, { agentId, ...body }) => client.put(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/guardrails`), body),
322
275
  }),
323
276
  (0, tool_1.defineTool)({
324
277
  name: 'update_guardrails',
325
278
  title: 'Update agent guardrails',
326
- description: 'Incrementally edit Guardrails: per list send { add?: string[], remove?: string[] } (adds dedupe; removes are exact-match), and/or set `additionalRules` to a new string. Lists you omit are untouched. Returns the saved guardrails. Maps to PATCH /v1/orgs/{org}/agents/{agent}/guardrails.',
279
+ description: 'Incrementally edit Guardrails: per list send { add?, remove? }, and/or set `additionalRules`. Omitted lists are untouched. Maps to PATCH /v1/orgs/{org}/agents/{agent}/guardrails.',
327
280
  kind: 'write',
328
281
  scope: 'agents:write',
329
282
  roleFloor: 'editor',
330
283
  input: {
331
284
  agentId,
332
- topicsToAvoid: guardrailListOp.describe('Add/remove operations for topicsToAvoid'),
333
- claimsNotToMake: guardrailListOp.describe('Add/remove operations for claimsNotToMake'),
334
- requiredDisclaimers: guardrailListOp.describe('Add/remove operations for requiredDisclaimers'),
285
+ topicsToAvoid: guardrailListOp,
286
+ claimsNotToMake: guardrailListOp,
287
+ requiredDisclaimers: guardrailListOp,
335
288
  additionalRules: zod_1.z
336
289
  .string()
337
290
  .optional()
338
- .describe('New value for the free-form rules (replaces the whole string; "" clears)'),
291
+ .describe('Replaces the whole string; "" clears'),
339
292
  },
340
293
  run: async ({ client }, { agentId, ...body }) => client.patch(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/guardrails`), body),
341
294
  }),
342
295
  (0, tool_1.defineTool)({
343
296
  name: 'import_guardrail_template',
344
297
  title: 'Import guardrail template',
345
- description: "Merge a system Guardrail Template from the catalog into the agent's existing lists (deduplicated, order preserved — import accumulates rather than replaces) and append the template id to derivedFromTemplates. Returns the saved guardrails. Maps to POST /v1/orgs/{org}/agents/{agent}/guardrails/import.",
298
+ description: "Merge a catalog Guardrail Template into the agent's lists (deduplicated, accumulates rather than replaces) and record it in derivedFromTemplates. Maps to POST /v1/orgs/{org}/agents/{agent}/guardrails/import.",
346
299
  kind: 'write',
347
300
  scope: 'templates:apply',
348
301
  roleFloor: 'editor',
@@ -356,40 +309,40 @@ exports.definitionTools = [
356
309
  (0, tool_1.defineTool)({
357
310
  name: 'list_playbooks',
358
311
  title: 'List playbooks',
359
- description: "List all of the agent's Playbooks (named modes of operation) with full bodies, procedures, flags and outreach binding. Exactly one has isDefault: true and at most one isOutbound: true. Returns { data: AgentPlaybook[] }. Maps to GET /v1/orgs/{org}/agents/{agent}/playbooks.",
312
+ description: "List the agent's Playbooks (named modes of operation) with bodies, procedures, flags and outreach binding. Exactly one isDefault, at most one isOutbound. Maps to GET /v1/orgs/{org}/agents/{agent}/playbooks.",
360
313
  kind: 'read',
361
314
  scope: 'agents:read',
362
315
  roleFloor: 'viewer',
316
+ profile: 'core',
363
317
  input: { agentId },
364
318
  run: async ({ client }, { agentId }) => client.get(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/playbooks`)),
365
319
  }),
366
320
  (0, tool_1.defineTool)({
367
321
  name: 'get_playbook',
368
322
  title: 'Get playbook',
369
- description: 'Read one Playbook by id, including its body, whenToUse, examples, procedures[], toolRefs, messageTemplateRefs, isDefault/isOutbound and outreach binding. Maps to GET /v1/orgs/{org}/agents/{agent}/playbooks/{playbookId}.',
323
+ description: 'Read one Playbook: body, whenToUse, examples, procedures[], toolRefs, messageTemplateRefs, isDefault/isOutbound, outreach binding. Maps to GET /v1/orgs/{org}/agents/{agent}/playbooks/{playbookId}.',
370
324
  kind: 'read',
371
325
  scope: 'agents:read',
372
326
  roleFloor: 'viewer',
327
+ profile: 'core',
373
328
  input: {
374
329
  agentId,
375
- playbookId: zod_1.z.string().min(1).describe('Playbook id (short slug)'),
330
+ playbookId: zod_1.z.string().min(1),
376
331
  },
377
332
  run: async ({ client }, { agentId, playbookId }) => client.get(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/playbooks/${encodeURIComponent(playbookId)}`)),
378
333
  }),
379
334
  (0, tool_1.defineTool)({
380
335
  name: 'create_playbook',
381
336
  title: 'Create playbook',
382
- description: 'Create a new Playbook on the agent (id is slugified from name when omitted). Invariants are enforced on every write: exactly one Default Playbook, at most one outreach default (isOutbound); an outreach-exclusive Playbook cannot be the default. To add procedures[] use update_playbook after creating. Returns the created Playbook. Maps to POST /v1/orgs/{org}/agents/{agent}/playbooks.',
337
+ description: 'Create a Playbook (id slugified from name when omitted). Invariants: exactly one Default Playbook, at most one isOutbound; an outreach-exclusive Playbook cannot be default. Add procedures[] with update_playbook afterwards. Maps to POST /v1/orgs/{org}/agents/{agent}/playbooks.',
383
338
  kind: 'write',
384
339
  scope: 'agents:write',
385
340
  roleFloor: 'editor',
341
+ profile: 'core',
386
342
  input: {
387
343
  agentId,
388
- id: zod_1.z
389
- .string()
390
- .optional()
391
- .describe('Short slug for the Playbook; slugified from name when omitted'),
392
- name: zod_1.z.string().min(1).describe('Display name'),
344
+ id: zod_1.z.string().optional().describe('Slug; slugified from name when omitted'),
345
+ name: zod_1.z.string().min(1),
393
346
  body: zod_1.z.string().describe('LLM-facing instructional body'),
394
347
  ...playbookContentFields,
395
348
  outreach: playbookOutreach.optional(),
@@ -399,20 +352,21 @@ exports.definitionTools = [
399
352
  (0, tool_1.defineTool)({
400
353
  name: 'update_playbook',
401
354
  title: 'Update playbook',
402
- description: 'Update only the Playbook fields you send (PATCH semantics). Arrays (examples, procedures, toolRefs, messageTemplateRefs) are replaced whole when sent; `outreach` as an object replaces the binding, `outreach: null` clears it. Setting isDefault/isOutbound true moves that flag here (invariants enforced). Returns the updated Playbook. Maps to PATCH /v1/orgs/{org}/agents/{agent}/playbooks/{playbookId}.',
355
+ description: 'Update only the Playbook fields you send. Arrays (examples, procedures, toolRefs, messageTemplateRefs) are replaced whole; `outreach` object replaces the binding, null clears it. Setting isDefault/isOutbound true moves that flag here. Maps to PATCH /v1/orgs/{org}/agents/{agent}/playbooks/{playbookId}.',
403
356
  kind: 'write',
404
357
  scope: 'agents:write',
405
358
  roleFloor: 'editor',
359
+ profile: 'core',
406
360
  input: {
407
361
  agentId,
408
- playbookId: zod_1.z.string().min(1).describe('Playbook id (short slug)'),
409
- name: zod_1.z.string().min(1).optional().describe('Display name'),
362
+ playbookId: zod_1.z.string().min(1),
363
+ name: zod_1.z.string().min(1).optional(),
410
364
  body: zod_1.z.string().optional().describe('LLM-facing instructional body'),
411
365
  ...playbookContentFields,
412
366
  procedures: zod_1.z
413
367
  .array(playbookProcedure)
414
368
  .optional()
415
- .describe('Playbook-owned instruction blocks (replaces the whole list). Each needs id + name; body defaults to "".'),
369
+ .describe('Playbook-owned instruction blocks (replaces the whole list)'),
416
370
  outreach: playbookOutreach.nullable().optional(),
417
371
  },
418
372
  run: async ({ client }, { agentId, playbookId, ...body }) => client.patch(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/playbooks/${encodeURIComponent(playbookId)}`), body),
@@ -420,13 +374,14 @@ exports.definitionTools = [
420
374
  (0, tool_1.defineTool)({
421
375
  name: 'delete_playbook',
422
376
  title: 'Delete playbook',
423
- description: 'Delete a Playbook from the agent. Deleting the Default Playbook promotes the first remaining one to default; deleting the last one leaves the agent with no playbooks. Irreversible. Maps to DELETE /v1/orgs/{org}/agents/{agent}/playbooks/{playbookId}.',
377
+ description: 'Delete a Playbook. Deleting the Default promotes the first remaining one. Irreversible. Maps to DELETE /v1/orgs/{org}/agents/{agent}/playbooks/{playbookId}.',
424
378
  kind: 'destructive',
425
379
  scope: 'agents:write',
426
380
  roleFloor: 'editor',
381
+ profile: 'core',
427
382
  input: {
428
383
  agentId,
429
- playbookId: zod_1.z.string().min(1).describe('Playbook id (short slug)'),
384
+ playbookId: zod_1.z.string().min(1),
430
385
  },
431
386
  run: async ({ client }, { agentId, playbookId }) => {
432
387
  await client.delete(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/playbooks/${encodeURIComponent(playbookId)}`));
@@ -436,20 +391,21 @@ exports.definitionTools = [
436
391
  (0, tool_1.defineTool)({
437
392
  name: 'set_default_playbook',
438
393
  title: 'Set default playbook',
439
- description: "Atomically make this Playbook the agent's Default Playbook (clears isDefault on the others). Rejected for outreach-exclusive Playbooks. Returns the updated Playbook. Maps to POST /v1/orgs/{org}/agents/{agent}/playbooks/{playbookId}/_setDefault.",
394
+ description: "Atomically make this Playbook the agent's Default (clears isDefault on the others). Rejected for outreach-exclusive Playbooks. Maps to POST /v1/orgs/{org}/agents/{agent}/playbooks/{playbookId}/_setDefault.",
440
395
  kind: 'write',
441
396
  scope: 'agents:write',
442
397
  roleFloor: 'editor',
398
+ profile: 'core',
443
399
  input: {
444
400
  agentId,
445
- playbookId: zod_1.z.string().min(1).describe('Playbook id (short slug)'),
401
+ playbookId: zod_1.z.string().min(1),
446
402
  },
447
403
  run: async ({ client }, { agentId, playbookId }) => client.post(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/playbooks/${encodeURIComponent(playbookId)}/_setDefault`)),
448
404
  }),
449
405
  (0, tool_1.defineTool)({
450
406
  name: 'import_playbook_template',
451
407
  title: 'Import playbook template',
452
- description: 'Copy a catalog Playbook Template onto the agent (procedures materialized from the template, derivedFrom stamped; re-importing the same template replaces that Playbook in place, never as default). Returns the full { data: AgentPlaybook[] } list. Maps to POST /v1/orgs/{org}/agents/{agent}/playbooks/import.',
408
+ description: 'Copy a catalog Playbook Template onto the agent (procedures materialized, derivedFrom stamped; re-importing replaces that Playbook in place, never as default). Returns the full list. Maps to POST /v1/orgs/{org}/agents/{agent}/playbooks/import.',
453
409
  kind: 'write',
454
410
  scope: 'templates:apply',
455
411
  roleFloor: 'editor',
@@ -463,36 +419,36 @@ exports.definitionTools = [
463
419
  (0, tool_1.defineTool)({
464
420
  name: 'list_message_templates',
465
421
  title: 'List message templates',
466
- description: "List the agent's Message templates — operator-authored canned messages with {slot} placeholders, used as outreach greetings and playbook openings. Returns { data: AgentMessageTemplate[] }. Maps to GET /v1/orgs/{org}/agents/{agent}/message-templates.",
422
+ description: "List the agent's Message templates — canned messages with {slot} placeholders used as outreach greetings and playbook openings. Maps to GET /v1/orgs/{org}/agents/{agent}/message-templates.",
467
423
  kind: 'read',
468
424
  scope: 'agents:read',
469
425
  roleFloor: 'viewer',
426
+ profile: 'core',
470
427
  input: { agentId },
471
428
  run: async ({ client }, { agentId }) => client.get(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/message-templates`)),
472
429
  }),
473
430
  (0, tool_1.defineTool)({
474
431
  name: 'get_message_template',
475
432
  title: 'Get message template',
476
- description: 'Read one Message template by id ({ id, name, description?, body, defaultOnMissingSlot? }). Maps to GET /v1/orgs/{org}/agents/{agent}/message-templates/{templateId}.',
433
+ description: 'Read one Message template ({ id, name, description?, body, defaultOnMissingSlot? }). Maps to GET /v1/orgs/{org}/agents/{agent}/message-templates/{templateId}.',
477
434
  kind: 'read',
478
435
  scope: 'agents:read',
479
436
  roleFloor: 'viewer',
480
- input: { agentId, templateId: zod_1.z.string().min(1).describe('Message template id') },
437
+ profile: 'core',
438
+ input: { agentId, templateId: zod_1.z.string().min(1) },
481
439
  run: async ({ client }, { agentId, templateId }) => client.get(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/message-templates/${encodeURIComponent(templateId)}`)),
482
440
  }),
483
441
  (0, tool_1.defineTool)({
484
442
  name: 'upsert_message_template',
485
443
  title: 'Create or replace message template',
486
- description: "Create a Message template with a stable id you choose, or replace an existing one wholesale (name and body required; omitted optional fields are cleared). The body's slots are validated on write. Returns the saved template. Maps to PUT /v1/orgs/{org}/agents/{agent}/message-templates/{templateId}.",
444
+ description: 'Create a Message template with an id you choose, or replace an existing one wholesale (name and body required; omitted optional fields are cleared). Slots are validated on write. Maps to PUT /v1/orgs/{org}/agents/{agent}/message-templates/{templateId}.',
487
445
  kind: 'write',
488
446
  scope: 'agents:write',
489
447
  roleFloor: 'editor',
448
+ profile: 'core',
490
449
  input: {
491
450
  agentId,
492
- templateId: zod_1.z
493
- .string()
494
- .min(1)
495
- .describe('Message template id (short slug, e.g. "outreach-greeting")'),
451
+ templateId: zod_1.z.string().min(1).describe('Slug, e.g. "outreach-greeting"'),
496
452
  ...messageTemplateFields,
497
453
  },
498
454
  run: async ({ client }, { agentId, templateId, ...body }) => client.put(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/message-templates/${encodeURIComponent(templateId)}`), body),
@@ -500,11 +456,12 @@ exports.definitionTools = [
500
456
  (0, tool_1.defineTool)({
501
457
  name: 'delete_message_template',
502
458
  title: 'Delete message template',
503
- description: 'Delete a Message template from the agent. Playbooks or outreach config referencing it will no longer resolve their opening/greeting. Irreversible. Maps to DELETE /v1/orgs/{org}/agents/{agent}/message-templates/{templateId}.',
459
+ description: 'Delete a Message template. Playbooks or outreach config referencing it lose their opening/greeting. Irreversible. Maps to DELETE /v1/orgs/{org}/agents/{agent}/message-templates/{templateId}.',
504
460
  kind: 'destructive',
505
461
  scope: 'agents:write',
506
462
  roleFloor: 'editor',
507
- input: { agentId, templateId: zod_1.z.string().min(1).describe('Message template id') },
463
+ profile: 'core',
464
+ input: { agentId, templateId: zod_1.z.string().min(1) },
508
465
  run: async ({ client }, { agentId, templateId }) => {
509
466
  await client.delete(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/message-templates/${encodeURIComponent(templateId)}`));
510
467
  return { ok: true, deleted: templateId };
@@ -513,17 +470,14 @@ exports.definitionTools = [
513
470
  (0, tool_1.defineTool)({
514
471
  name: 'preview_message_template',
515
472
  title: 'Preview message template',
516
- description: 'Render a Message template against a real Person of this agent and return what would be sent: { renderedText (null when block-send fired), missingSlots[{ path, action }], blocked }. Sends nothing. Maps to GET /v1/orgs/{org}/agents/{agent}/message-templates/{templateId}/preview?personId=….',
473
+ description: 'Render a Message template against a real Person and return what would be sent: { renderedText (null when block-send fired), missingSlots[{ path, action }], blocked }. Sends nothing. Maps to GET /v1/orgs/{org}/agents/{agent}/message-templates/{templateId}/preview?personId=….',
517
474
  kind: 'read',
518
475
  scope: 'agents:read',
519
476
  roleFloor: 'viewer',
520
477
  input: {
521
478
  agentId,
522
- templateId: zod_1.z.string().min(1).describe('Message template id'),
523
- personId: zod_1.z
524
- .string()
525
- .min(1)
526
- .describe('Id of a Person belonging to this agent to render the slots from'),
479
+ templateId: zod_1.z.string().min(1),
480
+ personId: zod_1.z.string().min(1).describe('A Person of this agent to render slots from'),
527
481
  },
528
482
  run: async ({ client }, { agentId, templateId, personId }) => client.get(await client.orgPath(`/agents/${encodeURIComponent(agentId)}/message-templates/${encodeURIComponent(templateId)}/preview`), { personId }),
529
483
  }),