@ema.co/mcp-toolkit 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.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +321 -0
  3. package/config.example.yaml +32 -0
  4. package/dist/cli/index.js +333 -0
  5. package/dist/config.js +136 -0
  6. package/dist/emaClient.js +398 -0
  7. package/dist/index.js +109 -0
  8. package/dist/mcp/handlers-consolidated.js +851 -0
  9. package/dist/mcp/index.js +15 -0
  10. package/dist/mcp/prompts.js +1753 -0
  11. package/dist/mcp/resources.js +624 -0
  12. package/dist/mcp/server.js +4723 -0
  13. package/dist/mcp/tools-consolidated.js +590 -0
  14. package/dist/mcp/tools-legacy.js +736 -0
  15. package/dist/models.js +8 -0
  16. package/dist/scheduler.js +21 -0
  17. package/dist/sdk/client.js +788 -0
  18. package/dist/sdk/config.js +136 -0
  19. package/dist/sdk/contracts.js +429 -0
  20. package/dist/sdk/generation-schema.js +189 -0
  21. package/dist/sdk/index.js +39 -0
  22. package/dist/sdk/knowledge.js +2780 -0
  23. package/dist/sdk/models.js +8 -0
  24. package/dist/sdk/state.js +88 -0
  25. package/dist/sdk/sync-options.js +216 -0
  26. package/dist/sdk/sync.js +220 -0
  27. package/dist/sdk/validation-rules.js +355 -0
  28. package/dist/sdk/workflow-generator.js +291 -0
  29. package/dist/sdk/workflow-intent.js +1585 -0
  30. package/dist/state.js +88 -0
  31. package/dist/sync.js +416 -0
  32. package/dist/syncOptions.js +216 -0
  33. package/dist/ui.js +334 -0
  34. package/docs/advisor-comms-assistant-fixes.md +175 -0
  35. package/docs/api-contracts.md +216 -0
  36. package/docs/auto-builder-analysis.md +271 -0
  37. package/docs/data-architecture.md +166 -0
  38. package/docs/ema-auto-builder-guide.html +394 -0
  39. package/docs/ema-user-guide.md +1121 -0
  40. package/docs/mcp-tools-guide.md +149 -0
  41. package/docs/naming-conventions.md +218 -0
  42. package/docs/tool-consolidation-proposal.md +427 -0
  43. package/package.json +98 -0
  44. package/resources/templates/chat-ai/README.md +119 -0
  45. package/resources/templates/chat-ai/persona-config.json +111 -0
  46. package/resources/templates/dashboard-ai/README.md +156 -0
  47. package/resources/templates/dashboard-ai/persona-config.json +180 -0
  48. package/resources/templates/voice-ai/README.md +123 -0
  49. package/resources/templates/voice-ai/persona-config.json +74 -0
  50. package/resources/templates/voice-ai/workflow-prompt.md +120 -0
@@ -0,0 +1,590 @@
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. Shows which is default.",
46
+ inputSchema: { type: "object", properties: {}, required: [] },
47
+ },
48
+ // ═══════════════════════════════════════════════════════════════════════
49
+ // 2. PERSONA - AI Employee management (CRUD + compare)
50
+ // ═══════════════════════════════════════════════════════════════════════
51
+ {
52
+ name: "persona",
53
+ description: `Unified AI Employee (persona) management.
54
+
55
+ **Get single** (default when id provided):
56
+ persona(id="IT Support Bot")
57
+ persona(id="abc-123", include_workflow=true)
58
+
59
+ **List/Search** (when --all or filters used):
60
+ persona(all=true)
61
+ persona(query="support", status="active")
62
+ persona(trigger_type="voice")
63
+
64
+ **Create**:
65
+ persona(mode="create", name="New Bot", type="voice")
66
+
67
+ **Update**:
68
+ persona(id="abc-123", mode="update", name="Renamed")
69
+
70
+ **Compare**:
71
+ persona(id="abc-123", mode="compare", compare_to="def-456")
72
+
73
+ **Templates** (list available templates):
74
+ persona(templates=true)`,
75
+ inputSchema: withEnv({
76
+ // ID (or exact name) (optional - if omitted with all=true, lists all)
77
+ id: {
78
+ type: "string",
79
+ description: "Persona ID (UUID) or exact name. Omit for list operations."
80
+ },
81
+ // Deprecated alias (backwards compatibility)
82
+ identifier: {
83
+ type: "string",
84
+ deprecated: true,
85
+ description: "DEPRECATED: use id. Persona ID (UUID) or exact name.",
86
+ },
87
+ // Mode (defaults to "get" if id provided, "list" if all=true)
88
+ mode: {
89
+ type: "string",
90
+ enum: ["get", "list", "create", "update", "compare"],
91
+ description: "Operation mode. Default: 'get' with id, 'list' without."
92
+ },
93
+ // List/Search flags
94
+ all: { type: "boolean", description: "List all personas" },
95
+ query: { type: "string", description: "Search by name (partial match)" },
96
+ status: { type: "string", description: "Filter: 'active', 'inactive', 'draft'" },
97
+ trigger_type: { type: "string", description: "Filter: 'voice', 'chat', 'dashboard'" },
98
+ limit: { type: "number", description: "Max results (default: 50)" },
99
+ // Get flags
100
+ include_workflow: { type: "boolean", description: "Include full workflow_def" },
101
+ include_fingerprint: { type: "boolean", description: "Include config hash" },
102
+ // Create flags
103
+ name: { type: "string", description: "Name (for create/update)" },
104
+ description: { type: "string", description: "Description (for create/update)" },
105
+ type: {
106
+ type: "string",
107
+ enum: ["voice", "chat", "dashboard"],
108
+ description: "Persona type (for create)"
109
+ },
110
+ template_id: { type: "string", description: "Template ID (for create)" },
111
+ clone_from: { type: "string", description: "Clone from persona ID (for create)" },
112
+ // Update flags
113
+ enabled: { type: "boolean", description: "Enable/disable (for update)" },
114
+ // Compare flags
115
+ compare_to: { type: "string", description: "Second persona ID (for compare)" },
116
+ compare_env: { type: "string", description: "Environment of compare_to persona" },
117
+ // Templates flag
118
+ templates: { type: "boolean", description: "List available templates" },
119
+ }),
120
+ },
121
+ // ═══════════════════════════════════════════════════════════════════════
122
+ // 3. WORKFLOW - Generation, analysis, deployment
123
+ // ═══════════════════════════════════════════════════════════════════════
124
+ {
125
+ name: "workflow",
126
+ description: `Unified workflow generation and analysis.
127
+
128
+ **Greenfield** (NEW workflow from scratch):
129
+ workflow(input="IT helpdesk with KB search")
130
+ workflow(mode="generate", input="customer support bot")
131
+
132
+ **Brownfield** (UPDATE existing workflow - auto-detected when persona_id + input provided):
133
+ workflow(persona_id="abc-123", input="add KB search capability")
134
+ workflow(persona_id="abc", input="add HITL approval for ticket creation")
135
+
136
+ **Analyze** (inspect existing):
137
+ workflow(persona_id="abc-123")
138
+ workflow(persona_id="abc-123", mode="analyze")
139
+ workflow(workflow_def={...}, mode="analyze")
140
+
141
+ **Deploy**:
142
+ workflow(persona_id="abc-123", mode="deploy", workflow_def={...})
143
+ workflow(persona_id="abc", mode="deploy", auto_fix=true)
144
+
145
+ **Optimize** (analyze + fix + optional deploy):
146
+ workflow(persona_id="abc-123", mode="optimize")
147
+ workflow(persona_id="abc", mode="optimize", preview=true)
148
+
149
+ **Compare**:
150
+ workflow(persona_id="abc", mode="compare", compare_to="def")
151
+
152
+ **Compile** (from node spec):
153
+ workflow(mode="compile", name="...", description="...", nodes=[...], result_mappings=[...])`,
154
+ inputSchema: withEnv({
155
+ // Common metadata (primarily used for mode="compile")
156
+ name: { type: "string", description: "Workflow name (required for compile mode)" },
157
+ description: { type: "string", description: "Workflow description (required for compile mode)" },
158
+ // Input (one of these for generation)
159
+ input: {
160
+ anyOf: [
161
+ { type: "string", description: "Natural language description" },
162
+ { type: "object", description: "Workflow intent/spec object" },
163
+ ],
164
+ description: "Natural language description OR workflow intent/spec object",
165
+ },
166
+ persona_id: {
167
+ type: "string",
168
+ description: "Persona ID for existing workflow operations"
169
+ },
170
+ workflow_def: {
171
+ type: "object",
172
+ description: "Workflow JSON for analysis or deployment"
173
+ },
174
+ // Mode
175
+ mode: {
176
+ type: "string",
177
+ enum: ["generate", "analyze", "deploy", "optimize", "compare", "compile"],
178
+ description: "Operation mode. Default: 'generate' with input, 'analyze' with persona_id. Use 'optimize' for one-click fix & deploy."
179
+ },
180
+ // Optimize flags
181
+ preview: { type: "boolean", description: "Preview changes without deploying (for optimize mode)" },
182
+ // Generate flags
183
+ type: {
184
+ type: "string",
185
+ enum: ["voice", "chat", "dashboard"],
186
+ description: "Persona type (default: chat)"
187
+ },
188
+ use_autobuilder: { type: "boolean", description: "Force Auto Builder API" },
189
+ // Analyze flags - what to include
190
+ include: {
191
+ type: "array",
192
+ items: { type: "string", enum: ["issues", "connections", "fixes", "metrics"] },
193
+ description: "What to include in analysis. Default: all.",
194
+ },
195
+ // Deploy flags
196
+ auto_fix: { type: "boolean", description: "Auto-fix issues before deploy" },
197
+ validate: { type: "boolean", description: "Validate before deploy (default: true)" },
198
+ proto_config: { type: "object", description: "Persona config (voice settings, etc.)" },
199
+ // Compare flags
200
+ compare_to: { type: "string", description: "Second persona ID for comparison" },
201
+ // Compile flags (for mode="compile")
202
+ nodes: { type: "array", description: "Node definitions for compilation" },
203
+ result_mappings: { type: "array", description: "Output mappings for compilation" },
204
+ }),
205
+ },
206
+ // ═══════════════════════════════════════════════════════════════════════
207
+ // 4. ACTION - Actions/agents lookup (API + reference docs)
208
+ // ═══════════════════════════════════════════════════════════════════════
209
+ {
210
+ name: "action",
211
+ description: `Unified action/agent lookup. Gets live API data AND reference docs.
212
+
213
+ **Get single**:
214
+ action(id="chat_categorizer")
215
+ action(id="abc-123-uuid")
216
+ action(id="search", include_docs=true)
217
+
218
+ **List/Search**:
219
+ action(all=true)
220
+ action(category="routing")
221
+ action(query="search")
222
+ action(persona_id="abc") # Actions in workflow
223
+
224
+ **Suggest for use case**:
225
+ action(suggest="IT helpdesk with ticket creation")
226
+
227
+ **Categories**:
228
+ action(categories=true)`,
229
+ inputSchema: withEnv({
230
+ // ID (or name)
231
+ id: {
232
+ type: "string",
233
+ description: "Action ID or name (e.g., 'chat_categorizer')"
234
+ },
235
+ // Deprecated alias (backwards compatibility)
236
+ identifier: {
237
+ type: "string",
238
+ deprecated: true,
239
+ description: "DEPRECATED: use id. Action ID or name (e.g., 'chat_categorizer')",
240
+ },
241
+ // List/Search flags
242
+ all: { type: "boolean", description: "List all available actions" },
243
+ query: { type: "string", description: "Search by name" },
244
+ category: { type: "string", description: "Filter by category" },
245
+ persona_id: { type: "string", description: "List actions in this workflow" },
246
+ enabled: { type: "boolean", description: "Filter by enabled status" },
247
+ limit: { type: "number", description: "Max results" },
248
+ // Include flags
249
+ include_docs: { type: "boolean", description: "Include full documentation" },
250
+ // Suggest mode
251
+ suggest: { type: "string", description: "Get recommendations for use case" },
252
+ // List categories
253
+ categories: { type: "boolean", description: "List action categories" },
254
+ }),
255
+ },
256
+ // ═══════════════════════════════════════════════════════════════════════
257
+ // 5. TEMPLATE - Patterns, widgets, persona templates
258
+ // ═══════════════════════════════════════════════════════════════════════
259
+ {
260
+ name: "template",
261
+ description: `Get workflow patterns, widget references, and configuration templates.
262
+
263
+ **Workflow patterns**:
264
+ template(pattern="intent-routing")
265
+ template(patterns=true)
266
+ template(patterns=true, type="voice")
267
+
268
+ **Widget reference**:
269
+ template(widgets="voice")
270
+ template(widgets="chat")
271
+
272
+ **Persona config template**:
273
+ template(config="voice") # Voice AI settings template
274
+
275
+ **Qualifying questions** (for requirements gathering):
276
+ template(questions=true)
277
+ template(questions=true, category="Voice")`,
278
+ inputSchema: {
279
+ type: "object",
280
+ properties: {
281
+ // Workflow patterns
282
+ pattern: {
283
+ type: "string",
284
+ enum: ["simple-kb-search", "intent-routing", "multi-source-search", "tool-calling", "hitl-approval", "document-processing", "guardrails-pattern"],
285
+ description: "Get specific workflow pattern"
286
+ },
287
+ patterns: { type: "boolean", description: "List all workflow patterns" },
288
+ // Widget reference
289
+ widgets: {
290
+ type: "string",
291
+ enum: ["voice", "chat", "dashboard"],
292
+ description: "Get widget reference for persona type"
293
+ },
294
+ // Persona config template
295
+ config: {
296
+ type: "string",
297
+ enum: ["voice", "chat", "dashboard"],
298
+ description: "Get config template (voice settings, etc.)"
299
+ },
300
+ // Qualifying questions
301
+ questions: { type: "boolean", description: "Get qualifying questions" },
302
+ category: {
303
+ type: "string",
304
+ enum: ["AI Type", "Intent", "Data", "Actions", "Validation", "Output", "Voice", "Guardrails"],
305
+ description: "Filter questions by category"
306
+ },
307
+ required_only: { type: "boolean", description: "Only required questions" },
308
+ // Filter
309
+ type: {
310
+ type: "string",
311
+ enum: ["voice", "chat", "dashboard"],
312
+ description: "Filter patterns by persona type"
313
+ },
314
+ },
315
+ required: [],
316
+ },
317
+ },
318
+ // ═══════════════════════════════════════════════════════════════════════
319
+ // 6. KNOWLEDGE - Data sources & embedding management
320
+ // ═══════════════════════════════════════════════════════════════════════
321
+ {
322
+ name: "knowledge",
323
+ description: `Manage AI Employee knowledge base (data sources & embedding).
324
+
325
+ **List files**:
326
+ knowledge(persona_id="abc-123")
327
+ knowledge(persona_id="abc", mode="list")
328
+
329
+ **Upload file**:
330
+ knowledge(persona_id="abc", mode="upload", file="/path/to/doc.pdf")
331
+
332
+ **Delete file**:
333
+ knowledge(persona_id="abc", mode="delete", file_id="file-123")
334
+
335
+ **Embedding status**:
336
+ knowledge(persona_id="abc", mode="status")
337
+
338
+ **Toggle embedding**:
339
+ knowledge(persona_id="abc", mode="toggle", enabled=true)`,
340
+ inputSchema: withEnv({
341
+ persona_id: { type: "string", description: "AI Employee ID (required)" },
342
+ mode: {
343
+ type: "string",
344
+ enum: ["list", "upload", "delete", "status", "toggle"],
345
+ description: "Operation. Default: 'list'"
346
+ },
347
+ // Upload flags
348
+ file: { type: "string", description: "File path for upload" },
349
+ tags: { type: "string", description: "Tags for uploaded file" },
350
+ // Delete flags
351
+ file_id: { type: "string", description: "File ID to delete" },
352
+ // Toggle flags
353
+ enabled: { type: "boolean", description: "Enable/disable embedding" },
354
+ }, ["persona_id"]),
355
+ },
356
+ // ═══════════════════════════════════════════════════════════════════════
357
+ // 7. REFERENCE - Platform concepts, guidance, validation
358
+ // ═══════════════════════════════════════════════════════════════════════
359
+ {
360
+ name: "reference",
361
+ description: `Get platform documentation and validation tools.
362
+
363
+ **Concepts**:
364
+ reference(concept="HITL")
365
+ reference(concepts=true) # List all
366
+
367
+ **Guidance**:
368
+ reference(guidance="categorizer-routing")
369
+ reference(guidance="type-compatibility")
370
+
371
+ **Debugging**:
372
+ reference(mistakes=true)
373
+ reference(checklist=true)
374
+ reference(execution=true) # Workflow execution model
375
+
376
+ **Validation**:
377
+ reference(check_types={source: "CHAT_CONVERSATION", target: "TEXT_WITH_SOURCES"})
378
+ reference(validate_prompt="Create a bot...")`,
379
+ inputSchema: {
380
+ type: "object",
381
+ properties: {
382
+ // Concepts
383
+ concept: { type: "string", description: "Get definition of platform term" },
384
+ concepts: { type: "boolean", description: "List all platform concepts" },
385
+ // Guidance
386
+ guidance: {
387
+ type: "string",
388
+ enum: [
389
+ "categorizer-routing", "type-compatibility", "named-inputs",
390
+ "hitl-patterns", "multi-source-search", "voice-tool-calling",
391
+ "guardrails", "output-mapping", "workflow-execution", "conversation-vs-query"
392
+ ],
393
+ description: "Get guidance on topic"
394
+ },
395
+ // Debugging
396
+ mistakes: { type: "boolean", description: "Get common mistakes list" },
397
+ checklist: { type: "boolean", description: "Get debug checklist" },
398
+ execution: { type: "boolean", description: "Get workflow execution model" },
399
+ // Validation
400
+ check_types: {
401
+ type: "object",
402
+ properties: {
403
+ source: { type: "string", description: "Source output type" },
404
+ target: { type: "string", description: "Target input type" },
405
+ },
406
+ description: "Check type compatibility"
407
+ },
408
+ validate_prompt: { type: "string", description: "Validate workflow prompt" },
409
+ },
410
+ required: [],
411
+ },
412
+ },
413
+ // ═══════════════════════════════════════════════════════════════════════
414
+ // 8. SYNC - Environment synchronization
415
+ // ═══════════════════════════════════════════════════════════════════════
416
+ {
417
+ name: "sync",
418
+ description: `Sync AI Employees across environments.
419
+
420
+ **Sync single**:
421
+ sync(id="IT Support", target="dev")
422
+ sync(id="abc-123", target="staging", dry_run=true)
423
+
424
+ **Sync all tagged**:
425
+ sync(target="dev", scope="all")
426
+
427
+ **Status**:
428
+ sync(mode="status", id="abc-123")
429
+ sync(mode="status", list_synced=true)
430
+
431
+ **Config**:
432
+ sync(mode="config")`,
433
+ inputSchema: {
434
+ type: "object",
435
+ properties: {
436
+ // What to sync
437
+ id: { type: "string", description: "Persona ID or name" },
438
+ // Deprecated alias (backwards compatibility)
439
+ identifier: { type: "string", deprecated: true, description: "DEPRECATED: use id. Persona ID or name" },
440
+ // Mode
441
+ mode: {
442
+ type: "string",
443
+ enum: ["run", "status", "config"],
444
+ description: "Operation. Default: 'run'"
445
+ },
446
+ // Sync flags
447
+ source: { type: "string", description: "Source environment (default: current)" },
448
+ target: { type: "string", description: "Target environment (required for run)" },
449
+ scope: {
450
+ type: "string",
451
+ enum: ["one", "all"],
452
+ description: "Sync one or all tagged"
453
+ },
454
+ dry_run: { type: "boolean", description: "Simulate without changes" },
455
+ include_status: { type: "boolean", description: "Also sync enabled/disabled" },
456
+ // Status flags
457
+ list_synced: { type: "boolean", description: "List all synced personas" },
458
+ master_env: { type: "string", description: "Filter by master environment" },
459
+ env: { type: "string", description: "Target environment for status queries" },
460
+ },
461
+ required: [],
462
+ },
463
+ },
464
+ // ═══════════════════════════════════════════════════════════════════════
465
+ // 9. DEMO - Demo data management (keep as separate concern)
466
+ // ═══════════════════════════════════════════════════════════════════════
467
+ {
468
+ name: "demo",
469
+ description: `Manage demo data for RAG knowledge bases.
470
+
471
+ **Consolidate** (join JSON → Markdown):
472
+ demo(mode="consolidate", source="./data", output="./kb", entity="customer", primary="customers.json")
473
+
474
+ **Generate single document**:
475
+ demo(mode="generate", entity="customer", data={...})
476
+
477
+ **Validate document**:
478
+ demo(mode="validate", file="./kb/customer-acme.md")
479
+
480
+ **Get template**:
481
+ demo(mode="template", entity="customer")`,
482
+ inputSchema: {
483
+ type: "object",
484
+ properties: {
485
+ mode: {
486
+ type: "string",
487
+ enum: ["consolidate", "generate", "validate", "template"],
488
+ description: "Operation"
489
+ },
490
+ // Consolidate flags
491
+ source: { type: "string", description: "Source directory" },
492
+ output: { type: "string", description: "Output directory" },
493
+ primary: { type: "string", description: "Primary JSON file" },
494
+ joins: {
495
+ type: "array",
496
+ description: "Files to join [{file, on, as}]"
497
+ },
498
+ // Entity type
499
+ entity: {
500
+ type: "string",
501
+ enum: ["customer", "product", "employee", "scenario", "reference"],
502
+ description: "Entity type"
503
+ },
504
+ // Generate flags
505
+ data: { type: "object", description: "Entity data for generation" },
506
+ related: { type: "object", description: "Related data to include" },
507
+ // Validate flags
508
+ file: { type: "string", description: "File path to validate" },
509
+ content: { type: "string", description: "Content to validate" },
510
+ // Common
511
+ tags: { type: "string", description: "Tags for metadata" },
512
+ },
513
+ required: [],
514
+ },
515
+ },
516
+ ];
517
+ }
518
+ /**
519
+ * Tool name mapping for backward compatibility
520
+ * Maps old tool names to new consolidated tool + args
521
+ */
522
+ export const LEGACY_TOOL_MAPPING = {
523
+ // Environment
524
+ list_environments: { tool: "env", transform: () => ({}) },
525
+ // Persona tools → persona
526
+ get_persona: { tool: "persona", transform: (a) => ({ ...a, mode: "get" }) },
527
+ find_personas: { tool: "persona", transform: (a) => ({ ...a, all: true }) },
528
+ create_ai_employee: { tool: "persona", transform: (a) => ({ ...a, mode: "create" }) },
529
+ update_ai_employee: { tool: "persona", transform: (a) => ({ ...a, mode: "update", id: a.persona_id }) },
530
+ 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 }) },
531
+ list_ai_employee_templates: { tool: "persona", transform: () => ({ templates: true }) },
532
+ // Workflow tools → workflow
533
+ deploy_workflow: { tool: "workflow", transform: (a) => ({ ...a, mode: "deploy" }) },
534
+ optimize_workflow: { tool: "workflow", transform: (a) => ({ ...a, mode: "optimize", id: a.identifier }) },
535
+ compile_workflow: { tool: "workflow", transform: (a) => ({ ...a, mode: "compile" }) },
536
+ analyze_workflow: { tool: "workflow", transform: (a) => ({ ...a, mode: "analyze" }) },
537
+ detect_workflow_issues: { tool: "workflow", transform: (a) => ({ ...a, mode: "analyze" }) },
538
+ validate_workflow_connections: { tool: "workflow", transform: (a) => ({ ...a, mode: "analyze", include: ["connections"] }) },
539
+ suggest_workflow_fixes: { tool: "workflow", transform: (a) => ({ ...a, mode: "analyze", include: ["fixes"] }) },
540
+ compare_workflow_versions: { tool: "workflow", transform: (a) => ({ persona_id: a.persona_id_before, mode: "compare", compare_to: a.persona_id_after }) },
541
+ get_workflow_metrics: { tool: "workflow", transform: (a) => ({ ...a, mode: "analyze", include: ["metrics"] }) },
542
+ // Action tools → action
543
+ get_workflow_action: { tool: "action", transform: (a) => a },
544
+ find_workflow_actions: { tool: "action", transform: (a) => ({ ...a, all: true }) },
545
+ list_auto_builder_agents: { tool: "action", transform: (a) => ({ ...a, all: true, include_docs: true }) },
546
+ get_auto_builder_agent: { tool: "action", transform: (a) => ({ id: a.action_name, include_docs: true }) },
547
+ suggest_agents_for_use_case: { tool: "action", transform: (a) => ({ suggest: a.use_case }) },
548
+ // Template tools → template
549
+ get_workflow_pattern: { tool: "template", transform: (a) => ({ pattern: a.pattern_name }) },
550
+ list_workflow_patterns: { tool: "template", transform: (a) => ({ patterns: true, type: a.persona_type }) },
551
+ get_widget_reference: { tool: "template", transform: (a) => ({ widgets: a.persona_type }) },
552
+ get_voice_persona_template: { tool: "template", transform: () => ({ config: "voice" }) },
553
+ get_qualifying_questions: { tool: "template", transform: (a) => ({ questions: true, ...a }) },
554
+ // Knowledge tools → knowledge
555
+ upload_data_source: { tool: "knowledge", transform: (a) => ({ ...a, mode: "upload", file: a.file_path }) },
556
+ delete_data_source: { tool: "knowledge", transform: (a) => ({ ...a, mode: "delete" }) },
557
+ list_data_sources: { tool: "knowledge", transform: (a) => ({ ...a, mode: "list" }) },
558
+ get_embedding_status: { tool: "knowledge", transform: (a) => ({ ...a, mode: "status" }) },
559
+ toggle_embedding: { tool: "knowledge", transform: (a) => ({ ...a, mode: "toggle" }) },
560
+ // Reference tools → reference
561
+ get_platform_concept: { tool: "reference", transform: (a) => ({ concept: a.term }) },
562
+ list_platform_concepts: { tool: "reference", transform: () => ({ concepts: true }) },
563
+ get_common_mistakes: { tool: "reference", transform: () => ({ mistakes: true }) },
564
+ get_debug_checklist: { tool: "reference", transform: () => ({ checklist: true }) },
565
+ get_workflow_execution_model: { tool: "reference", transform: () => ({ execution: true }) },
566
+ get_auto_builder_guidance: { tool: "reference", transform: (a) => ({ guidance: a.topic }) },
567
+ validate_workflow_prompt: { tool: "reference", transform: (a) => ({ validate_prompt: a.prompt }) },
568
+ check_type_compatibility: { tool: "reference", transform: (a) => ({ check_types: { source: a.source_type, target: a.target_type } }) },
569
+ // Demo data tools → demo
570
+ consolidate_demo_data: { tool: "demo", transform: (a) => ({ mode: "consolidate", source: a.source_dir, output: a.output_dir, ...a }) },
571
+ generate_demo_document: { tool: "demo", transform: (a) => ({ mode: "generate", ...a }) },
572
+ validate_demo_document: { tool: "demo", transform: (a) => ({ mode: "validate", file: a.file_path, content: a.content }) },
573
+ get_demo_data_template: { tool: "demo", transform: (a) => ({ mode: "template", entity: a.entity_type }) },
574
+ };
575
+ // Summary of consolidation
576
+ export const CONSOLIDATION_SUMMARY = {
577
+ before: 45,
578
+ after: 9,
579
+ tools: [
580
+ { name: "env", replaces: ["list_environments"] },
581
+ { name: "persona", replaces: ["get_persona", "find_personas", "create_ai_employee", "update_ai_employee", "compare_ai_employees", "list_ai_employee_templates"] },
582
+ { 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"] },
583
+ { name: "action", replaces: ["get_workflow_action", "find_workflow_actions", "list_auto_builder_agents", "get_auto_builder_agent", "suggest_agents_for_use_case"] },
584
+ { name: "template", replaces: ["get_workflow_pattern", "list_workflow_patterns", "get_widget_reference", "get_voice_persona_template", "get_qualifying_questions"] },
585
+ { name: "knowledge", replaces: ["upload_data_source", "delete_data_source", "list_data_sources", "get_embedding_status", "toggle_embedding"] },
586
+ { 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"] },
587
+ { name: "sync", replaces: ["sync", "sync_info"] },
588
+ { name: "demo", replaces: ["consolidate_demo_data", "generate_demo_document", "validate_demo_document", "get_demo_data_template"] },
589
+ ],
590
+ };