@ema.co/mcp-toolkit 2026.2.13 → 2026.2.23-1

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.

Potentially problematic release.


This version of @ema.co/mcp-toolkit might be problematic. Click here for more details.

Files changed (67) hide show
  1. package/.context/public/guides/ema-user-guide.md +12 -16
  2. package/.context/public/guides/mcp-tools-guide.md +203 -334
  3. package/dist/cli/index.js +2 -2
  4. package/dist/mcp/domain/loop-detection.js +89 -0
  5. package/dist/mcp/domain/sanitizer.js +1 -1
  6. package/dist/mcp/domain/structural-rules.js +4 -5
  7. package/dist/mcp/domain/validation-rules.js +5 -5
  8. package/dist/mcp/domain/workflow-graph.js +3 -5
  9. package/dist/mcp/domain/workflow-path-enumerator.js +7 -4
  10. package/dist/mcp/guidance.js +62 -29
  11. package/dist/mcp/handlers/debug/adapter.js +15 -0
  12. package/dist/mcp/handlers/debug/formatters.js +282 -0
  13. package/dist/mcp/handlers/debug/index.js +133 -0
  14. package/dist/mcp/handlers/demo/adapter.js +180 -0
  15. package/dist/mcp/handlers/env/config.js +2 -2
  16. package/dist/mcp/handlers/feedback/index.js +1 -1
  17. package/dist/mcp/handlers/index.js +0 -1
  18. package/dist/mcp/handlers/persona/adapter.js +135 -0
  19. package/dist/mcp/handlers/persona/index.js +237 -8
  20. package/dist/mcp/handlers/persona/schema.js +27 -0
  21. package/dist/mcp/handlers/reference/index.js +6 -4
  22. package/dist/mcp/handlers/sync/adapter.js +200 -0
  23. package/dist/mcp/handlers/workflow/adapter.js +174 -0
  24. package/dist/mcp/handlers/workflow/fix.js +11 -12
  25. package/dist/mcp/handlers/workflow/index.js +12 -40
  26. package/dist/mcp/handlers/workflow/validation.js +1 -1
  27. package/dist/mcp/knowledge-guidance-topics.js +615 -0
  28. package/dist/mcp/knowledge-types.js +7 -0
  29. package/dist/mcp/knowledge.js +75 -1403
  30. package/dist/mcp/resources-dynamic.js +2395 -0
  31. package/dist/mcp/resources-validation.js +408 -0
  32. package/dist/mcp/resources.js +72 -2508
  33. package/dist/mcp/server.js +69 -2825
  34. package/dist/mcp/tools.js +106 -5
  35. package/dist/sdk/client-adapter.js +265 -24
  36. package/dist/sdk/ema-client.js +100 -9
  37. package/dist/sdk/generated/agent-catalog.js +615 -0
  38. package/dist/sdk/generated/api-client/client/client.gen.js +3 -3
  39. package/dist/sdk/generated/api-client/client/index.js +5 -5
  40. package/dist/sdk/generated/api-client/client/utils.gen.js +4 -4
  41. package/dist/sdk/generated/api-client/client.gen.js +1 -1
  42. package/dist/sdk/generated/api-client/core/utils.gen.js +1 -1
  43. package/dist/sdk/generated/api-client/index.js +1 -1
  44. package/dist/sdk/generated/api-client/sdk.gen.js +2 -2
  45. package/dist/sdk/generated/well-known-types.js +99 -0
  46. package/dist/sdk/generated/widget-catalog.js +60 -0
  47. package/dist/sdk/grpc-client.js +115 -1
  48. package/dist/sync/sdk.js +2 -2
  49. package/dist/sync.js +4 -3
  50. package/docs/README.md +17 -9
  51. package/package.json +4 -3
  52. package/.context/public/guides/dashboard-operations.md +0 -349
  53. package/.context/public/guides/email-patterns.md +0 -125
  54. package/.context/public/guides/workflow-builder-patterns.md +0 -708
  55. package/dist/mcp/domain/intent-architect.js +0 -914
  56. package/dist/mcp/domain/quality-gates.js +0 -110
  57. package/dist/mcp/domain/workflow-execution-analyzer.js +0 -412
  58. package/dist/mcp/domain/workflow-intent.js +0 -1806
  59. package/dist/mcp/domain/workflow-merge.js +0 -449
  60. package/dist/mcp/domain/workflow-tracer.js +0 -648
  61. package/dist/mcp/domain/workflow-transformer.js +0 -742
  62. package/dist/mcp/handlers/knowledge/index.js +0 -54
  63. package/dist/mcp/handlers/persona/intent.js +0 -141
  64. package/dist/mcp/handlers/workflow/analyze.js +0 -119
  65. package/dist/mcp/handlers/workflow/compare.js +0 -70
  66. package/dist/mcp/handlers/workflow/generate.js +0 -384
  67. package/dist/mcp/handlers-consolidated.js +0 -333
@@ -1,67 +1,45 @@
1
1
  ---
2
- title: "Ema MCP Tools Guide (Consolidated)"
3
- date: 2026-01-27
2
+ title: "Ema MCP Tools Guide"
3
+ date: 2026-02-13
4
4
  audience: public
5
5
  ---
6
- # Ema MCP Tools Guide (Consolidated)
6
+ # Ema MCP Tools Guide
7
7
 
8
8
  This MCP server is intentionally designed for **LLM + agent ergonomics**:
9
9
 
10
10
  - **Self-contained guidance**: Server instructions, tool tips, and response hints are built-in
11
- - **Few tools, consistent shapes**: a small set of noun-based tools with predictable `mode` / flag patterns
11
+ - **Few tools, consistent shapes**: a small set of noun-based tools with predictable `method` / `mode` patterns
12
12
  - **Resources-first**: use `ema://...` resources for reference data/templates, then tools for actions
13
13
  - **Low ambiguity**: defaults are chosen to avoid "which of 5 similar tools?" confusion
14
- - **Explicit mode**: tools with multiple operations require explicit `mode` - they clarify if omitted
14
+ - **Explicit method/mode**: tools with multiple operations require explicit parameter - they clarify if omitted
15
15
 
16
16
  > **Note**: No external configuration files (like Cursor rules) are required. All guidance is embedded in the MCP server and delivered via server instructions, tool descriptions, and response tips.
17
17
 
18
18
  ## Tool names in MCP clients
19
19
 
20
- The server defines **base tool names** like `persona`, `template`.
20
+ The server defines **base tool names** like `persona`, `catalog`.
21
21
 
22
22
  Some clients show a **prefixed name** (for example Cursor: `mcp_ema_persona`). Always call **the tool name your client displays**; the semantics are the same.
23
23
 
24
- ## The tool set (7 active tools)
24
+ ## The tool set (6 public tools)
25
25
 
26
- | Tool | Purpose | Mode Required? |
27
- |------|---------|----------------|
28
- | `env` | List environments | No (single operation) |
29
- | `persona` | AI Employee management | **YES** |
30
- | `data` | Data management + document generation | **YES** |
31
- | `action` | Actions/agents lookup | No (flag-based) |
32
- | `template` | Patterns, widgets, questions | No (flag-based) |
33
- | `reference` | Envs, actions, templates, patterns, concepts, guidance | No (flag-based) |
34
- | `sync` | Sync across environments | **YES** |
35
-
36
- ### `workflow` tool (get/deploy only)
37
-
38
- | Mode | Purpose |
39
- |------|---------|
40
- | `get` | Returns workflow_def, schema, examples for LLM |
41
- | `deploy` | Deploys LLM-generated workflow_def |
26
+ | Tool | Purpose | Key Parameter |
27
+ |------|---------|---------------|
28
+ | `persona` | AI Employee management (CRUD, data, snapshots, sanitization) | `method` (required) |
29
+ | `catalog` | Browse platform catalog (actions, templates, widgets, voices, patterns, concepts) | `method` + `type` (required) |
30
+ | `workflow` | Get workflow data, validate, deploy LLM-generated workflows, optimize | `mode` (required) |
31
+ | `sync` | Sync personas between environments | `method` (required) |
32
+ | `env` | List available environments | No params |
33
+ | `toolkit_feedback` | Submit feedback about the toolkit | `method` (required) |
42
34
 
43
35
  **LLM does all thinking** (analyze, compare, generate). MCP only provides data and executes.
44
36
 
45
- ### Deprecated tools (still work, show warnings)
46
-
47
- | Tool | Status | Use Instead |
48
- |------|--------|-------------|
49
- | `knowledge` | Deprecated | `data` |
50
- | `demo` | Deprecated | `data` + `persona` |
51
-
52
- > **Tip**: For new code, use `persona`, `data`, `workflow`, `sync`.
53
-
54
- ## ⚠️ THE KEY INSIGHT: ONE CALL
37
+ ## THE KEY INSIGHT: ONE CALL
55
38
 
56
39
  Creating an AI Employee should be **ONE `persona()` call**, not multiple calls.
57
40
 
58
- ```typescript
59
- persona(
60
- input="Voice AI SDR: qualifies leads, identifies use-case, sends follow-up email",
61
- type="voice",
62
- name="Sales SDR",
63
- preview=false
64
- )
41
+ ```
42
+ persona(method="create", name="Sales SDR", type="voice")
65
43
  ```
66
44
 
67
45
  **MCP handles internally:** template selection, config generation, widget formatting, API orchestration.
@@ -70,77 +48,46 @@ persona(
70
48
 
71
49
  ### Create a new AI Employee (greenfield)
72
50
 
73
- 1. **Get qualifying questions from MCP**: `template(questions=true)`
74
- 2. **Ask user those questions**
51
+ 1. **Browse templates**: `catalog(method="list", type="templates")`
52
+ 2. **Ask user qualifying questions**
75
53
  3. **Create in ONE call**:
76
- ```typescript
77
- persona(
78
- input="<everything from user answers>",
79
- name="My AI Employee",
80
- type="voice",
81
- preview=false
82
- )
83
54
  ```
84
-
85
- ### Complex Workflows (email, HITL, multi-intent)
86
-
87
- For complex workflows, MCP returns `status: "needs_llm_generation"` with a prompt you send to an LLM:
88
-
89
- ```typescript
90
- // Step 1: Request creation
91
- result = persona(
92
- input="SDR that qualifies leads and sends follow-up emails",
93
- type="voice",
94
- name="Sales SDR",
95
- preview=true
96
- )
97
-
98
- // If result.status === "needs_llm_generation":
99
- // Step 2: Send result.llm_prompt to an LLM (Claude, GPT-4, etc.)
100
- // Step 3: Deploy the LLM's workflow response
101
- persona(
102
- workflow_def=llm_response_json,
103
- name="Sales SDR",
104
- type="voice",
105
- preview=false
106
- )
107
- ```
108
-
109
- **Simple workflows** (basic Q&A, search + respond) deploy directly without this extra step.
55
+ persona(method="create", name="My AI Employee", type="voice")
56
+ ```
110
57
 
111
58
  ### Modify an existing AI Employee (brownfield)
112
59
 
113
- ```typescript
114
- // Optional: Understand what exists first
115
- persona(mode="get", id="abc-123")
60
+ ```
61
+ // Understand what exists first
62
+ persona(method="get", id="abc-123")
116
63
 
117
64
  // Modify config in ONE call
118
- persona(mode="update", id="abc-123", config={widgets: [{name: "conversationSettings", conversationSettings: {...}}]})
65
+ persona(method="update", id="abc-123", config={widgets: [{name: "conversationSettings", conversationSettings: {...}}]})
119
66
  ```
120
67
 
121
68
  ### Get workflow data (for LLM to analyze/modify)
122
69
 
123
- ```typescript
70
+ ```
124
71
  workflow(mode="get", persona_id="abc-123") // Returns workflow_def, schema, examples
125
72
  ```
126
73
 
127
74
  The LLM then analyzes/modifies the workflow and deploys:
128
75
 
129
- ```typescript
130
- workflow(mode="deploy", persona_id="abc-123", workflow_def={...}) // Deploy LLM's result
76
+ ```
77
+ workflow(mode="deploy", persona_id="abc-123", base_fingerprint="...", workflow_def={...})
131
78
  ```
132
79
 
133
80
  ### Upload / manage knowledge base documents
134
81
 
135
- 1. Upload: `data(persona_id="...", mode="upload", file="/path/to/file.pdf")`
136
- 2. Enable embedding: `data(persona_id="...", mode="embedding", enabled=true)`
137
- 3. Verify: `data(persona_id="...", mode="list")`
82
+ 1. Upload: `persona(id="abc", data={method:"upload", path:"/path/to/file.pdf"})`
83
+ 2. Enable embedding: `persona(id="abc", data={method:"embed", enabled:true})`
84
+ 3. Verify: `persona(id="abc", data={method:"stats"})`
138
85
 
139
86
  ### Clone and sanitize personas for demo
140
87
 
141
88
  **Recommended: Use action composition for multi-step operations**
142
89
 
143
- ```typescript
90
+ ```
144
91
  // Clone with data copy and sanitization (recommended)
145
92
  persona(
146
93
  method="create",
@@ -165,36 +112,22 @@ persona(method="create", from="source-id", name="Demo Clone", actions=["standard
165
112
 
166
113
  **Context variables:** `$source` (from param), `$target` (created persona ID), `$env` (environment)
167
114
 
168
- **Legacy syntax (still works):**
169
-
170
- ```typescript
171
- // Clone a persona with all data (files + dashboard rows for dashboard personas)
172
- // Note: Dashboard cloning auto-enables the persona (required for adding rows)
173
- persona(mode="clone", from="source-id", name="Demo Clone", include_data=true)
174
-
175
- // Clone with data sanitization (sanitizes both config and dashboard row data)
176
- persona(mode="clone", from="source-id", name="Demo Clone", include_data=true, sanitize=true)
177
-
178
- // Provide custom examples of sensitive data to sanitize
179
- persona(mode="clone", from="source-id", name="Demo Clone", include_data=true, sanitize=true, sanitize_examples=["Acme Corp", "john@example.com"])
180
- ```
181
-
182
115
  **Sanitize an existing persona (TWO STEP PROCESS):**
183
116
 
184
- ```typescript
117
+ ```
185
118
  // Step 1: Preview (identifies PII, returns items_needing_review count)
186
119
  persona(method="sanitize", id="abc")
187
120
 
188
- // Step 2: Provide known PII values and apply (only works when items_needing_review=0)
121
+ // Step 2: Provide known PII values and apply
189
122
  persona(method="sanitize", id="abc", examples=["Acme Corp", "john@example.com"], apply=true)
190
123
  ```
191
124
 
192
125
  **Sanitization Notes:**
193
- - **Two-step process**: First call returns preview with `items_needing_review` count. Changes only apply when `items_needing_review=0` AND `preview=false`
126
+ - **Two-step process**: First call returns preview with `items_needing_review` count. Second call applies with `apply=true`
194
127
  - **Auto-detects**: emails, phones, SSNs, credit cards (by issuer prefix), API keys, JWTs
195
128
  - **NOT detected by default**: UUIDs (typically system IDs like `template_id`, `persona_id`)
196
- - `sanitize_examples`: for company names, person names, vendor names, custom identifiers - providing these reduces `items_needing_review`
197
- - **Transforms**: pseudonymize (names fake names), mask (phones `***-***-1234`), redact (credentials)
129
+ - `examples`: for company names, person names, vendor names, custom identifiers - providing these reduces `items_needing_review`
130
+ - **Transforms**: pseudonymize (names -> fake names), mask (phones -> `***-***-1234`), redact (credentials)
198
131
  - **Allowlist approach**: Only content fields sanitized (description, prompts, fixed_response), system fields preserved
199
132
  - Dashboard row sanitization: applies to row data during clone
200
133
 
@@ -202,251 +135,209 @@ persona(method="sanitize", id="abc", examples=["Acme Corp", "john@example.com"],
202
135
 
203
136
  For fine-grained control over dashboard data:
204
137
 
205
- ```typescript
206
- // List rows from a dashboard
207
- knowledge(persona_id="abc", mode="dashboard_rows")
138
+ ```
139
+ // List data items from a persona
140
+ persona(id="abc", data={method:"list"})
208
141
 
209
- // Clone dashboard rows separately (usually not needed - use persona clone_data instead)
210
- knowledge(persona_id="target", mode="dashboard_clone", source_persona_id="source")
142
+ // Get file counts
143
+ persona(id="abc", data={method:"stats"})
211
144
  ```
212
145
 
213
146
  ### Sync between environments
214
147
 
215
- - Run (single): `sync(id="My Bot", source="demo", target="dev", dry_run=true|false)`
216
- - Run (all tagged): `sync(target="dev", scope="all", dry_run=true|false)`
217
- - Status: `sync(mode="status", id="My Bot", env="dev")`
148
+ ```
149
+ // Preview changes first
150
+ sync(method="preview", persona="My Bot", from="staging", to="prod")
151
+
152
+ // Execute sync
153
+ sync(method="execute", persona="My Bot", from="staging", to="prod")
154
+
155
+ // Check status
156
+ sync(method="status")
157
+ sync(method="status", persona="My Bot")
158
+ ```
218
159
 
219
160
  ### Version / snapshot AI Employees
220
161
 
221
- ```typescript
162
+ ```
222
163
  // Before a risky change - create a snapshot
223
- persona(mode="version_create", id="My Bot", message="Before adding HITL")
164
+ persona(method="snapshot", id="abc", message="Before adding HITL")
224
165
 
225
166
  // Make changes...
226
- persona(mode="update", id="abc", config={...})
167
+ persona(method="update", id="abc", config={...})
227
168
 
228
169
  // If something breaks - restore
229
- persona(mode="version_list", id="My Bot")
230
- persona(mode="version_restore", id="My Bot", version="v3")
170
+ persona(method="history", id="abc")
171
+ persona(method="restore", id="abc", version="v3")
231
172
  ```
232
173
 
233
174
  ## Tool reference (high-signal)
234
175
 
235
- ### `persona` (explicit mode required)
176
+ ### `persona` (explicit method required)
177
+
178
+ **`method` is required.** If omitted, the tool will ask for clarification.
236
179
 
237
- **Mode is required.** If omitted, the tool will ask for clarification.
180
+ Valid methods: `list`, `get`, `create`, `update`, `delete`, `sanitize`, `schema`, `snapshot`, `history`, `restore`
238
181
 
239
182
  **List/Get:**
240
- ```typescript
241
- persona(mode="list")
242
- persona(mode="list", query="support", status="active")
243
- persona(mode="get", id="abc")
244
- persona(mode="get", id="abc", include_workflow=true)
183
+ ```
184
+ persona(method="list")
185
+ persona(method="list", query="support", status="active")
186
+ persona(method="get", id="abc")
187
+ persona(method="get", id="abc", include_workflow=true)
188
+ persona(method="get", id="abc", include_fingerprint=true) // for stale-state protection
245
189
  ```
246
190
 
247
191
  **Create:**
248
- ```typescript
249
- persona(mode="create", input="<what it does>", type="voice", name="My Bot", preview=false)
250
- persona(mode="create", from="Voice AI Starter", name="My Bot", input="...", preview=false)
192
+ ```
193
+ persona(method="create", name="My Bot", type="voice")
194
+ persona(method="create", name="My Bot", from="Voice AI Starter") // from template
195
+ persona(method="create", name="My Bot", from="source-persona-id") // clone
251
196
  ```
252
197
 
253
198
  **Update config:**
254
- ```typescript
255
- persona(mode="update", id="abc", config={widgets: [{...}]})
199
+ ```
200
+ persona(method="update", id="abc", base_fingerprint="...", config={widgets: [{...}]})
256
201
  ```
257
202
 
258
- **Clone:**
259
- ```typescript
260
- persona(mode="clone", from="source-id", name="My Copy", include_data=true)
203
+ **Delete:**
204
+ ```
205
+ persona(method="delete", id="abc", confirm=true)
261
206
  ```
262
207
 
263
208
  **Sanitize (two-step process):**
264
- ```typescript
265
- persona(id="abc", sanitize=true) // Step 1: Preview - identify PII
266
- persona(id="abc", sanitize=true, sanitize_examples=["Acme"], preview=false) // Step 2: Apply
267
209
  ```
268
-
269
- **Intent (qualification for complex requests):**
270
- ```typescript
271
- // GREENFIELD: New persona creation
272
- persona(mode="intent", input="Voice AI SDR that qualifies leads", type="voice")
273
-
274
- // BROWNFIELD: Complex modification to existing persona
275
- persona(mode="intent", input="Send emails with discussion items and key points", id="abc-123")
276
-
277
- // Iterative - provide answers to qualify further
278
- persona(mode="intent", input="...", previous_answers={gate1_q1: "inbound"}, iteration=2)
210
+ persona(method="sanitize", id="abc") // Step 1: Preview - identify PII
211
+ persona(method="sanitize", id="abc", examples=["Acme"], apply=true) // Step 2: Apply
279
212
  ```
280
213
 
281
- Intent mode applies to **both greenfield AND brownfield** scenarios. Use it when:
282
- - Creating complex new personas (multi-intent, HITL, email, taxonomy)
283
- - Modifying existing personas with complex changes that may have ripple effects
284
- - Any request where qualification questions help clarify WHY/WHAT/CONSTRAINTS
285
-
286
- Returns:
287
- - `status: "ready"` → `intent_spec` ready for WorkflowSpec transformation
288
- - `status: "needs_qualification"` → `questions` to answer before proceeding
289
- - `status: "needs_llm"` → `llm_prompt` to send to LLM for IntentSpec generation
290
-
291
- For brownfield, use `workflow(mode="get")` to fetch current state, then use intent to qualify the change.
214
+ **Version management:**
215
+ ```
216
+ persona(method="snapshot", id="abc", message="Before update")
217
+ persona(method="history", id="abc")
218
+ persona(method="restore", id="abc", version="v2")
219
+ ```
292
220
 
293
- **Templates:**
294
- ```typescript
295
- persona(mode="templates")
221
+ **Schema:**
222
+ ```
223
+ persona(method="schema", id="abc") // Get input schema (dashboard columns, types)
296
224
  ```
297
225
 
298
- **Version management:**
299
- ```typescript
300
- persona(mode="version_create", id="abc", message="Before update")
301
- persona(mode="version_list", id="abc")
302
- persona(mode="version_restore", id="abc", version="v2")
303
- persona(mode="version_policy", id="abc", auto_on_deploy=true)
226
+ **Data sub-resource (requires id):**
227
+ ```
228
+ persona(id="abc", data={method:"list"})
229
+ persona(id="abc", data={method:"stats"})
230
+ persona(id="abc", data={method:"stats", widget_name:"kb"})
231
+ persona(id="abc", data={method:"upload", path:"/path/to/file.pdf"})
232
+ persona(id="abc", data={method:"upload", path:"/file.pdf", widget_name:"upload1"})
233
+ persona(id="abc", data={method:"upload", items:[{"Column": "value", "Doc": {file: "/path"}}]})
234
+ persona(id="abc", data={method:"delete", file_id:"file-123"})
235
+ persona(id="abc", data={method:"copy", from:"source-id"})
236
+ persona(id="abc", data={method:"copy", from:"source-id", sanitize:true})
237
+ persona(id="abc", data={method:"replicate", from:"source-id"})
238
+ persona(id="abc", data={method:"embed"})
239
+ persona(id="abc", data={method:"embed", enabled:true})
240
+ persona(id="abc", data={method:"search", query:"pricing"})
304
241
  ```
305
242
 
306
- ### `template`
243
+ > **Important for Document Generation (Proposal Writer) personas:** Files must be uploaded to the correct widget to appear in the right repository in the UI. Without `widget_name`, files go to the default `fileUpload` widget which may not be visible in the Configuration tab.
244
+ >
245
+ > **Document Proposal Manager widgets:** `upload` (Content Repository), `upload1` (Service Line Documents), `upload2` (Style Guide)
246
+ >
247
+ > **For other templates:** Call `persona(method="get", id="abc", include_workflow=true)` and inspect `proto_config.widgets[].name` to find the exact widget names.
307
248
 
308
- **Primary use - Get qualifying questions:**
309
- ```typescript
310
- template(questions=true) // All questions
311
- template(questions=true, category="Voice") // Voice-specific
249
+ **Replicate (copy by reference - fast, no file transfer):**
312
250
  ```
313
-
314
- **Reference (understand options):**
315
- ```typescript
316
- template(patterns=true)
317
- template(pattern="intent-routing")
318
- template(widgets="voice")
251
+ persona(id="target-id", data={method:"replicate", from:"source-id"})
252
+ persona(id="target-id", data={method:"replicate", from:"source-id", widget_mappings:[{source_widget:"docs", target_widget:"documents"}]})
253
+ persona(id="target-id", data={method:"replicate", from:"source-id", wait:false})
319
254
  ```
320
255
 
321
- ### `action`
256
+ > **Note:** `replicate` is much faster than copying files. It copies S3 references instead of downloading and re-uploading. Use `method:"copy"` if you need to sanitize data during transfer.
322
257
 
323
- ```typescript
324
- action(id="chat_categorizer", include_docs=true) // Get specific
325
- action(all=true) // List all
326
- action(suggest="IT helpdesk with ServiceNow") // Get recommendations
327
- ```
258
+ ### `catalog` (method + type required)
328
259
 
329
- ### `reference` (v2 expanded)
260
+ **Browse platform reference data.** Replaces the old `action`, `template`, and `reference` tools.
330
261
 
331
- **Environments:**
332
- ```typescript
333
- reference(type="envs")
334
- ```
262
+ Valid methods: `list`, `get`, `search`, `recommend`
263
+ Valid types: `actions`, `templates`, `widgets`, `voices`, `patterns`, `concepts`
335
264
 
336
- **Actions (replaces `action` tool):**
337
- ```typescript
338
- reference(type="actions") // List all
339
- reference(type="actions", id="send_email") // Get specific
340
- reference(type="actions", suggest="IT helpdesk") // Recommendations
341
265
  ```
266
+ // Actions (workflow nodes/agents)
267
+ catalog(method="list", type="actions")
268
+ catalog(method="get", type="actions", id="chat_categorizer")
269
+ catalog(method="search", type="actions", query="email")
270
+ catalog(method="recommend", type="actions", for="IT helpdesk with ServiceNow")
342
271
 
343
- **Templates & Patterns:**
344
- ```typescript
345
- reference(type="templates") // Persona templates (dynamic, tenant-specific)
346
- reference(type="patterns") // Workflow patterns
347
- reference(type="patterns", pattern="intent-routing")
348
- reference(type="widgets", persona_type="voice")
349
- ```
272
+ // Templates (persona templates - tenant-specific)
273
+ catalog(method="list", type="templates")
274
+ catalog(method="get", type="templates", id="voice-ai-starter")
350
275
 
351
- > **Note:** Templates are tenant-specific. Always use `reference(type="templates")` to discover available templates rather than hardcoding template IDs.
276
+ // Patterns (workflow patterns)
277
+ catalog(method="list", type="patterns")
278
+ catalog(method="get", type="patterns", id="intent-routing")
279
+ catalog(method="recommend", type="patterns", for="human in the loop")
352
280
 
353
- **Concepts & Guidance:**
354
- ```typescript
355
- reference(concept="HITL")
356
- reference(guidance="categorizer-routing")
357
- reference(questions=true) // Qualifying questions
358
- ```
281
+ // Widgets (configuration widgets)
282
+ catalog(method="list", type="widgets")
283
+
284
+ // Voices (voice models)
285
+ catalog(method="list", type="voices")
359
286
 
360
- **Debugging:**
361
- ```typescript
362
- reference(mistakes=true)
363
- reference(checklist=true)
364
- reference(execution=true)
287
+ // Concepts (platform terminology)
288
+ catalog(method="list", type="concepts")
289
+ catalog(method="get", type="concepts", id="HITL")
365
290
  ```
366
291
 
367
- ### `data` (explicit mode required)
292
+ > **Note:** Templates are tenant-specific. Always use `catalog(method="list", type="templates")` to discover available templates rather than hardcoding template IDs.
368
293
 
369
- **Mode is required.** If omitted, the tool will ask for clarification.
294
+ ### `workflow` (mode required)
370
295
 
371
- **List files:**
372
- ```typescript
373
- data(persona_id="abc", mode="list")
374
- data(persona_id="abc", mode="list", limit=50)
375
- ```
296
+ Valid modes: `get`, `deploy`, `validate`, `optimize`
376
297
 
377
- **Get specific file:**
378
- ```typescript
379
- data(persona_id="abc", mode="get", file_id="file-123")
380
298
  ```
299
+ // Get workflow data for LLM to work with
300
+ workflow(mode="get", persona_id="abc")
381
301
 
382
- **Upload/Delete:**
383
- ```typescript
384
- data(persona_id="abc", mode="upload", file="/path/to/file.pdf")
385
- data(persona_id="abc", mode="delete", file_id="file-123")
386
- ```
302
+ // Validate before deploying
303
+ workflow(mode="validate", persona_id="abc")
304
+ workflow(mode="validate", workflow_spec={...})
387
305
 
388
- **Upload to specific widget (Document Generation personas):**
389
- ```typescript
390
- // Document Proposal Manager widget names (verified from template):
391
- data(persona_id="abc", mode="upload", file="/path/to/company.pdf", widget_name="upload") // Content Repository
392
- data(persona_id="abc", mode="upload", file="/path/to/service-line.pdf", widget_name="upload1") // Service Line Documents
393
- data(persona_id="abc", mode="upload", file="/path/to/style-guide.pdf", widget_name="upload2") // Style Guide
394
- ```
306
+ // Deploy LLM-generated workflow
307
+ workflow(mode="deploy", persona_id="abc", base_fingerprint="...", workflow_def={...})
308
+ workflow(mode="deploy", persona_id="abc", workflow_def_path="/path/to/wf.json") // large payloads
395
309
 
396
- > **Important for Document Generation (Proposal Writer) personas:** Files must be uploaded to the correct widget to appear in the right repository in the UI. Without `widget_name`, files go to the default `fileUpload` widget which may not be visible in the Configuration tab.
397
- >
398
- > **Document Proposal Manager widgets:** `upload` (Content Repository), `upload1` (Service Line Documents), `upload2` (Style Guide)
399
- >
400
- > **For other templates:** Call `persona(id="abc", include_workflow=true)` and inspect `proto_config.widgets[].name` to find the exact widget names.
310
+ // Optimize existing workflow
311
+ workflow(mode="optimize", persona_id="abc")
312
+ ```
401
313
 
402
- **Generate content (via Document Generation API):**
403
- ```typescript
404
- // From a template
405
- data(persona_id="abc", mode="generate", from="customer", count=5)
406
- data(persona_id="abc", mode="generate", from="demo-sales-sdr")
314
+ ### `sync` (method required)
407
315
 
408
- // From natural language
409
- data(persona_id="abc", mode="generate", input="Generate 5 B2B customer profiles")
316
+ Valid methods: `preview`, `execute`, `status`
410
317
 
411
- // List available templates
412
- data(mode="templates")
413
- data(mode="templates", template="customer") // Get template details
318
+ ```
319
+ sync(method="preview", persona="My Bot", from="staging", to="prod")
320
+ sync(method="execute", persona="My Bot", from="staging", to="prod")
321
+ sync(method="status")
322
+ sync(method="status", persona="My Bot")
414
323
  ```
415
324
 
416
- **Available templates:** `customer`, `product`, `faq`, `employee`, `demo-sales-sdr`, `demo-support`, `demo-hr`, `countries`, `industries`, `currencies`
325
+ ### `env`
417
326
 
418
- **Sanitize persona data:**
419
- ```typescript
420
- data(persona_id="abc", mode="sanitize")
421
- data(persona_id="abc", mode="sanitize", include_workflow=true)
422
327
  ```
423
-
424
- **File Stats:**
425
- ```typescript
426
- data(persona_id="abc", mode="stats") // Get file counts
427
- data(persona_id="abc", mode="stats", widget_name="kb") // Filter by widget
428
- // Returns: { total: 50, pending: 5, success: 40, failed: 5 }
328
+ env() // List available environments and default
429
329
  ```
430
330
 
431
- **Replicate (copy by reference - fast, no file transfer):**
432
- ```typescript
433
- // Copy knowledge base from source to target (references S3 objects, no re-upload)
434
- data(persona_id="target-id", mode="replicate", from="source-id")
331
+ ### `toolkit_feedback`
435
332
 
436
- // With custom widget mappings
437
- data(persona_id="target-id", mode="replicate", from="source-id",
438
- widget_mappings=[{source_widget: "docs", target_widget: "documents"}])
333
+ Valid methods: `submit`, `list`, `analyze`
439
334
 
440
- // Async (don't wait for completion)
441
- data(persona_id="target-id", mode="replicate", from="source-id", wait=false)
442
335
  ```
443
-
444
- > **Note:** `replicate` is much faster than copying files. It copies S3 references instead of downloading and re-uploading. Use `mode="copy"` if you need to sanitize data during transfer.
445
-
446
- **Embedding:**
447
- ```typescript
448
- data(persona_id="abc", mode="embedding") // Get status
449
- data(persona_id="abc", mode="embedding", enabled=true) // Toggle
336
+ toolkit_feedback(method="submit", category="gap", message="Missing docs on extraction columns")
337
+ toolkit_feedback(method="submit", category="confusion", message="...", tool="workflow")
338
+ toolkit_feedback(method="submit", category="success", message="Workflow deploy guidance was clear")
339
+ toolkit_feedback(method="list")
340
+ toolkit_feedback(method="analyze")
450
341
  ```
451
342
 
452
343
  ## Resources (read-first)
@@ -463,38 +354,37 @@ Start with:
463
354
 
464
355
  **MCP provides data and schema. LLM generates workflow_def.**
465
356
 
466
- ```typescript
357
+ ```
467
358
  // 1. Get current workflow + schema (includes deprecation_warnings!)
468
359
  result = workflow(mode="get", persona_id="abc")
469
360
  // Returns: workflow_def, generation_schema, example_workflow, requirements, deprecation_warnings
470
361
 
471
362
  // 2. LLM analyzes and generates new workflow_def
472
363
  // (LLM uses schema and examples to build valid workflow)
473
- // ⚠️ FIX any deprecated actions FIRST - check deprecation_warnings!
364
+ // FIX any deprecated actions FIRST - check deprecation_warnings!
474
365
 
475
- // 3. Deploy LLM's result (preview first!)
476
- workflow(mode="deploy", persona_id="abc", workflow_def={...}, preview=true)
477
- workflow(mode="deploy", persona_id="abc", workflow_def={...})
366
+ // 3. Deploy LLM's result
367
+ workflow(mode="deploy", persona_id="abc", base_fingerprint="...", workflow_def={...})
478
368
  ```
479
369
 
480
- ### ⚠️ CRITICAL: Check Deprecated Actions First
370
+ ### CRITICAL: Check Deprecated Actions First
481
371
 
482
372
  **BEFORE generating any workflow:**
483
373
 
484
374
  1. Check `deprecation_warnings` in `workflow(mode="get")` response
485
- 2. Use `reference(type="actions")` to verify current versions
375
+ 2. Use `catalog(method="list", type="actions")` to verify current versions
486
376
  3. **NEVER** copy workflow patterns from existing personas (they may use deprecated actions!)
487
377
 
488
378
  **Correct workflow pattern:**
489
379
  ```
490
- chat_trigger search/v2 respond_for_external_actions WORKFLOW_OUTPUT
380
+ chat_trigger -> search/v2 -> respond_for_external_actions -> WORKFLOW_OUTPUT
491
381
  ```
492
382
 
493
383
  **Deprecated (DO NOT USE):**
494
384
  ```
495
- search/v0 Use search/v2
496
- respond_with_sources Use respond_for_external_actions
497
- call_llm/v0 Use call_llm/v2
385
+ search/v0 -> Use search/v2
386
+ respond_with_sources/v0 -> Use respond_for_external_actions
387
+ call_llm/v0 -> Use call_llm/v2
498
388
  ```
499
389
 
500
390
  **Common issues to check when generating:**
@@ -508,17 +398,25 @@ call_llm/v0 → Use call_llm/v2
508
398
 
509
399
  **HITL is opt-in, not forced by default.**
510
400
 
401
+ HITL is a **flag on specific action nodes**, not a standalone workflow node. Set `disable_human_interaction: false` on the node that needs approval.
402
+
511
403
  | Scenario | Default | How to Add HITL |
512
404
  |----------|---------|-----------------|
513
- | Send email | No HITL | Get workflow add general_hitl node before email → deploy |
514
- | External API | No HITL | Get workflow add general_hitl node → deploy |
515
- | Create records | No HITL | Get workflow add general_hitl node → deploy |
405
+ | Send email | No HITL | Set `disable_human_interaction: false` on `send_email_agent` node |
406
+ | External API | No HITL | Set `disable_human_interaction: false` on `external_action_caller` node |
407
+ | Create records | No HITL | Set `disable_human_interaction: false` on the action node |
408
+
409
+ **Counter-intuitive naming:**
410
+ - `disable_human_interaction: false` -> HITL **ON** (requires approval)
411
+ - `disable_human_interaction: true` -> HITL **OFF** (auto-proceeds)
516
412
 
517
- **Pattern:** `workflow(mode="get")` modify workflow_def `workflow(mode="deploy")`
413
+ **Pattern:** `workflow(mode="get")` -> modify workflow_def -> `workflow(mode="deploy")`
414
+
415
+ > **Note:** Do NOT add standalone `general_hitl` nodes to new workflows. Use the flag pattern on the agent that performs the action instead.
518
416
 
519
417
  ## Auto Builder Prompt Length Limits
520
418
 
521
- **⚠️ CRITICAL:** Auto Builder has strict prompt length limits (~2500 chars).
419
+ Auto Builder has strict prompt length limits (~2500 chars).
522
420
 
523
421
  ### Good Prompt Format
524
422
  ```text
@@ -530,8 +428,8 @@ Core Capabilities:
530
428
  3. Fallback - Handle unclear requests
531
429
 
532
430
  Rules:
533
- Rule 1
534
- Rule 2
431
+ - Rule 1
432
+ - Rule 2
535
433
  ```
536
434
 
537
435
  ### Bad Prompt Format (Times Out)
@@ -539,44 +437,15 @@ Rules:
539
437
  - Example conversations embedded in prompt
540
438
  - Prompts > 2500 characters
541
439
 
542
- ## Deprecated Tools
543
-
544
- ### `workflow` → use `persona`
545
-
546
- ```typescript
547
- // OLD (deprecated)
548
- workflow(input="...", type="voice", name="Bot", preview=false)
549
-
550
- // NEW
551
- persona(input="...", type="voice", name="Bot", preview=false)
552
- ```
553
-
554
- ### `knowledge` → use `data`
440
+ ## Deprecated Tools (still work, route internally)
555
441
 
556
- ```typescript
557
- // OLD (deprecated)
558
- knowledge(persona_id="abc", mode="list")
559
- knowledge(persona_id="abc", mode="upload", file="...")
560
- knowledge(persona_id="abc", mode="status")
561
- knowledge(persona_id="abc", mode="toggle", enabled=true)
442
+ These tool names still work for backwards compatibility but are not exposed in the tool list. Use the current equivalents instead.
562
443
 
563
- // NEW
564
- data(persona_id="abc", mode="list")
565
- data(persona_id="abc", mode="upload", file="...")
566
- data(persona_id="abc", mode="embedding")
567
- data(persona_id="abc", mode="embedding", enabled=true)
568
- ```
569
-
570
- ### `demo` use `data` + `persona`
571
-
572
- ```typescript
573
- // OLD (deprecated)
574
- demo(mode="generate", entity="customer", data={...})
575
- demo(mode="scenarios")
576
- demo(mode="template", entity="customer")
577
-
578
- // NEW
579
- data(persona_id="abc", mode="generate", from="customer", data={...})
580
- data(mode="templates")
581
- data(mode="templates", template="customer")
582
- ```
444
+ | Deprecated Tool | Use Instead |
445
+ |----------------|-------------|
446
+ | `knowledge` | `persona(id=..., data={method:...})` |
447
+ | `demo` | `persona` + data sub-resource |
448
+ | `data` | `persona(id=..., data={method:...})` |
449
+ | `action` | `catalog(method=..., type="actions")` |
450
+ | `template` | `catalog(method=..., type="templates")` |
451
+ | `reference` | `catalog(method=..., type=...)` |