@ema.co/mcp-toolkit 2026.1.25 → 2026.1.26-3

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 (85) hide show
  1. package/README.md +10 -2
  2. package/dist/mcp/handlers/action/index.js +3 -18
  3. package/dist/mcp/handlers/data/index.js +385 -41
  4. package/dist/mcp/handlers/data/templates.js +107 -0
  5. package/dist/mcp/handlers/deprecation.js +50 -0
  6. package/dist/mcp/handlers/env/index.js +8 -4
  7. package/dist/mcp/handlers/knowledge/index.js +44 -237
  8. package/dist/mcp/handlers/persona/create.js +5 -11
  9. package/dist/mcp/handlers/persona/index.js +5 -1
  10. package/dist/mcp/handlers/persona/version.js +234 -0
  11. package/dist/mcp/handlers/sync/index.js +3 -18
  12. package/dist/mcp/handlers/template/index.js +75 -10
  13. package/dist/mcp/handlers/workflow/analyze.js +171 -0
  14. package/dist/mcp/handlers/workflow/compare.js +70 -0
  15. package/dist/mcp/handlers/workflow/compile.js +39 -0
  16. package/dist/mcp/handlers/workflow/deploy.js +73 -0
  17. package/dist/mcp/handlers/workflow/generate.js +350 -0
  18. package/dist/mcp/handlers/workflow/index.js +136 -0
  19. package/dist/mcp/handlers/workflow/modify.js +456 -0
  20. package/dist/mcp/handlers/workflow/optimize.js +136 -0
  21. package/dist/mcp/handlers/workflow/types.js +4 -0
  22. package/dist/mcp/handlers/workflow/utils.js +132 -0
  23. package/dist/mcp/handlers-consolidated.js +62 -2691
  24. package/dist/mcp/prompts.js +13 -14
  25. package/dist/mcp/resources.js +55 -54
  26. package/dist/mcp/server.js +93 -124
  27. package/dist/mcp/{tools-v2.js → tools.js} +1 -1
  28. package/dist/mcp/workflow-operations.js +2 -2
  29. package/dist/sdk/client-adapter.js +267 -32
  30. package/dist/sdk/client.js +31 -15
  31. package/dist/sdk/ema-client.js +183 -0
  32. package/dist/sdk/generated/template-fallbacks.js +123 -0
  33. package/dist/sdk/guidance.js +65 -11
  34. package/dist/sdk/index.js +3 -1
  35. package/dist/sdk/knowledge.js +16 -86
  36. package/dist/sdk/workflow-intent.js +27 -0
  37. package/dist/sdk/workflow-transformer.js +0 -342
  38. package/docs/DEBUG-ANALYSIS-unused-category-type-mismatch.md +481 -0
  39. package/docs/TODO-fix-analyzer-and-modify.md +182 -0
  40. package/package.json +9 -4
  41. package/dist/mcp/tools-consolidated.js +0 -875
  42. package/dist/mcp/tools-legacy.js +0 -736
  43. package/docs/CODEBASE-ANALYSIS-2026-01-23.md +0 -936
  44. package/docs/CODEBASE-ANALYSIS-PRIORITIZED.md +0 -774
  45. package/docs/api-contracts.md +0 -216
  46. package/docs/auto-builder-analysis.md +0 -271
  47. package/docs/blog/mcp-tool-design-lessons.md +0 -309
  48. package/docs/data-architecture.md +0 -166
  49. package/docs/demos/ap-invoice-generation.md +0 -347
  50. package/docs/demos/ap-invoice-processing.md +0 -271
  51. package/docs/ema-auto-builder-guide.html +0 -394
  52. package/docs/lessons-learned.md +0 -209
  53. package/docs/llm-native-workflow-design.md +0 -252
  54. package/docs/local-generation.md +0 -508
  55. package/docs/mcp-flow-diagram.md +0 -135
  56. package/docs/migration/action-composition-migration.md +0 -270
  57. package/docs/naming-conventions.md +0 -278
  58. package/docs/proposals/HANDOFF-tool-restructure.md +0 -526
  59. package/docs/proposals/action-composition.md +0 -490
  60. package/docs/proposals/explicit-method-restructure.md +0 -328
  61. package/docs/proposals/mcp-tool-restructure-2026-01.md +0 -366
  62. package/docs/proposals/self-contained-guidance.md +0 -427
  63. package/docs/proto-sdk-generation.md +0 -242
  64. package/docs/release-impact.md +0 -102
  65. package/docs/release-process.md +0 -157
  66. package/docs/staging.RULE.md +0 -142
  67. package/docs/test-persona-creation.md +0 -196
  68. package/docs/tool-consolidation-v2.md +0 -225
  69. package/docs/tool-response-standards.md +0 -256
  70. package/resources/demo-kits/README.md +0 -175
  71. package/resources/demo-kits/finance-ap/manifest.json +0 -150
  72. package/resources/demo-kits/tags.json +0 -91
  73. package/resources/docs/getting-started.md +0 -97
  74. package/resources/templates/auto-builder-rules.md +0 -224
  75. package/resources/templates/chat-ai/README.md +0 -119
  76. package/resources/templates/chat-ai/persona-config.json +0 -111
  77. package/resources/templates/dashboard-ai/README.md +0 -156
  78. package/resources/templates/dashboard-ai/persona-config.json +0 -180
  79. package/resources/templates/demo-scenarios/README.md +0 -63
  80. package/resources/templates/demo-scenarios/test-published-package.md +0 -116
  81. package/resources/templates/document-gen-ai/README.md +0 -132
  82. package/resources/templates/document-gen-ai/persona-config.json +0 -316
  83. package/resources/templates/voice-ai/README.md +0 -123
  84. package/resources/templates/voice-ai/persona-config.json +0 -74
  85. package/resources/templates/voice-ai/workflow-prompt.md +0 -121
@@ -1,875 +0,0 @@
1
- /**
2
- * Consolidated MCP Tools for Ema
3
- *
4
- * Follows Unix CLI patterns:
5
- * - Single command with flags instead of separate get/list/create tools
6
- * - Consistent terminology: "persona" (not mixed "ai_employee")
7
- * - Mode flags for different operations on same resource
8
- *
9
- * ~45 tools → 9 commands:
10
- * 1. env - Environment listing
11
- * 2. persona - AI Employee management
12
- * 3. workflow - Workflow generation, analysis, deploy, optimize
13
- * 4. action - Actions/agents lookup
14
- * 5. template - Patterns, widgets, templates
15
- * 6. knowledge - Data sources & embedding
16
- * 7. reference - Platform concepts & guidance
17
- * 8. sync - Environment sync
18
- * 9. demo - Demo data utilities (RAG document generation)
19
- */
20
- // Helper to add env parameter to schema
21
- function withEnvParam(props, required = [], envNames = [], defaultEnv = "demo") {
22
- return {
23
- type: "object",
24
- properties: {
25
- ...props,
26
- env: {
27
- type: "string",
28
- description: `Target environment. Available: ${envNames.join(", ") || "demo, staging, dev"}. Default: ${defaultEnv}`,
29
- },
30
- },
31
- required,
32
- };
33
- }
34
- /**
35
- * Generate consolidated tool definitions
36
- */
37
- export function generateConsolidatedTools(envNames, defaultEnv) {
38
- const withEnv = (props, required = []) => withEnvParam(props, required, envNames, defaultEnv);
39
- return [
40
- // ═══════════════════════════════════════════════════════════════════════
41
- // 1. ENV - Environment listing (simplest tool)
42
- // ═══════════════════════════════════════════════════════════════════════
43
- {
44
- name: "env",
45
- description: "List available Ema environments and toolkit info. Returns environments (with default marker) and toolkit name/version.",
46
- inputSchema: { type: "object", properties: {}, required: [] },
47
- },
48
- // ═══════════════════════════════════════════════════════════════════════
49
- // 2. PERSONA - Unified AI Employee management (create, modify, analyze, list)
50
- // ═══════════════════════════════════════════════════════════════════════
51
- {
52
- name: "persona",
53
- description: `AI Employee management. Explicit mode required.
54
-
55
- ## Modes (explicit \`mode\` parameter required)
56
-
57
- | Mode | Purpose | Required Params |
58
- |------|---------|-----------------|
59
- | \`list\` | List all personas | - |
60
- | \`get\` | Get specific persona | \`id\` |
61
- | \`create\` | Create new persona | \`name\`, \`type\` or \`from\` |
62
- | \`update\` | Update config | \`id\`, \`proto_config\` |
63
- | \`clone\` | Clone persona | \`from\`, \`name\` |
64
- | \`compare\` | Compare two | \`id\`, \`compare_to\` |
65
- | \`sanitize\` | Sanitize PII | \`id\` |
66
- | \`analyze\` | Analyze issues | \`id\`, optional: \`fix\`, \`include\` |
67
- | \`templates\` | List templates | - |
68
-
69
- ## Examples
70
-
71
- \`\`\`
72
- // List & Get
73
- persona(mode="list")
74
- persona(mode="get", id="abc-123")
75
- persona(mode="get", id="abc-123", include_workflow=true)
76
-
77
- // Create from template
78
- persona(mode="create", from="Voice AI Starter", name="My SDR", input="qualifies leads", preview=false)
79
-
80
- // Create new (no template)
81
- persona(mode="create", name="My SDR", type="voice", input="qualifies leads", preview=false)
82
-
83
- // Update config (proto_config)
84
- persona(mode="update", id="abc-123", proto_config={widgets: [{name: "conversationSettings", conversationSettings: {...}}]})
85
-
86
- // Update workflow via LLM-native WorkflowSpec
87
- persona(mode="update", id="abc-123", workflow_spec={name: "...", nodes: [...], resultMappings: [...]})
88
-
89
- // Clone
90
- persona(mode="clone", from="source-id", name="My Copy", include_data=true)
91
-
92
- // Compare
93
- persona(mode="compare", id="abc-123", compare_to="def-456")
94
-
95
- // Analyze (returns workflow_spec + schema + issues)
96
- persona(mode="analyze", id="abc-123")
97
- persona(mode="analyze", id="abc-123", include=["workflow", "data"])
98
-
99
- // Workflow modification flow (Agent builds fixes, MCP deploys):
100
- // 1. Analyze to get workflow_spec + schema + issues
101
- // persona(mode="analyze", id="abc-123")
102
- // → returns {workflow_spec: {...}, schema: "...", issues: [...]}
103
- // 2. Agent reviews issues, asks user which to fix
104
- // 3. Agent modifies the spec (add nodes, change inputs, etc.)
105
- // 4. Deploy the agent-built spec
106
- // persona(mode="update", id="abc-123", workflow_spec=<agent_built_spec>)
107
- \`\`\`
108
-
109
- ## ⚠️ ASK BEFORE CREATING
110
-
111
- **Before creating a new AI Employee, ASK THE USER:**
112
- 1. What should it do? (purpose, intents, capabilities)
113
- 2. What type? (voice, chat, dashboard)
114
- 3. What name?
115
-
116
- ## Key Rules
117
-
118
- 1. **EXPLICIT MODE** - Always specify mode parameter
119
- 2. **ONE CALL** - Put everything in one call
120
- 3. **STOP after success** - Don't make follow-up "fix" calls
121
- 4. **preview=false** - Required to actually deploy`,
122
- inputSchema: withEnv({
123
- // === MODE (explicit, required) ===
124
- mode: {
125
- type: "string",
126
- enum: [
127
- "list", "get", "create", "update", "clone", "compare", "sanitize", "templates", "analyze", "intent",
128
- "version_create", "version_list", "version_get", "version_compare", "version_restore", "version_policy"
129
- ],
130
- description: "Operation mode. REQUIRED. If omitted, tool will ask for clarification.",
131
- },
132
- // === IDENTITY (for existing personas) ===
133
- id: {
134
- type: "string",
135
- description: "Persona ID (UUID) or exact name. Required for get/update/compare/sanitize."
136
- },
137
- identifier: {
138
- type: "string",
139
- deprecated: true,
140
- description: "DEPRECATED: use id.",
141
- },
142
- // === CREATE FROM BASE (unified: template or persona) ===
143
- from: {
144
- type: "string",
145
- description: "Base to create/clone from: template ID, persona ID, or name. Used with mode='create' or mode='clone'.",
146
- },
147
- include_data: {
148
- type: "boolean",
149
- description: "When cloning from persona: include knowledge files and dashboard rows. Default: true for persona, N/A for template.",
150
- },
151
- // === CREATE/MODIFY ===
152
- input: {
153
- type: "string",
154
- description: "Natural language description. For new: 'Voice AI for sales...'. For modify: 'add HITL before email'.",
155
- },
156
- type: {
157
- type: "string",
158
- enum: ["voice", "chat", "dashboard"],
159
- description: "AI Employee type. Required when creating without 'from'."
160
- },
161
- name: { type: "string", description: "REQUIRED for new: The actual persona name shown in Ema platform." },
162
- description: { type: "string", description: "Description of what it does." },
163
- preview: {
164
- type: "boolean",
165
- description: "Default: true (safe). Set false to deploy changes."
166
- },
167
- sanitize: { type: "boolean", description: "Sanitize/obfuscate PII and sensitive data (for demo environments)" },
168
- sanitize_examples: { type: "array", items: { type: "string" }, description: "Additional items to treat as sensitive (e.g., company names)" },
169
- // === ANALYZE ===
170
- fix: {
171
- type: "boolean",
172
- description: "DEPRECATED: Returns preview only. Agent should review issues and build workflow_spec fixes.",
173
- },
174
- include: {
175
- type: "array",
176
- items: { type: "string", enum: ["workflow", "config", "data", "issues", "connections", "fixes", "metrics"] },
177
- description: "What to include. For analyze: ['workflow','config','data']. For get: ['issues','connections','fixes','metrics'].",
178
- },
179
- include_workflow: { type: "boolean", description: "Include full workflow_def in response" },
180
- include_fingerprint: { type: "boolean", description: "Include config hash" },
181
- // === INTENT (qualification/refinement) ===
182
- previous_answers: {
183
- type: "object",
184
- additionalProperties: { type: "string" },
185
- description: "For mode='intent': answers to previous qualification questions (iterative flow).",
186
- },
187
- iteration: {
188
- type: "integer",
189
- minimum: 1,
190
- description: "For mode='intent': iteration number (1 = first call, 2+ = after providing answers).",
191
- },
192
- max_complexity: {
193
- type: "string",
194
- enum: ["simple", "moderate", "complex"],
195
- description: "For mode='intent': cap complexity level for gradual rollout.",
196
- },
197
- // === LIST/SEARCH ===
198
- all: { type: "boolean", description: "List all personas" },
199
- query: { type: "string", description: "Search by name (partial match)" },
200
- status: { type: "string", description: "Filter: 'active', 'inactive', 'draft'" },
201
- trigger_type: { type: "string", description: "Filter: 'voice', 'chat', 'dashboard'" },
202
- limit: { type: "number", description: "Max results (default: 50)" },
203
- // === COMPARE ===
204
- compare_to: { type: "string", description: "Second persona ID for comparison" },
205
- compare_env: { type: "string", description: "Environment of compare_to persona" },
206
- // === ADVANCED/OVERRIDE ===
207
- proto_config: {
208
- type: "object",
209
- description: "Override voice/chat settings. Usually auto-generated from input."
210
- },
211
- workflow: {
212
- type: "object",
213
- description: "Direct workflow_def JSON (advanced). Usually auto-generated."
214
- },
215
- workflow_spec: {
216
- type: "object",
217
- description: "LLM-native WorkflowSpec. SDK compiles to workflow_def. Use with mode='update'. Get schema from mode='analyze'."
218
- },
219
- include_spec: {
220
- type: "boolean",
221
- description: "For mode='analyze': include decompiled workflow_spec + schema in response. Default: true."
222
- },
223
- workflow_def: {
224
- type: "object",
225
- description: "Alias for workflow (backwards compatibility)."
226
- },
227
- enabled: { type: "boolean", description: "Enable/disable persona" },
228
- // === DEPRECATED (use 'from' instead) ===
229
- template_id: { type: "string", description: "DEPRECATED: use from. Specific template ID." },
230
- clone_from: { type: "string", description: "DEPRECATED: use from. Clone from existing persona ID." },
231
- clone_data: { type: "boolean", description: "DEPRECATED: use include_data." },
232
- // === TEMPLATES ===
233
- templates: { type: "boolean", description: "List available templates" },
234
- // === VERSION MANAGEMENT ===
235
- // Note: mode enum is defined above, version_* modes are included there
236
- version: { type: "string", description: "Version identifier (e.g., 'v3', 'latest')" },
237
- v1: { type: "string", description: "First version for comparison" },
238
- v2: { type: "string", description: "Second version for comparison" },
239
- message: { type: "string", description: "Version message/description" },
240
- auto_on_deploy: { type: "boolean", description: "Auto-create version on deploy" },
241
- auto_on_sync: { type: "boolean", description: "Auto-create version on sync" },
242
- max_versions: { type: "number", description: "Max versions to keep" },
243
- }),
244
- },
245
- // ═══════════════════════════════════════════════════════════════════════
246
- // 3. WORKFLOW - DEPRECATED: Use persona() instead
247
- // ═══════════════════════════════════════════════════════════════════════
248
- {
249
- name: "workflow",
250
- description: `⚠️ DEPRECATED: Use \`persona()\` instead. This tool routes to persona.
251
-
252
- ## Migration Guide
253
-
254
- OLD (deprecated):
255
- workflow(input="...", type="voice", name="Bot", preview=false)
256
- workflow(persona_id="abc", input="add HITL")
257
-
258
- NEW (use this):
259
- persona(input="...", type="voice", name="Bot", preview=false)
260
- persona(id="abc", input="add HITL")
261
-
262
- The \`persona\` tool now handles everything: create, modify, analyze, list.
263
- This \`workflow\` tool still works but shows a deprecation warning.`,
264
- inputSchema: withEnv({
265
- // === REQUIRED for creating/modifying ===
266
- input: {
267
- type: "string",
268
- description: "Natural language description of what you want. Examples: 'Voice AI for sales development' (new) or 'add HITL before emails' (modify existing)",
269
- },
270
- // === REQUIRED for modifying existing ===
271
- persona_id: {
272
- type: "string",
273
- description: "ID of existing persona to modify or analyze. Omit for creating new personas."
274
- },
275
- // === REQUIRED for new Voice/Chat/Dashboard ===
276
- type: {
277
- type: "string",
278
- enum: ["voice", "chat", "dashboard"],
279
- description: "REQUIRED for new personas. Type of AI Employee to create."
280
- },
281
- // === Control deployment ===
282
- preview: {
283
- type: "boolean",
284
- description: "Default: true (safe). Set false to deploy changes to Ema platform."
285
- },
286
- // === For new personas (greenfield with preview=false) ===
287
- name: {
288
- type: "string",
289
- description: "Name for the new persona. Required when creating with preview=false."
290
- },
291
- description: {
292
- type: "string",
293
- description: "Description of what the persona does."
294
- },
295
- // === Voice/Chat settings (auto-generated, but can override) ===
296
- proto_config: {
297
- type: "object",
298
- description: "Voice/chat settings. Auto-generated from input. Override specific settings like welcomeMessage, identityAndPurpose."
299
- },
300
- // === For analysis/optimization ===
301
- optimize: {
302
- type: "boolean",
303
- description: "DEPRECATED: Returns suggestions only. Agent should build workflow_spec fixes.",
304
- },
305
- include: {
306
- type: "array",
307
- items: { type: "string", enum: ["issues", "connections", "fixes", "metrics"] },
308
- description: "What to include in analysis output.",
309
- },
310
- // === Advanced/Legacy ===
311
- workflow_def: {
312
- type: "object",
313
- description: "Direct workflow JSON (advanced). Usually auto-generated from input."
314
- },
315
- compare_to: { type: "string", description: "Second persona ID for comparison" },
316
- mode: {
317
- type: "string",
318
- enum: ["generate", "extend", "optimize", "analyze", "compare", "compile"],
319
- description: "Usually auto-detected. Only specify for compile mode."
320
- },
321
- nodes: { type: "array", description: "For compile mode: node definitions" },
322
- result_mappings: { type: "array", description: "For compile mode: output mappings" },
323
- }),
324
- },
325
- // ═══════════════════════════════════════════════════════════════════════
326
- // 4. ACTION - Actions/agents lookup (API + reference docs)
327
- // ═══════════════════════════════════════════════════════════════════════
328
- {
329
- name: "action",
330
- description: `Unified action/agent lookup. Gets live API data AND reference docs.
331
-
332
- **Get single**:
333
- action(id="chat_categorizer")
334
- action(id="abc-123-uuid")
335
- action(id="search", include_docs=true)
336
-
337
- **List/Search**:
338
- action(all=true)
339
- action(category="routing")
340
- action(query="search")
341
- action(persona_id="abc") # Actions in workflow
342
-
343
- **Suggest for use case**:
344
- action(suggest="IT helpdesk with ticket creation")
345
-
346
- **Categories**:
347
- action(categories=true)`,
348
- inputSchema: withEnv({
349
- // ID (or name)
350
- id: {
351
- type: "string",
352
- description: "Action ID or name (e.g., 'chat_categorizer')"
353
- },
354
- // Deprecated alias (backwards compatibility)
355
- identifier: {
356
- type: "string",
357
- deprecated: true,
358
- description: "DEPRECATED: use id. Action ID or name (e.g., 'chat_categorizer')",
359
- },
360
- // List/Search flags
361
- all: { type: "boolean", description: "List all available actions" },
362
- query: { type: "string", description: "Search by name" },
363
- category: { type: "string", description: "Filter by category" },
364
- persona_id: { type: "string", description: "List actions in this workflow" },
365
- enabled: { type: "boolean", description: "Filter by enabled status" },
366
- limit: { type: "number", description: "Max results" },
367
- // Include flags
368
- include_docs: { type: "boolean", description: "Include full documentation" },
369
- // Suggest mode
370
- suggest: { type: "string", description: "Get recommendations for use case" },
371
- // List categories
372
- categories: { type: "boolean", description: "List action categories" },
373
- }),
374
- },
375
- // ═══════════════════════════════════════════════════════════════════════
376
- // 5. TEMPLATE - Patterns, widgets, persona templates
377
- // ═══════════════════════════════════════════════════════════════════════
378
- {
379
- name: "template",
380
- description: `Get qualifying questions and reference patterns.
381
-
382
- ## 🎯 PRIMARY USE: Get Questions to Ask User
383
-
384
- **Before creating an AI Employee, call this to get what to ask:**
385
- template(questions=true) // All qualifying questions
386
- template(questions=true, category="Voice") // Voice-specific questions
387
-
388
- Returns structured questions about: type, intents, data sources, actions, approvals, etc.
389
- Ask the user these questions, then put answers into ONE workflow() call.
390
-
391
- ## Reference (understand options, not for manual building)
392
-
393
- template(pattern="intent-routing") // See pattern structure
394
- template(patterns=true) // List available patterns
395
- template(widgets="voice") // Widget reference
396
-
397
- ⚠️ Do NOT copy/paste configs from these - MCP generates them internally.`,
398
- inputSchema: {
399
- type: "object",
400
- properties: {
401
- // Workflow patterns
402
- pattern: {
403
- type: "string",
404
- enum: ["simple-kb-search", "intent-routing", "multi-source-search", "tool-calling", "hitl-approval", "document-processing", "guardrails-pattern"],
405
- description: "Get specific workflow pattern"
406
- },
407
- patterns: { type: "boolean", description: "List all workflow patterns" },
408
- // Widget reference
409
- widgets: {
410
- type: "string",
411
- enum: ["voice", "chat", "dashboard"],
412
- description: "Get widget reference for persona type"
413
- },
414
- // Persona config template
415
- config: {
416
- type: "string",
417
- enum: ["voice", "chat", "dashboard"],
418
- description: "Get config template (voice settings, etc.)"
419
- },
420
- // Qualifying questions
421
- questions: { type: "boolean", description: "Get qualifying questions" },
422
- category: {
423
- type: "string",
424
- enum: ["AI Type", "Intent", "Data", "Actions", "Validation", "Output", "Voice", "Guardrails"],
425
- description: "Filter questions by category"
426
- },
427
- required_only: { type: "boolean", description: "Only required questions" },
428
- // Filter
429
- type: {
430
- type: "string",
431
- enum: ["voice", "chat", "dashboard"],
432
- description: "Filter patterns by persona type"
433
- },
434
- },
435
- required: [],
436
- },
437
- },
438
- // ═══════════════════════════════════════════════════════════════════════
439
- // 6. KNOWLEDGE - DEPRECATED: Use data() instead
440
- // ═══════════════════════════════════════════════════════════════════════
441
- {
442
- name: "knowledge",
443
- description: `DEPRECATED: Use \`data()\` instead. This tool routes to data internally.
444
-
445
- ## Migration Guide
446
-
447
- | OLD (deprecated) | NEW |
448
- |------------------|-----|
449
- | knowledge(persona_id="abc", mode="list") | data(persona_id="abc", mode="list") |
450
- | knowledge(persona_id="abc", mode="upload", file="...") | data(persona_id="abc", mode="upload", file="...") |
451
- | knowledge(persona_id="abc", mode="delete", file_id="...") | data(persona_id="abc", mode="delete", file_id="...") |
452
- | knowledge(persona_id="abc", mode="status") | data(persona_id="abc", mode="embedding") |
453
- | knowledge(persona_id="abc", mode="toggle", enabled=true) | data(persona_id="abc", mode="embedding", enabled=true) |
454
-
455
- The \`data\` tool now also supports generation:
456
- data(persona_id="abc", mode="generate", input="...")
457
- data(persona_id="abc", mode="generate", from="customer", count=5)
458
-
459
- This tool still works but shows a deprecation warning.`,
460
- inputSchema: withEnv({
461
- persona_id: { type: "string", description: "AI Employee ID (required)" },
462
- mode: {
463
- type: "string",
464
- enum: ["list", "aggregates", "upload", "delete", "status", "toggle", "attach", "dashboard_rows", "dashboard_clone"],
465
- description: "Operation. Default: 'list'"
466
- },
467
- // List flags
468
- page: { type: "number", description: "Page number (default: 1)" },
469
- limit: { type: "number", description: "Items per page (default: 50)" },
470
- widget_name: { type: "string", description: "Widget name (default: 'fileUpload')" },
471
- // Upload flags
472
- file: { type: "string", description: "File path for upload" },
473
- tags: { type: "string", description: "Tags for uploaded file" },
474
- // Delete flags
475
- file_id: { type: "string", description: "File ID to delete" },
476
- // Toggle flags
477
- enabled: { type: "boolean", description: "Enable/disable embedding" },
478
- // Attach flags
479
- node_name: { type: "string", description: "Workflow node name to attach data source to (e.g., 'knowledge_search_1')" },
480
- // Dashboard clone flags
481
- source_persona_id: { type: "string", description: "Source persona ID for dashboard clone" },
482
- sanitize: { type: "boolean", description: "Sanitize/obfuscate data during clone" },
483
- sanitize_examples: { type: "array", items: { type: "string" }, description: "Additional sensitive items to sanitize" },
484
- }, ["persona_id"]),
485
- },
486
- // ═══════════════════════════════════════════════════════════════════════
487
- // 7. REFERENCE - All reference info (envs, actions, templates, patterns, concepts, guidance)
488
- // ═══════════════════════════════════════════════════════════════════════
489
- {
490
- name: "reference",
491
- description: `All reference information: environments, actions, templates, patterns, concepts, guidance.
492
-
493
- **Environments**:
494
- reference(type="envs")
495
-
496
- **Actions** (workflow building blocks):
497
- reference(type="actions") # List all
498
- reference(type="actions", query="email") # Search
499
- reference(type="actions", id="send_email") # Get specific
500
- reference(type="actions", suggest="IT helpdesk") # Suggest for use case
501
- reference(type="actions", categories=true) # List categories
502
-
503
- **Templates & Patterns**:
504
- reference(type="templates") # List persona templates
505
- reference(type="patterns") # List workflow patterns
506
- reference(type="patterns", pattern="intent-routing") # Get specific
507
-
508
- **Widgets**:
509
- reference(type="widgets", persona_type="voice")
510
-
511
- **Concepts & Guidance**:
512
- reference(concept="HITL")
513
- reference(guidance="categorizer-routing")
514
- reference(questions=true) # Qualifying questions
515
-
516
- **Demo Kits & Tags**:
517
- reference(type="demo_kits") # List all demo kits
518
- reference(demo_kit="finance-ap") # Get specific kit
519
- reference(tags=true) # Get tagging taxonomy
520
-
521
- **Debugging**:
522
- reference(mistakes=true)
523
- reference(checklist=true)
524
- reference(execution=true)
525
-
526
- **Validation**:
527
- reference(check_types={source: "CHAT_CONVERSATION", target: "TEXT"})`,
528
- inputSchema: withEnv({
529
- // Type selector (v2)
530
- type: {
531
- type: "string",
532
- enum: ["envs", "actions", "templates", "patterns", "widgets", "concepts", "demo_kits"],
533
- description: "What type of reference information"
534
- },
535
- // Actions
536
- id: { type: "string", description: "Action ID for details" },
537
- query: { type: "string", description: "Search actions by name" },
538
- suggest: { type: "string", description: "Suggest actions for use case" },
539
- categories: { type: "boolean", description: "List action categories" },
540
- category: { type: "string", description: "Filter by category" },
541
- include_docs: { type: "boolean", description: "Include full documentation" },
542
- limit: { type: "number", description: "Max results" },
543
- // Patterns
544
- pattern: {
545
- type: "string",
546
- enum: ["simple-kb-search", "intent-routing", "multi-source-search", "tool-calling", "hitl-approval", "document-processing", "guardrails-pattern"],
547
- description: "Get specific pattern"
548
- },
549
- // Widgets
550
- persona_type: { type: "string", enum: ["voice", "chat", "dashboard"], description: "Persona type for widgets" },
551
- // Concepts
552
- concept: { type: "string", description: "Get definition of platform term" },
553
- concepts: { type: "boolean", description: "List all platform concepts" },
554
- // Questions
555
- questions: { type: "boolean", description: "Get qualifying questions" },
556
- required_only: { type: "boolean", description: "Only required questions" },
557
- // Guidance
558
- guidance: {
559
- type: "string",
560
- enum: [
561
- "categorizer-routing", "type-compatibility", "named-inputs",
562
- "hitl-patterns", "hitl-policy", "multi-source-search", "voice-tool-calling",
563
- "guardrails", "output-mapping", "workflow-execution", "conversation-vs-query",
564
- "workflow-structure", "search-node-timing", "node-execution-conditions",
565
- "array-preservation", "search-filtering", "fallback-response-inputs",
566
- "separate-vs-merged-inputs", "folder-path-filtering", "automated-extraction-json"
567
- ],
568
- description: "Get guidance on topic"
569
- },
570
- // Debugging
571
- mistakes: { type: "boolean", description: "Get common mistakes list" },
572
- checklist: { type: "boolean", description: "Get debug checklist" },
573
- execution: { type: "boolean", description: "Get workflow execution model" },
574
- // Validation
575
- check_types: {
576
- type: "object",
577
- properties: {
578
- source: { type: "string", description: "Source output type" },
579
- target: { type: "string", description: "Target input type" },
580
- },
581
- description: "Check type compatibility"
582
- },
583
- validate_prompt: { type: "string", description: "Validate workflow prompt" },
584
- // Demo Kits & Tags
585
- demo_kits: { type: "boolean", description: "List available demo kits" },
586
- demo_kit: { type: "string", description: "Get specific demo kit by ID (e.g., 'finance-ap')" },
587
- tags: { type: "boolean", description: "Get tagging taxonomy for personas and kits" },
588
- }),
589
- },
590
- // ═══════════════════════════════════════════════════════════════════════
591
- // 7b. DATA - Manage persona data (files + generation)
592
- // ═══════════════════════════════════════════════════════════════════════
593
- {
594
- name: "data",
595
- description: `Manage AI Employee data: list, upload, generate, modify, sanitize, delete.
596
-
597
- ## Mode is REQUIRED for clarity. If omitted, tool will clarify.
598
-
599
- **List files**:
600
- data(persona_id="abc", mode="list")
601
- data(persona_id="abc", mode="list", limit=50)
602
-
603
- **Get specific file**:
604
- data(persona_id="abc", mode="get", file_id="file-123")
605
-
606
- **Upload file**:
607
- data(persona_id="abc", mode="upload", file="/path/to/doc.pdf")
608
-
609
- **Generate new content** (via Document Generation API):
610
- data(persona_id="abc", mode="generate", input="Generate 5 customer profiles for B2B SaaS")
611
- data(persona_id="abc", mode="generate", from="demo-sales-sdr")
612
- data(persona_id="abc", mode="generate", from="customer", count=10)
613
-
614
- **Modify existing document**:
615
- data(persona_id="abc", mode="modify", file_id="file-123", input="Rewrite for legal compliance")
616
-
617
- **Sanitize data** (replace PII):
618
- data(persona_id="abc", mode="sanitize")
619
- data(persona_id="abc", mode="sanitize", include_workflow=true)
620
-
621
- **Delete file**:
622
- data(persona_id="abc", mode="delete", file_id="file-123")
623
-
624
- **Embedding status/toggle**:
625
- data(persona_id="abc", mode="embedding")
626
- data(persona_id="abc", mode="embedding", enabled=true)
627
-
628
- **List available templates**:
629
- data(mode="templates")
630
- data(mode="templates", template="customer")`,
631
- inputSchema: withEnv({
632
- persona_id: { type: "string", description: "AI Employee ID (required for most operations)" },
633
- mode: {
634
- type: "string",
635
- enum: ["list", "get", "upload", "generate", "modify", "sanitize", "delete", "embedding", "templates"],
636
- description: "Operation to perform. REQUIRED for clarity - tool will ask if omitted."
637
- },
638
- // === Identify existing resource ===
639
- file_id: { type: "string", description: "File/document ID for get/modify/delete" },
640
- // === Generation params ===
641
- from: { type: "string", description: "Template name for generate mode (e.g., 'demo-sales-sdr', 'customer', 'faq')" },
642
- input: { type: "string", description: "Natural language instructions for generate/modify" },
643
- count: { type: "number", description: "Number of items to generate (default: 1)" },
644
- format: {
645
- type: "string",
646
- enum: ["markdown", "json", "html"],
647
- description: "Output format for generation (default: markdown)"
648
- },
649
- data: { type: "object", description: "Additional data context for generation" },
650
- // === Template info ===
651
- template: { type: "string", description: "Get specific template details" },
652
- // === List options ===
653
- limit: { type: "number", description: "Max results (default: 50)" },
654
- page: { type: "number", description: "Page number (default: 1)" },
655
- // === Upload params ===
656
- file: { type: "string", description: "File path for upload" },
657
- tags: { type: "string", description: "Tags for uploaded file" },
658
- // === Sanitize options ===
659
- include_workflow: { type: "boolean", description: "Also sanitize workflow config" },
660
- sanitize_examples: { type: "array", items: { type: "string" }, description: "Additional sensitive items to sanitize" },
661
- // === Embedding toggle ===
662
- enabled: { type: "boolean", description: "Enable/disable embedding" },
663
- }),
664
- },
665
- // ═══════════════════════════════════════════════════════════════════════
666
- // 8. SYNC - Environment synchronization
667
- // ═══════════════════════════════════════════════════════════════════════
668
- {
669
- name: "sync",
670
- description: `Sync AI Employees across environments.
671
-
672
- **Sync single**:
673
- sync(id="IT Support", target="dev")
674
- sync(id="abc-123", target="staging", dry_run=true)
675
-
676
- **Sync all tagged**:
677
- sync(target="dev", scope="all")
678
-
679
- **Status**:
680
- sync(mode="status", id="abc-123")
681
- sync(mode="status", list_synced=true)
682
-
683
- **Config**:
684
- sync(mode="config")`,
685
- inputSchema: {
686
- type: "object",
687
- properties: {
688
- // What to sync
689
- id: { type: "string", description: "Persona ID or name" },
690
- // Deprecated alias (backwards compatibility)
691
- identifier: { type: "string", deprecated: true, description: "DEPRECATED: use id. Persona ID or name" },
692
- // Mode
693
- mode: {
694
- type: "string",
695
- enum: ["run", "status", "config"],
696
- description: "Operation. Default: 'run'"
697
- },
698
- // Sync flags
699
- source: { type: "string", description: "Source environment (default: current)" },
700
- target: { type: "string", description: "Target environment (required for run)" },
701
- scope: {
702
- type: "string",
703
- enum: ["one", "all"],
704
- description: "Sync one or all tagged"
705
- },
706
- dry_run: { type: "boolean", description: "Simulate without changes" },
707
- include_status: { type: "boolean", description: "Also sync enabled/disabled" },
708
- // Status flags
709
- list_synced: { type: "boolean", description: "List all synced personas" },
710
- master_env: { type: "string", description: "Filter by master environment" },
711
- env: { type: "string", description: "Target environment for status queries" },
712
- },
713
- required: [],
714
- },
715
- },
716
- // ═══════════════════════════════════════════════════════════════════════
717
- // 9. DEMO - DEPRECATED: Use data() and persona() instead
718
- // ═══════════════════════════════════════════════════════════════════════
719
- {
720
- name: "demo",
721
- description: `DEPRECATED: Use \`data()\` and \`persona()\` instead. This tool routes to them internally.
722
-
723
- ## Migration Guide
724
-
725
- | OLD (deprecated) | NEW |
726
- |------------------|-----|
727
- | demo(mode="kit", persona_id="...", scenario="sales-sdr") | persona(from="demo-sales-sdr", include_data=true) |
728
- | demo(mode="generate", entity="customer", data={...}) | data(persona_id="...", mode="generate", from="customer", data={...}) |
729
- | demo(mode="scenarios") | data(mode="templates") |
730
- | demo(mode="template", entity="customer") | data(mode="templates", template="customer") |
731
-
732
- The \`data\` tool now supports document generation:
733
- data(persona_id="abc", mode="generate", input="Generate 5 customer profiles")
734
- data(persona_id="abc", mode="generate", from="demo-sales-sdr")
735
-
736
- The \`persona\` tool supports demo kit creation:
737
- persona(from="demo-sales-sdr", name="My Demo", include_data=true)
738
-
739
- This tool still works but shows a deprecation warning.`,
740
- inputSchema: {
741
- type: "object",
742
- properties: {
743
- mode: {
744
- type: "string",
745
- enum: ["kit", "validate_kit", "scenarios", "consolidate", "generate", "validate", "template"],
746
- description: "Operation"
747
- },
748
- // Kit generation flags
749
- persona_id: { type: "string", description: "Persona ID for kit generation" },
750
- scenario: {
751
- type: "string",
752
- enum: ["sales-sdr", "support-tier1", "hr-assistant"],
753
- description: "Demo scenario template"
754
- },
755
- custom_qa: {
756
- type: "array",
757
- description: "Custom Q&A pairs [{question, answer}]"
758
- },
759
- // Consolidate flags
760
- source: { type: "string", description: "Source directory" },
761
- output: { type: "string", description: "Output directory" },
762
- primary: { type: "string", description: "Primary JSON file" },
763
- joins: {
764
- type: "array",
765
- description: "Files to join [{file, on, as}]"
766
- },
767
- // Entity type
768
- entity: {
769
- type: "string",
770
- enum: ["customer", "product", "employee", "faq", "policy", "benefit", "company"],
771
- description: "Entity type"
772
- },
773
- // Generate flags
774
- data: { type: "object", description: "Entity data for generation" },
775
- related: { type: "object", description: "Related data to include" },
776
- // Validate flags
777
- file: { type: "string", description: "File path to validate" },
778
- content: { type: "string", description: "Content to validate" },
779
- // Common
780
- tags: { type: "string", description: "Tags for metadata" },
781
- },
782
- required: [],
783
- },
784
- },
785
- ];
786
- }
787
- /**
788
- * Tool name mapping for backward compatibility
789
- * Maps old tool names to new consolidated tool + args
790
- */
791
- export const LEGACY_TOOL_MAPPING = {
792
- // Environment
793
- list_environments: { tool: "env", transform: () => ({}) },
794
- // Persona tools → persona
795
- get_persona: { tool: "persona", transform: (a) => ({ ...a, mode: "get" }) },
796
- find_personas: { tool: "persona", transform: (a) => ({ ...a, all: true }) },
797
- create_ai_employee: { tool: "persona", transform: (a) => ({ ...a, mode: "create" }) },
798
- update_ai_employee: { tool: "persona", transform: (a) => ({ ...a, mode: "update", id: a.persona_id }) },
799
- compare_ai_employees: { tool: "persona", transform: (a) => ({ id: a.persona_id_1, mode: "compare", compare_to: a.persona_id_2, compare_env: a.env_2 }) },
800
- list_ai_employee_templates: { tool: "persona", transform: () => ({ templates: true }) },
801
- // Workflow tools → workflow
802
- deploy_workflow: { tool: "workflow", transform: (a) => ({ ...a, mode: "deploy" }) },
803
- optimize_workflow: { tool: "workflow", transform: (a) => ({ ...a, mode: "optimize", id: a.identifier }) },
804
- compile_workflow: { tool: "workflow", transform: (a) => ({ ...a, mode: "compile" }) },
805
- analyze_workflow: { tool: "workflow", transform: (a) => ({ ...a, mode: "analyze" }) },
806
- detect_workflow_issues: { tool: "workflow", transform: (a) => ({ ...a, mode: "analyze" }) },
807
- validate_workflow_connections: { tool: "workflow", transform: (a) => ({ ...a, mode: "analyze", include: ["connections"] }) },
808
- suggest_workflow_fixes: { tool: "workflow", transform: (a) => ({ ...a, mode: "analyze", include: ["fixes"] }) },
809
- compare_workflow_versions: { tool: "workflow", transform: (a) => ({ persona_id: a.persona_id_before, mode: "compare", compare_to: a.persona_id_after }) },
810
- get_workflow_metrics: { tool: "workflow", transform: (a) => ({ ...a, mode: "analyze", include: ["metrics"] }) },
811
- // Action tools → action
812
- get_workflow_action: { tool: "action", transform: (a) => a },
813
- find_workflow_actions: { tool: "action", transform: (a) => ({ ...a, all: true }) },
814
- list_auto_builder_agents: { tool: "action", transform: (a) => ({ ...a, all: true, include_docs: true }) },
815
- get_auto_builder_agent: { tool: "action", transform: (a) => ({ id: a.action_name, include_docs: true }) },
816
- suggest_agents_for_use_case: { tool: "action", transform: (a) => ({ suggest: a.use_case }) },
817
- // Template tools → template
818
- get_workflow_pattern: { tool: "template", transform: (a) => ({ pattern: a.pattern_name }) },
819
- list_workflow_patterns: { tool: "template", transform: (a) => ({ patterns: true, type: a.persona_type }) },
820
- get_widget_reference: { tool: "template", transform: (a) => ({ widgets: a.persona_type }) },
821
- get_voice_persona_template: { tool: "template", transform: () => ({ config: "voice" }) },
822
- get_qualifying_questions: { tool: "template", transform: (a) => ({ questions: true, ...a }) },
823
- // Knowledge tools → data (knowledge is deprecated)
824
- upload_data_source: { tool: "data", transform: (a) => ({ ...a, mode: "upload", file: a.file_path }) },
825
- delete_data_source: { tool: "data", transform: (a) => ({ ...a, mode: "delete" }) },
826
- list_data_sources: { tool: "data", transform: (a) => ({ ...a, mode: "list" }) },
827
- get_embedding_status: { tool: "data", transform: (a) => ({ ...a, mode: "embedding" }) },
828
- toggle_embedding: { tool: "data", transform: (a) => ({ ...a, mode: "embedding" }) },
829
- // Reference tools → reference
830
- get_platform_concept: { tool: "reference", transform: (a) => ({ concept: a.term }) },
831
- list_platform_concepts: { tool: "reference", transform: () => ({ concepts: true }) },
832
- get_common_mistakes: { tool: "reference", transform: () => ({ mistakes: true }) },
833
- get_debug_checklist: { tool: "reference", transform: () => ({ checklist: true }) },
834
- get_workflow_execution_model: { tool: "reference", transform: () => ({ execution: true }) },
835
- get_auto_builder_guidance: { tool: "reference", transform: (a) => ({ guidance: a.topic }) },
836
- validate_workflow_prompt: { tool: "reference", transform: (a) => ({ validate_prompt: a.prompt }) },
837
- check_type_compatibility: { tool: "reference", transform: (a) => ({ check_types: { source: a.source_type, target: a.target_type } }) },
838
- // Demo data tools → data (demo is deprecated)
839
- consolidate_demo_data: { tool: "demo", transform: (a) => ({ mode: "consolidate", source: a.source_dir, output: a.output_dir, ...a }) },
840
- generate_demo_document: { tool: "data", transform: (a) => ({ mode: "generate", from: a.entity_type, data: a.data }) },
841
- validate_demo_document: { tool: "demo", transform: (a) => ({ mode: "validate", file: a.file_path, content: a.content }) },
842
- get_demo_data_template: { tool: "data", transform: (a) => ({ mode: "templates", template: a.entity_type }) },
843
- };
844
- // Summary of consolidation
845
- export const CONSOLIDATION_SUMMARY = {
846
- before: 45,
847
- after: 7,
848
- active_tools: [
849
- { name: "env", replaces: ["list_environments"] },
850
- { name: "persona", replaces: ["get_persona", "find_personas", "create_ai_employee", "update_ai_employee", "compare_ai_employees", "list_ai_employee_templates"] },
851
- { name: "data", replaces: ["upload_data_source", "delete_data_source", "list_data_sources", "get_embedding_status", "toggle_embedding", "generate_demo_document", "get_demo_data_template"], note: "Also includes document generation" },
852
- { name: "action", replaces: ["get_workflow_action", "find_workflow_actions", "list_auto_builder_agents", "get_auto_builder_agent", "suggest_agents_for_use_case"] },
853
- { name: "template", replaces: ["get_workflow_pattern", "list_workflow_patterns", "get_widget_reference", "get_voice_persona_template", "get_qualifying_questions"] },
854
- { name: "reference", replaces: ["get_platform_concept", "list_platform_concepts", "get_common_mistakes", "get_debug_checklist", "get_workflow_execution_model", "get_auto_builder_guidance", "validate_workflow_prompt", "check_type_compatibility"] },
855
- { name: "sync", replaces: ["sync", "sync_info"] },
856
- ],
857
- deprecated_tools: [
858
- { name: "workflow", status: "deprecated", use_instead: "persona" },
859
- { name: "knowledge", status: "deprecated", use_instead: "data" },
860
- { name: "demo", status: "deprecated", use_instead: "data + persona" },
861
- ],
862
- // Legacy mapping preserved for backwards compatibility
863
- tools: [
864
- { name: "env", replaces: ["list_environments"] },
865
- { name: "persona", replaces: ["get_persona", "find_personas", "create_ai_employee", "update_ai_employee", "compare_ai_employees", "list_ai_employee_templates"] },
866
- { name: "workflow", replaces: ["workflow", "deploy_workflow", "optimize_workflow", "compile_workflow", "analyze_workflow", "detect_workflow_issues", "validate_workflow_connections", "suggest_workflow_fixes", "compare_workflow_versions", "get_workflow_metrics"], deprecated: true },
867
- { name: "action", replaces: ["get_workflow_action", "find_workflow_actions", "list_auto_builder_agents", "get_auto_builder_agent", "suggest_agents_for_use_case"] },
868
- { name: "template", replaces: ["get_workflow_pattern", "list_workflow_patterns", "get_widget_reference", "get_voice_persona_template", "get_qualifying_questions"] },
869
- { name: "knowledge", replaces: ["upload_data_source", "delete_data_source", "list_data_sources", "get_embedding_status", "toggle_embedding"], deprecated: true },
870
- { name: "data", replaces: ["generate_demo_document", "get_demo_data_template"] },
871
- { name: "reference", replaces: ["get_platform_concept", "list_platform_concepts", "get_common_mistakes", "get_debug_checklist", "get_workflow_execution_model", "get_auto_builder_guidance", "validate_workflow_prompt", "check_type_compatibility"] },
872
- { name: "sync", replaces: ["sync", "sync_info"] },
873
- { name: "demo", replaces: ["consolidate_demo_data", "validate_demo_document"], deprecated: true },
874
- ],
875
- };