@lightdash-tools/mcp 0.17.0 → 0.19.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 (54) hide show
  1. package/README.md +17 -12
  2. package/dist/config/enabled-profiles.test.js +6 -0
  3. package/dist/policy/envelope.d.ts +1 -1
  4. package/dist/profiles/ai-agent-chat/v1/index.d.ts +6 -0
  5. package/dist/profiles/ai-agent-chat/v1/index.js +29 -0
  6. package/dist/profiles/ai-agent-chat/v1/invariants.d.ts +33 -0
  7. package/dist/profiles/ai-agent-chat/v1/invariants.js +47 -0
  8. package/dist/profiles/ai-agent-chat/v1/prompts.d.ts +9 -0
  9. package/dist/profiles/ai-agent-chat/v1/prompts.js +68 -0
  10. package/dist/profiles/ai-agent-chat/v1/prompts.test.d.ts +4 -0
  11. package/dist/profiles/ai-agent-chat/v1/prompts.test.js +62 -0
  12. package/dist/profiles/ai-agent-chat/v1/resources/playbooks/conversation.md +70 -0
  13. package/dist/profiles/ai-agent-chat/v1/resources/playbooks/core.md +56 -0
  14. package/dist/profiles/ai-agent-chat/v1/resources/playbooks/index.md +8 -0
  15. package/dist/profiles/ai-agent-chat/v1/resources/playbooks.d.ts +11 -0
  16. package/dist/profiles/ai-agent-chat/v1/resources/playbooks.js +32 -0
  17. package/dist/profiles/content-reader/v1/invariants.d.ts +1 -1
  18. package/dist/profiles/content-reader/v1/invariants.js +1 -1
  19. package/dist/profiles/content-reader/v1/resources/playbooks/compare.md +1 -1
  20. package/dist/profiles/content-reader/v1/resources/playbooks/core.md +2 -2
  21. package/dist/profiles/content-reader/v1/resources/playbooks/discover.md +1 -1
  22. package/dist/profiles/content-reader/v1/resources/playbooks/explain-run.md +13 -11
  23. package/dist/profiles/index.d.ts +1 -0
  24. package/dist/profiles/index.js +33 -29
  25. package/dist/profiles/index.test.js +27 -7
  26. package/dist/tools/ai-agents/agents.d.ts +3 -1
  27. package/dist/tools/ai-agents/agents.js +16 -4
  28. package/dist/tools/ai-agents/agents.test.js +27 -31
  29. package/dist/tools/ai-agents/discovery.js +4 -4
  30. package/dist/tools/ai-agents/evaluations.js +9 -9
  31. package/dist/tools/ai-agents/helpers.d.ts +13 -2
  32. package/dist/tools/ai-agents/helpers.js +8 -4
  33. package/dist/tools/ai-agents/router.d.ts +12 -0
  34. package/dist/tools/ai-agents/router.js +33 -0
  35. package/dist/tools/ai-agents/router.test.d.ts +1 -0
  36. package/dist/tools/ai-agents/router.test.js +99 -0
  37. package/dist/tools/ai-agents/test-support.d.ts +24 -0
  38. package/dist/tools/ai-agents/test-support.js +34 -0
  39. package/dist/tools/ai-agents/threads.d.ts +12 -1
  40. package/dist/tools/ai-agents/threads.js +72 -5
  41. package/dist/tools/ai-agents/threads.test.d.ts +4 -0
  42. package/dist/tools/ai-agents/threads.test.js +184 -0
  43. package/dist/tools/project/projects.js +1 -0
  44. package/dist/tools/project/projects.test.js +1 -0
  45. package/dist/tools/project/reader-content.d.ts +40 -0
  46. package/dist/tools/project/reader-content.js +18 -2
  47. package/dist/tools/project/reader-content.test.d.ts +1 -1
  48. package/dist/tools/project/reader-content.test.js +77 -1
  49. package/dist/tools/project/reader-execution.d.ts +1 -1
  50. package/dist/tools/project/reader-execution.js +127 -68
  51. package/dist/tools/project/reader-execution.test.d.ts +4 -0
  52. package/dist/tools/project/reader-execution.test.js +246 -0
  53. package/dist/tools/query/filter-overrides.d.ts +1 -1
  54. package/package.json +5 -5
package/README.md CHANGED
@@ -1,20 +1,21 @@
1
1
  # [@lightdash-tools/mcp](https://www.npmjs.com/package/@lightdash-tools/mcp) <!-- markdown-link-check-disable-line -->
2
2
 
3
- MCP server for Lightdash with **profile-scoped** surfaces. One package, seven profiles: explore/compile, org audit, saved-content reads, chart/dashboard authoring, soft-delete governance, AI-agent ops, and ad-hoc Explore queries. Uses [`@lightdash-tools/client`](https://www.npmjs.com/package/@lightdash-tools/client) for API access. <!-- markdown-link-check-disable-line -->
3
+ MCP server for Lightdash with **profile-scoped** surfaces. One package, eight profiles: explore/compile, org audit, saved-content reads, chart/dashboard authoring, soft-delete governance, AI-agent ops, AI-agent chat, and ad-hoc Explore queries. Uses [`@lightdash-tools/client`](https://www.npmjs.com/package/@lightdash-tools/client) for API access. <!-- markdown-link-check-disable-line -->
4
4
 
5
5
  Developing this package? See [CONTRIBUTING.md](./CONTRIBUTING.md).
6
6
 
7
7
  ## Choose a profile
8
8
 
9
- | Profile | Use when | HTTP path | Stdio `--profile` | Catalog |
10
- | :------------------- | :--------------------------------------- | :--------------------------- | :------------------- | :--------------------------------------------------------------- |
11
- | `semantic-layer` | Explore metrics, compile queries | `/semantic-layer/v1/mcp` | `semantic-layer` | — |
12
- | `organization-audit` | Read-only org governance | `/organization-audit/v1/mcp` | `organization-audit` | [inventory](../../docs/profiles/organization-audit/inventory.md) |
13
- | `content-reader` | Discover and run saved content | `/content-reader/v1/mcp` | `content-reader` | [inventory](../../docs/profiles/content-reader/inventory.md) |
14
- | `content-developer` | Author charts/dashboards (preview gate) | `/content-developer/v1/mcp` | `content-developer` | [inventory](../../docs/profiles/content-developer/inventory.md) |
15
- | `content-governance` | Soft-delete / promote (form elicitation) | `/content-governance/v1/mcp` | `content-governance` | [inventory](../../docs/profiles/content-governance/inventory.md) |
16
- | `ai-agent-ops` | Thin AI-agent APIs + product eval runs | `/ai-agent-ops/v1/mcp` | `ai-agent-ops` | [inventory](../../docs/profiles/ai-agent-ops/inventory.md) |
17
- | `data-analyst` | Unsaved Explore metric queries | `/data-analyst/v1/mcp` | `data-analyst` | [inventory](../../docs/profiles/data-analyst/inventory.md) |
9
+ | Profile | Use when | HTTP path | Stdio `--profile` | Catalog |
10
+ | :------------------- | :----------------------------------------- | :--------------------------- | :------------------- | :--------------------------------------------------------------- |
11
+ | `semantic-layer` | Explore metrics, compile queries | `/semantic-layer/v1/mcp` | `semantic-layer` | — |
12
+ | `organization-audit` | Read-only org governance | `/organization-audit/v1/mcp` | `organization-audit` | [inventory](../../docs/profiles/organization-audit/inventory.md) |
13
+ | `content-reader` | Discover and run saved content | `/content-reader/v1/mcp` | `content-reader` | [inventory](../../docs/profiles/content-reader/inventory.md) |
14
+ | `content-developer` | Author charts/dashboards (preview gate) | `/content-developer/v1/mcp` | `content-developer` | [inventory](../../docs/profiles/content-developer/inventory.md) |
15
+ | `content-governance` | Soft-delete / promote (form elicitation) | `/content-governance/v1/mcp` | `content-governance` | [inventory](../../docs/profiles/content-governance/inventory.md) |
16
+ | `ai-agent-ops` | Thin AI-agent APIs + product eval runs | `/ai-agent-ops/v1/mcp` | `ai-agent-ops` | [inventory](../../docs/profiles/ai-agent-ops/inventory.md) |
17
+ | `ai-agent-chat` | Use existing AI Agents as the current user | `/ai-agent-chat/v1/mcp` | `ai-agent-chat` | [inventory](../../docs/profiles/ai-agent-chat/inventory.md) |
18
+ | `data-analyst` | Unsaved Explore metric queries | `/data-analyst/v1/mcp` | `data-analyst` | [inventory](../../docs/profiles/data-analyst/inventory.md) |
18
19
 
19
20
  Tool names are prefixed with `lightdash_`. MCP display names are shortened where needed for client length limits (e.g. `lightdash-mcp-content`).
20
21
 
@@ -131,7 +132,7 @@ Governance soft-delete needs client form elicitation; missing capability → `EL
131
132
 
132
133
  ### Profile allowlist
133
134
 
134
- Optional HTTP-only mount ceiling. Unset or empty → all seven shipped profile paths. Non-empty → only listed profile ids are mounted; other paths (and their path-specific OAuth PRM) 404. Stdio ignores this variable (`stdio --profile` still required).
135
+ Optional HTTP-only mount ceiling. Unset or empty → all eight shipped profile paths. Non-empty → only listed profile ids are mounted; other paths (and their path-specific OAuth PRM) 404. Stdio ignores this variable (`stdio --profile` still required).
135
136
 
136
137
  **Format**
137
138
 
@@ -221,6 +222,10 @@ Soft-delete charts/dashboards and elicitation-gated dashboard promote. Permanent
221
222
 
222
223
  Thin AI-agent inventory, readiness, thread reads, and product evaluation suite/run APIs. No agent CRUD or thread generate on MCP. Server name: `lightdash-mcp-aops`. Loop engineering: [docs/profiles/ai-agent-ops/loop.md](../../docs/profiles/ai-agent-ops/loop.md).
223
224
 
225
+ ### `ai-agent-chat`
226
+
227
+ Use existing Lightdash AI Agents as the authenticated Lightdash user. Supports accessible-agent discovery (preferences + AI Router `route_agent`), URL/UUID grounding in playbooks, and the user's own conversation flow (new: `create_agent_thread` with `prompt` → `generate_agent_response`; follow-up: `create_agent_thread_message` → `generate_agent_response`). The profile does not expose AI-agent administration, evaluations, SQL mode, or Lightdash content mutation. The selected Lightdash AI Agent may still use tools configured for that agent. Server name: `lightdash-mcp-aichat`. Inventory: [docs/profiles/ai-agent-chat/inventory.md](../../docs/profiles/ai-agent-chat/inventory.md). Hosted viewer deployments should set `LIGHTDASH_TOOLS_MCP_PROFILES=ai-agent-chat` plus a project UUID ceiling.
228
+
224
229
  ### `data-analyst`
225
230
 
226
231
  Unsaved Explore-style metric queries (`run_metric_query`) with explore discovery and optional `compile_query`. Bounded rows; no chart save. Server name: `lightdash-mcp-analyst`.
@@ -228,7 +233,7 @@ Unsaved Explore-style metric queries (`run_metric_query`) with explore discovery
228
233
  ## Safety
229
234
 
230
235
  - **Off MCP:** irrecoverable admin deletes, permanent content purge, broad org mutations — use `@lightdash-tools/client` or the CLI ([ADR-0004](../../docs/adr/0004-agent-safe-exposure-mcp-cli-vs-client-only.md)).
231
- - **Writes:** only on `content-developer` (preview gate). Soft-delete / promote: only on `content-governance` (form elicitation).
236
+ - **Writes:** `content-developer` (preview gate). Soft-delete / promote: `content-governance` (form elicitation). `ai-agent-chat` creates threads/messages and triggers open-world managed-agent generation (nested agent tools stay Lightdash-governed).
232
237
  - **Redaction:** emails masked unless `includeEmail=true`; scheduler destinations redacted unless `revealDestinations=true`; warehouse/dbt connection secrets never on MCP ([ADR-0011](../../docs/adr/0011-mcp-tool-response-sensitivity-classes.md)).
233
238
  - **Project scope:** optional HTTP pin `X-Lightdash-Project`, else tool `projectUuid`; optional ceiling [`LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS`](#project-allowlist).
234
239
 
@@ -31,6 +31,7 @@ const env_js_1 = require("./env.js");
31
31
  (0, vitest_1.it)('treats unrestricted as all profiles enabled', () => {
32
32
  (0, vitest_1.expect)((0, enabled_profiles_js_1.isProfileEnabled)(enabled_profiles_js_1.UNRESTRICTED_ENABLED_PROFILES, 'content-governance')).toBe(true);
33
33
  (0, vitest_1.expect)((0, enabled_profiles_js_1.isProfileEnabled)(enabled_profiles_js_1.UNRESTRICTED_ENABLED_PROFILES, 'data-analyst')).toBe(true);
34
+ (0, vitest_1.expect)((0, enabled_profiles_js_1.isProfileEnabled)(enabled_profiles_js_1.UNRESTRICTED_ENABLED_PROFILES, 'ai-agent-chat')).toBe(true);
34
35
  (0, vitest_1.expect)((0, enabled_profiles_js_1.requiresSignedStateKey)(enabled_profiles_js_1.UNRESTRICTED_ENABLED_PROFILES)).toBe(true);
35
36
  });
36
37
  (0, vitest_1.it)('restricts to listed ids', () => {
@@ -43,6 +44,7 @@ const env_js_1 = require("./env.js");
43
44
  (0, vitest_1.expect)((0, enabled_profiles_js_1.requiresSignedStateKey)((0, enabled_profiles_js_1.parseEnabledProfiles)('content-developer'))).toBe(true);
44
45
  (0, vitest_1.expect)((0, enabled_profiles_js_1.requiresSignedStateKey)((0, enabled_profiles_js_1.parseEnabledProfiles)('content-governance'))).toBe(true);
45
46
  (0, vitest_1.expect)((0, enabled_profiles_js_1.requiresSignedStateKey)((0, enabled_profiles_js_1.parseEnabledProfiles)('content-reader,content-developer'))).toBe(true);
47
+ (0, vitest_1.expect)((0, enabled_profiles_js_1.requiresSignedStateKey)((0, enabled_profiles_js_1.parseEnabledProfiles)('ai-agent-chat'))).toBe(false);
46
48
  });
47
49
  (0, vitest_1.it)('uses semantic-layer mcpPath when unrestricted or when that id is listed', () => {
48
50
  (0, vitest_1.expect)((0, enabled_profiles_js_1.resolveRootMcpPath)(enabled_profiles_js_1.UNRESTRICTED_ENABLED_PROFILES)).toBe(index_js_1.SEMANTIC_LAYER_PROFILE_PATH);
@@ -53,6 +55,10 @@ const env_js_1 = require("./env.js");
53
55
  (0, vitest_1.expect)((0, enabled_profiles_js_1.resolveRootMcpPath)((0, enabled_profiles_js_1.parseEnabledProfiles)('content-reader,content-developer'))).toBe(index_js_1.CONTENT_DEVELOPER_PROFILE_PATH);
54
56
  (0, vitest_1.expect)(common_1.PROFILE_IDS.indexOf('content-developer')).toBeLessThan(common_1.PROFILE_IDS.indexOf('content-reader'));
55
57
  });
58
+ (0, vitest_1.it)('anchors root PRM on ai-agent-chat when it is the first enabled PROFILE_IDS id', () => {
59
+ (0, vitest_1.expect)((0, enabled_profiles_js_1.resolveRootMcpPath)((0, enabled_profiles_js_1.parseEnabledProfiles)('ai-agent-chat,ai-agent-ops'))).toBe(index_js_1.AI_AGENT_CHAT_PROFILE_PATH);
60
+ (0, vitest_1.expect)(common_1.PROFILE_IDS.indexOf('ai-agent-chat')).toBeLessThan(common_1.PROFILE_IDS.indexOf('ai-agent-ops'));
61
+ });
56
62
  (0, vitest_1.it)('lists shipped paths when unrestricted and only enabled paths when restricted', () => {
57
63
  (0, vitest_1.expect)((0, enabled_profiles_js_1.listEnabledProfilePaths)(enabled_profiles_js_1.UNRESTRICTED_ENABLED_PROFILES)).toEqual(common_1.PROFILE_IDS.map((id) => (0, index_js_1.getProfile)(id).path));
58
64
  (0, vitest_1.expect)((0, enabled_profiles_js_1.listEnabledProfilePaths)((0, enabled_profiles_js_1.parseEnabledProfiles)('content-reader'))).toEqual([
@@ -2,7 +2,7 @@
2
2
  * Content response envelope helpers (RFC §10 / ADR-0006).
3
3
  */
4
4
  import type { ProfileId } from '@lightdash-tools/common';
5
- export type ContentReaderWarningCode = 'CACHE_STALE' | 'FILTER_IGNORED' | 'PARAMETER_DEFAULTED' | 'PARTIAL_RESULT' | 'QUERY_RUNNING' | 'QUERY_TIMEOUT' | 'REDACTED' | 'SQL_EXECUTION_DISABLED' | 'STALE_CONTENT' | 'TRUNCATED' | 'UNSUPPORTED_TILE' | 'UNVERIFIED_CONTENT';
5
+ export type ContentReaderWarningCode = 'CACHE_STALE' | 'DATE_ZOOM_IGNORED' | 'FILTER_IGNORED' | 'PARAMETER_DEFAULTED' | 'PARTIAL_RESULT' | 'QUERY_RUNNING' | 'QUERY_TIMEOUT' | 'REDACTED' | 'SQL_EXECUTION_DISABLED' | 'SQL_RESULT_MAY_BE_ROW_LEVEL' | 'STALE_CONTENT' | 'TRUNCATED' | 'UNSUPPORTED_TILE' | 'UNVERIFIED_CONTENT';
6
6
  export type ContentReaderWarning = {
7
7
  code: ContentReaderWarningCode;
8
8
  message: string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * AI-agent-chat profile: managed Lightdash AI-agent conversation (ADR-0029).
3
+ */
4
+ import type { ProfileDefinition } from '../../types.js';
5
+ export declare const AI_AGENT_CHAT_PROFILE_PATH: "/ai-agent-chat/v1/mcp";
6
+ export declare const aiAgentChatProfile: ProfileDefinition;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * AI-agent-chat profile: managed Lightdash AI-agent conversation (ADR-0029).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.aiAgentChatProfile = exports.AI_AGENT_CHAT_PROFILE_PATH = void 0;
7
+ const agents_js_1 = require("../../../tools/ai-agents/agents.js");
8
+ const router_js_1 = require("../../../tools/ai-agents/router.js");
9
+ const threads_js_1 = require("../../../tools/ai-agents/threads.js");
10
+ const prompts_js_1 = require("./prompts.js");
11
+ const playbooks_js_1 = require("./resources/playbooks.js");
12
+ exports.AI_AGENT_CHAT_PROFILE_PATH = '/ai-agent-chat/v1/mcp';
13
+ exports.aiAgentChatProfile = {
14
+ id: 'ai-agent-chat',
15
+ path: exports.AI_AGENT_CHAT_PROFILE_PATH,
16
+ serverName: 'lightdash-mcp-aichat',
17
+ tools: [
18
+ agents_js_1.listProjectAgentsTool,
19
+ agents_js_1.getUserAgentPreferencesTool,
20
+ router_js_1.routeAgentTool,
21
+ threads_js_1.listAgentThreadsTool,
22
+ threads_js_1.getAgentThreadTool,
23
+ threads_js_1.createAgentThreadTool,
24
+ threads_js_1.createAgentThreadMessageTool,
25
+ threads_js_1.generateAgentResponseTool,
26
+ ],
27
+ registerPrompts: prompts_js_1.registerAiAgentChatPrompts,
28
+ registerResources: playbooks_js_1.registerAiAgentChatPlaybook,
29
+ };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * AI-agent-chat structured prompt invariants (SSOT for capsules + HARD_BANS projection).
3
+ */
4
+ export declare const AI_AGENT_CHAT_INVARIANTS: readonly [{
5
+ readonly id: "no-agent-admin";
6
+ readonly short: "Do not create, update, delete, or reconfigure AI Agents.";
7
+ }, {
8
+ readonly id: "no-agent-evaluations";
9
+ readonly short: "Do not create, change, delete, or run AI-agent evaluations.";
10
+ }, {
11
+ readonly id: "own-thread-scope";
12
+ readonly short: "Use only caller-visible threads for the current Lightdash identity. Do not seek cross-user conversation access, take over other users' threads, or invent allUsers listing.";
13
+ }, {
14
+ readonly id: "no-sql-mode";
15
+ readonly short: "Do not attempt to enable SQL mode or approve SQL.";
16
+ }, {
17
+ readonly id: "no-agent-mcp-config";
18
+ readonly short: "Do not add, remove, authenticate, or reconfigure MCP servers/tools attached to an agent.";
19
+ }, {
20
+ readonly id: "no-host-reimplementation";
21
+ readonly short: "Do not replace the requested managed Lightdash AI Agent with data-analyst/semantic-layer tools unless the user explicitly asks for that alternative.";
22
+ }, {
23
+ readonly id: "conversation-is-open-world";
24
+ readonly short: "Generation may invoke model, warehouse, and configured agent tools; do not describe it as read-only.";
25
+ }, {
26
+ readonly id: "respect-project-scope";
27
+ readonly short: "Resolve and enforce the existing project pin/allowlist contract.";
28
+ }, {
29
+ readonly id: "no-host-agent-heuristic";
30
+ readonly short: "Do not invent an agent pick from instruction text, enableContentTools, tags, or fuzzy name match — use named/hint, preferences, route_agent, single-agent fallback, or ask the user.";
31
+ }];
32
+ export declare const AI_AGENT_CHAT_HARD_BANS: string;
33
+ export declare const AI_AGENT_CHAT_DEFAULT_INVARIANT_IDS: readonly ("no-agent-admin" | "no-agent-evaluations" | "own-thread-scope" | "no-sql-mode" | "no-agent-mcp-config" | "no-host-reimplementation" | "conversation-is-open-world" | "respect-project-scope" | "no-host-agent-heuristic")[];
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * AI-agent-chat structured prompt invariants (SSOT for capsules + HARD_BANS projection).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AI_AGENT_CHAT_DEFAULT_INVARIANT_IDS = exports.AI_AGENT_CHAT_HARD_BANS = exports.AI_AGENT_CHAT_INVARIANTS = void 0;
7
+ const prompt_invariants_js_1 = require("../../lib/prompt-invariants.js");
8
+ exports.AI_AGENT_CHAT_INVARIANTS = [
9
+ {
10
+ id: 'no-agent-admin',
11
+ short: 'Do not create, update, delete, or reconfigure AI Agents.',
12
+ },
13
+ {
14
+ id: 'no-agent-evaluations',
15
+ short: 'Do not create, change, delete, or run AI-agent evaluations.',
16
+ },
17
+ {
18
+ id: 'own-thread-scope',
19
+ short: "Use only caller-visible threads for the current Lightdash identity. Do not seek cross-user conversation access, take over other users' threads, or invent allUsers listing.",
20
+ },
21
+ {
22
+ id: 'no-sql-mode',
23
+ short: 'Do not attempt to enable SQL mode or approve SQL.',
24
+ },
25
+ {
26
+ id: 'no-agent-mcp-config',
27
+ short: 'Do not add, remove, authenticate, or reconfigure MCP servers/tools attached to an agent.',
28
+ },
29
+ {
30
+ id: 'no-host-reimplementation',
31
+ short: 'Do not replace the requested managed Lightdash AI Agent with data-analyst/semantic-layer tools unless the user explicitly asks for that alternative.',
32
+ },
33
+ {
34
+ id: 'conversation-is-open-world',
35
+ short: 'Generation may invoke model, warehouse, and configured agent tools; do not describe it as read-only.',
36
+ },
37
+ {
38
+ id: 'respect-project-scope',
39
+ short: 'Resolve and enforce the existing project pin/allowlist contract.',
40
+ },
41
+ {
42
+ id: 'no-host-agent-heuristic',
43
+ short: 'Do not invent an agent pick from instruction text, enableContentTools, tags, or fuzzy name match — use named/hint, preferences, route_agent, single-agent fallback, or ask the user.',
44
+ },
45
+ ];
46
+ exports.AI_AGENT_CHAT_HARD_BANS = (0, prompt_invariants_js_1.formatHardBansProjection)(exports.AI_AGENT_CHAT_INVARIANTS);
47
+ exports.AI_AGENT_CHAT_DEFAULT_INVARIANT_IDS = (0, prompt_invariants_js_1.allInvariantIds)(exports.AI_AGENT_CHAT_INVARIANTS);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * MCP prompts for ai-agent-chat workflows (progressive-disclosure context).
3
+ *
4
+ * Procedure detail lives in playbooks (manifest / selective embed via policy).
5
+ * Prompt bodies stay goal/input-specific — do not restate entire SOPs here.
6
+ */
7
+ import type { RegisterPromptsOptions } from '../../types.js';
8
+ import type { McpServer } from '@modelcontextprotocol/server';
9
+ export declare function registerAiAgentChatPrompts(server: McpServer, options?: RegisterPromptsOptions): void;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ /**
3
+ * MCP prompts for ai-agent-chat workflows (progressive-disclosure context).
4
+ *
5
+ * Procedure detail lives in playbooks (manifest / selective embed via policy).
6
+ * Prompt bodies stay goal/input-specific — do not restate entire SOPs here.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.registerAiAgentChatPrompts = registerAiAgentChatPrompts;
10
+ /* eslint-disable @typescript-eslint/no-deprecated -- matches other profile prompt registration pattern */
11
+ const zod_1 = require("zod");
12
+ const schema_fields_js_1 = require("../../../tools/lib/schema-fields.js");
13
+ const prompt_context_js_1 = require("../../lib/prompt-context.js");
14
+ const invariants_js_1 = require("./invariants.js");
15
+ const playbooks_js_1 = require("./resources/playbooks.js");
16
+ const TOPIC_CONVERSATION = 'conversation';
17
+ const bindPromptContext = (0, prompt_context_js_1.bindProfilePromptContext)({
18
+ invariants: invariants_js_1.AI_AGENT_CHAT_INVARIANTS,
19
+ core: playbooks_js_1.AI_AGENT_CHAT_CORE_PLAYBOOK,
20
+ topics: playbooks_js_1.AI_AGENT_CHAT_TOPIC_PLAYBOOKS,
21
+ topicMeta: playbooks_js_1.AI_AGENT_CHAT_TOPIC_META,
22
+ });
23
+ function registerAiAgentChatPrompts(server, options) {
24
+ const promptContext = bindPromptContext(options === null || options === void 0 ? void 0 : options.promptContextPolicy);
25
+ const invariantIds = invariants_js_1.AI_AGENT_CHAT_DEFAULT_INVARIANT_IDS;
26
+ server.registerPrompt('ask_lightdash_ai_agent', {
27
+ title: 'Ask Lightdash AI Agent',
28
+ description: 'Start a new managed Lightdash AI Agent conversation as the current user — do not substitute data-analyst',
29
+ argsSchema: {
30
+ projectUuid: (0, schema_fields_js_1.optionalProjectUuidField)(),
31
+ question: zod_1.z.string(),
32
+ agentHint: zod_1.z.string().optional(),
33
+ },
34
+ }, ({ projectUuid, question, agentHint }) => promptContext({
35
+ task: `Start a **new** managed Lightdash AI Agent conversation (not a host-side Explore rewrite):
36
+
37
+ ${question}
38
+
39
+ ${(0, schema_fields_js_1.formatPromptProjectUuidLine)(projectUuid)}
40
+ Agent hint: ${agentHint !== null && agentHint !== void 0 ? agentHint : '(none — follow conversation playbook selection)'}.
41
+
42
+ Follow the conversation playbook: select agent → ground URL/UUID on create (and on route_agent only when that step runs) → create_agent_thread with prompt → generate_agent_response. Do not call create_agent_thread_message on the first turn. Do not list or resume threads for a plain question. On generate failure, report the upstream error — do not silently switch to data-analyst or semantic-layer.`,
43
+ invariantIds,
44
+ requiredTopics: [TOPIC_CONVERSATION],
45
+ }));
46
+ server.registerPrompt('continue_lightdash_ai_agent', {
47
+ title: 'Continue Lightdash AI Agent thread',
48
+ description: "Add a follow-up on a known own-thread UUID and generate — do not auto-browse or take over other users' threads",
49
+ argsSchema: {
50
+ projectUuid: (0, schema_fields_js_1.optionalProjectUuidField)(),
51
+ agentUuid: zod_1.z.string().optional(),
52
+ threadUuid: zod_1.z.string().optional(),
53
+ question: zod_1.z.string(),
54
+ },
55
+ }, ({ projectUuid, agentUuid, threadUuid, question }) => promptContext({
56
+ task: `Continue a managed Lightdash AI Agent conversation on a **known** own-thread UUID.
57
+
58
+ ${(0, schema_fields_js_1.formatPromptProjectUuidLine)(projectUuid)}
59
+ Agent: ${agentUuid !== null && agentUuid !== void 0 ? agentUuid : '(from current context)'}.
60
+ Thread: ${threadUuid !== null && threadUuid !== void 0 ? threadUuid : '(reuse known threadUuid from this session; if missing ask the user or start a new ask — do not default to list_agent_threads)'}.
61
+ Follow-up: ${question}
62
+
63
+ Use create_agent_thread_message then generate_agent_response. Do not create a second message when retrying generate. List caller-visible threads only if the user explicitly asks to find their own prior chat.`,
64
+ invariantIds,
65
+ requiredTopics: [TOPIC_CONVERSATION],
66
+ }));
67
+ }
68
+ /* eslint-enable @typescript-eslint/no-deprecated */
@@ -0,0 +1,4 @@
1
+ /**
2
+ * AI-agent-chat prompt/playbook invariants.
3
+ */
4
+ export {};
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ /**
3
+ * AI-agent-chat prompt/playbook invariants.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const vitest_1 = require("vitest");
7
+ const playbook_invariants_js_1 = require("../../test-support/playbook-invariants.js");
8
+ const invariants_js_1 = require("./invariants.js");
9
+ const playbooks_js_1 = require("./resources/playbooks.js");
10
+ (0, vitest_1.describe)('ai-agent-chat prompts/playbook', () => {
11
+ (0, vitest_1.it)('playbook references registered tools and hard bans', () => {
12
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
13
+ (0, playbook_invariants_js_1.expectPlaybookCoversProfileTools)('ai-agent-chat', md);
14
+ (0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
15
+ (0, vitest_1.expect)(playbooks_js_1.AI_AGENT_CHAT_HARD_BANS.toLowerCase()).toContain('sql mode');
16
+ (0, vitest_1.expect)(playbooks_js_1.AI_AGENT_CHAT_HARD_BANS.toLowerCase()).toContain('evaluations');
17
+ });
18
+ (0, vitest_1.it)('conversation playbook teaches preference then route_agent, two-call new chat, follow-up message, and no data-analyst fallback', () => {
19
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
20
+ (0, vitest_1.expect)(md).toContain('get_user_agent_preferences');
21
+ (0, vitest_1.expect)(md).toContain('route_agent');
22
+ (0, vitest_1.expect)(md).toContain('create_agent_thread');
23
+ (0, vitest_1.expect)(md).toContain('create_agent_thread_message');
24
+ (0, vitest_1.expect)(md).toContain('generate_agent_response');
25
+ (0, vitest_1.expect)(md).toContain('includemessagetext');
26
+ (0, vitest_1.expect)(md).toContain('data-analyst');
27
+ (0, vitest_1.expect)(md).toContain('open-world');
28
+ (0, vitest_1.expect)(md).toMatch(/empty create fails|prompt \(required|exact.*user prompt|grounded prompt/);
29
+ (0, vitest_1.expect)(md).toMatch(/do \*\*not\*\* call `create_agent_thread_message` on the first turn/);
30
+ (0, vitest_1.expect)(md).toMatch(/show_picker|ask the user/);
31
+ (0, vitest_1.expect)(md).toMatch(/dashboarduuid|target content/);
32
+ (0, vitest_1.expect)(md).toMatch(/never.*invent|enablecontenttools|instruction text/);
33
+ (0, vitest_1.expect)(md).toMatch(/exact.*match|case-insensitive/);
34
+ (0, vitest_1.expect)(md).toMatch(/resolved.*scope|pin wins|differ.*pin/);
35
+ });
36
+ (0, vitest_1.it)('invariants ban host agent heuristics', () => {
37
+ const heuristic = invariants_js_1.AI_AGENT_CHAT_INVARIANTS.find((i) => i.id === 'no-host-agent-heuristic');
38
+ (0, vitest_1.expect)(heuristic).toBeDefined();
39
+ (0, vitest_1.expect)(heuristic.short.toLowerCase()).toMatch(/route_agent|heuristic|enablecontenttools/);
40
+ (0, vitest_1.expect)(playbooks_js_1.AI_AGENT_CHAT_HARD_BANS.toLowerCase()).toMatch(/enablecontenttools|route_agent/);
41
+ });
42
+ (0, vitest_1.it)('new-by-default: plain questions create a thread; follow-up needs a known threadUuid', () => {
43
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
44
+ (0, vitest_1.expect)(md).toMatch(/new conversation|default/);
45
+ (0, vitest_1.expect)(md).toContain('create_agent_thread');
46
+ (0, vitest_1.expect)(md).toMatch(/known thread|threaduuid|this.session|this session/);
47
+ (0, vitest_1.expect)(md).not.toMatch(/else\s+list_agent_threads/);
48
+ (0, vitest_1.expect)(md).not.toMatch(/otherwise\s+list_agent_threads/);
49
+ });
50
+ (0, vitest_1.it)('forbids cross-user takeover and allUsers thread listing in playbook and invariants', () => {
51
+ const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
52
+ const bans = playbooks_js_1.AI_AGENT_CHAT_HARD_BANS.toLowerCase();
53
+ const ownScope = invariants_js_1.AI_AGENT_CHAT_INVARIANTS.find((i) => i.id === 'own-thread-scope');
54
+ (0, vitest_1.expect)(ownScope).toBeDefined();
55
+ (0, vitest_1.expect)(ownScope.short.toLowerCase()).toMatch(/allusers|cross-user|take.?over/);
56
+ (0, vitest_1.expect)(md).toContain('allusers');
57
+ (0, vitest_1.expect)(bans).toContain('allusers');
58
+ (0, vitest_1.expect)(md).toMatch(/caller-visible|current (user|lightdash identity)|own/);
59
+ (0, vitest_1.expect)(md).toMatch(/do not (seek|attempt|enable).{0,40}(allusers|cross-user|take.?over)/);
60
+ (0, vitest_1.expect)(md).not.toMatch(/pass\s+allusers|set\s+allusers|allusers\s*=\s*true/);
61
+ });
62
+ });
@@ -0,0 +1,70 @@
1
+ # AI-agent-chat conversation
2
+
3
+ URI: `lightdash://playbooks/ai-agent-chat/conversation`
4
+
5
+ ## Goal
6
+
7
+ Delegate a business question to the **managed Lightdash AI Agent** and return that agent's answer. **Default to a new conversation.** Continue only with a known own-thread UUID (this session or user-supplied). Do not auto-browse threads on a plain question.
8
+
9
+ ## New conversation (default)
10
+
11
+ When the user simply asks a question:
12
+
13
+ 1. Resolve project via the existing pin / `projectUuid` / allowlist contract (pin wins). A Lightdash URL may supply the arg when no pin conflicts; if the URL `projectUuid` differs from the pin or allowlist, **ask or refuse** — do not override the pin.
14
+ 2. If the user **named** an agent (or prompt `agentHint`), resolve that name with an **exact** match on `list_project_agents` (case-insensitive). Do not substring/fuzzy match. Do not prefer the default first when a name/hint is present.
15
+ 3. Else `get_user_agent_preferences`. If a `defaultAgentUuid` is present, use it (upstream RBAC already scopes visibility). Preferring the default over Auto matches the Lightdash UI; URL grounding below still applies on create.
16
+ 4. Else call **`route_agent`** with the grounded prompt (see URL grounding).
17
+ - `nextAction === create_thread` → use `decision.suggestedAgentUuid`.
18
+ - `nextAction === show_picker` → present `decision.candidates` (and reasoning) and **ask the user**; do not auto-pick.
19
+ - Router unavailable (404 / error): `list_project_agents`. If **exactly one** agent → use it; else **ask the user**.
20
+ 5. **Never** invent a pick by matching instruction text, `enableContentTools`, tags, or fuzzy name similarity.
21
+ 6. `create_agent_thread` with the grounded prompt (required — empty create fails upstream).
22
+ 7. `generate_agent_response`.
23
+ 8. Return the generated result. When the user supplied a dashboard/chart UUID, the reply must cite **title + UUID**; mismatch → one follow-up on the same thread demanding content tools open that UUID.
24
+
25
+ Do **not** call `create_agent_thread_message` on the first turn (the prompt is already on the thread). Do **not** call `list_agent_threads` on a plain new question.
26
+
27
+ ## URL / UUID grounding
28
+
29
+ When the user prompt contains a Lightdash dashboard or chart URL (or bare content UUID):
30
+
31
+ 1. Parse content ids from the path (`dashboardUuid` and/or chart UUID). The Target block's `projectUuid` **must** be the **resolved** project scope from step 1 — never a different project from the URL.
32
+ 2. Prefix the create prompt with a structured block, for example:
33
+
34
+ ```text
35
+ Target content (do not substitute another dashboard/chart from agent instructions):
36
+ - projectUuid: <resolved-scope-uuid>
37
+ - dashboardUuid: <uuid> # and/or chartUuid: <uuid>
38
+ User question:
39
+ <original question>
40
+ ```
41
+
42
+ 3. Always pass that full string to `create_agent_thread`. Pass it to `route_agent` **only when** step 4 runs (named/default already skipped routing).
43
+
44
+ Residual risk: a user default agent may still be space-scoped away from the Target content; title+UUID follow-up is the safety net (ADR-0031).
45
+
46
+ ## Follow-up (known threadUuid)
47
+
48
+ When the user continues and a **threadUuid** is already known (prompt args or this session):
49
+
50
+ 1. `create_agent_thread_message` on that thread.
51
+ 2. `generate_agent_response`.
52
+ 3. Do not create a second message when retrying generate after a failed generation.
53
+
54
+ If `threadUuid` is missing: ask the user for it, or start a **new conversation** (above). Do **not** default to `list_agent_threads`.
55
+
56
+ ## Optional own-history lookup
57
+
58
+ Only when the user **explicitly** asks to find or continue _their_ prior chat (and no threadUuid is known):
59
+
60
+ 1. `list_agent_threads` with `includeMessageText=false` (caller-visible threads only — never invent `allUsers`).
61
+ 2. Request `includeMessageText=true` only when identification needs conversation text.
62
+ 3. Confirm the thread with the user when ambiguous, then follow-up (message + generate).
63
+
64
+ Do not take over other users' threads. Admin thread visibility in the Lightdash app is not an MCP workflow.
65
+
66
+ ## Failures
67
+
68
+ Report the upstream failure. Do **not** silently switch to `data-analyst`, `semantic-layer`, or native Lightdash MCP and pretend the result came from the managed agent.
69
+
70
+ Generation is open-world and non-idempotent. Agent-connected tools are governed in Lightdash, not by hidden MCP switches. See [Lightdash AI Agents](https://docs.lightdash.com/guides/ai-agents) and [AI Router](https://docs.lightdash.com/agents/enable-ai-router).
@@ -0,0 +1,56 @@
1
+ # AI-agent-chat core
2
+
3
+ URI: `lightdash://playbooks/ai-agent-chat/core`
4
+
5
+ ## Purpose
6
+
7
+ Use an **existing** Lightdash AI Agent as the authenticated Lightdash user. Discover an accessible agent (preference or **AI Router**), **default to a new conversation**, and ask Lightdash to generate the managed-agent response. Continue only with a known own-thread UUID (or explicit own-history lookup when the user asks).
8
+
9
+ This profile does **not** administer agents, run evaluations, author charts, or execute Explore metric queries. Generation is **open-world**: the selected agent may query the warehouse and invoke tools configured on that agent in Lightdash. Do not describe this mount as read-only.
10
+
11
+ ## Hard bans
12
+
13
+ - Do not create, update, delete, or reconfigure AI Agents.
14
+ - Do not create, change, delete, or run AI-agent evaluations.
15
+ - Do not seek cross-user conversation access, take over other users' threads, or invent `allUsers` listing (`allUsers` is not available on this mount).
16
+ - Do not attempt to enable SQL mode or approve SQL.
17
+ - Do not add, remove, authenticate, or reconfigure MCP servers/tools attached to an agent.
18
+ - Do not replace the requested managed Lightdash AI Agent with `data-analyst` / `semantic-layer` tools unless the user explicitly asks for that alternative.
19
+ - Do not describe generation as read-only.
20
+ - Do not run tools outside the resolved project.
21
+ - Do not invent an agent pick by matching instruction text, `enableContentTools`, tags, or fuzzy name similarity — use named/`agentHint`, preferences, `route_agent`, single-agent fallback, or ask the user.
22
+
23
+ ## Allowed tools (`lightdash_*`)
24
+
25
+ | Tool | Use for |
26
+ | ----------------------------- | ----------------------------------------------------------------- |
27
+ | `list_project_agents` | Discover agents (named exact match; single-agent Router fallback) |
28
+ | `get_user_agent_preferences` | Resolve the caller's per-project default agent |
29
+ | `route_agent` | AI Router best-fit when no name/default (then create → generate) |
30
+ | `list_agent_threads` | List caller-visible thread summaries (redacted) |
31
+ | `get_agent_thread` | Read one accessible thread (redacted by default) |
32
+ | `create_agent_thread` | Create a conversation with the first user prompt |
33
+ | `create_agent_thread_message` | Store a follow-up prompt on an existing thread |
34
+ | `generate_agent_response` | Invoke managed Lightdash AI-agent generation |
35
+
36
+ `list_project_agents` returns the upstream agent summary. It may include instruction, integrations, and flags such as `enableSqlMode`. Treat those as Lightdash configuration facts, not switches this profile can change — and **not** as a host-side ranking signal.
37
+
38
+ `route_agent` returns an org AI Router decision for **managed-agent conversation**. It does **not** activate Data MCP session agent context (`set_agent`). Upstream may persist a decision row (including the prompt). When `nextAction` is `show_picker`, ask the user. Selection-only but **not** annotated read-only.
39
+
40
+ `list_agent_threads` / `get_agent_thread` return only threads visible to the **current** identity. That is the ceiling — not admin or cross-user takeover.
41
+
42
+ ## Project scope
43
+
44
+ 1. Pass **`projectUuid`** or rely on HTTP `X-Lightdash-Project`. Without either → `PROJECT_SCOPE_REQUIRED`.
45
+ 2. `LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS` is a hard ceiling when set.
46
+
47
+ ## Privacy
48
+
49
+ - Thread reads redact conversation text unless `includeMessageText=true`.
50
+ - `generate_agent_response` returns the generated answer (that is the tool's purpose).
51
+ - Audit logs do not include prompt or response bodies.
52
+ - Do not treat Lightdash app admin thread visibility as an MCP workflow.
53
+
54
+ ## Retry
55
+
56
+ `create_agent_thread` (with prompt), `create_agent_thread_message`, and `generate_agent_response` are non-idempotent. After an ambiguous network failure, do not blindly create again. New conversations: create with prompt → generate. Follow-ups: message → generate. If the user message already exists, retry `generate_agent_response` only. `route_agent` persists a decision upstream — prefer not to retry blindly after an ambiguous failure; if the host already has `decisionUuid` / `suggestedAgentUuid`, reuse that pick.
@@ -0,0 +1,8 @@
1
+ # AI-agent-chat playbooks
2
+
3
+ URI: `lightdash://playbooks/ai-agent-chat`
4
+
5
+ | Topic | URI | Purpose |
6
+ | ------------ | -------------------------------------------------- | -------------------------------------------------------------------- |
7
+ | core | `lightdash://playbooks/ai-agent-chat/core` | Hard bans, tools, project scope, open-world generate |
8
+ | conversation | `lightdash://playbooks/ai-agent-chat/conversation` | New-by-default chat; known-UUID follow-up; optional own-history only |
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Multi-playbook resources for ai-agent-chat (core + conversation).
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/server';
5
+ export type AiAgentChatPlaybookTopic = 'conversation';
6
+ export { AI_AGENT_CHAT_HARD_BANS } from '../invariants.js';
7
+ export declare const getAllPlaybookMarkdown: () => string;
8
+ export declare const AI_AGENT_CHAT_CORE_PLAYBOOK: import("../../../lib/playbook-resources.js").EmbeddedPlaybook;
9
+ export declare const AI_AGENT_CHAT_TOPIC_PLAYBOOKS: Readonly<Record<"conversation", import("../../../lib/playbook-resources.js").EmbeddedPlaybook>>;
10
+ export declare const AI_AGENT_CHAT_TOPIC_META: Readonly<Record<"conversation", import("../../../lib/playbook-resources.js").PromptTopicMeta>>;
11
+ export declare function registerAiAgentChatPlaybook(server: McpServer): void;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
3
+ * Multi-playbook resources for ai-agent-chat (core + conversation).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AI_AGENT_CHAT_TOPIC_META = exports.AI_AGENT_CHAT_TOPIC_PLAYBOOKS = exports.AI_AGENT_CHAT_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.AI_AGENT_CHAT_HARD_BANS = void 0;
7
+ exports.registerAiAgentChatPlaybook = registerAiAgentChatPlaybook;
8
+ const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
9
+ const playbooks = (0, playbook_resources_js_1.defineProfilePlaybooks)({
10
+ profileId: 'ai-agent-chat',
11
+ moduleDir: __dirname,
12
+ coreDescription: 'Hard bans, tool catalog, and open-world generation rules',
13
+ topics: [
14
+ {
15
+ id: 'conversation',
16
+ title: 'AI-agent-chat conversation playbook',
17
+ description: 'Select an agent; new conversation by default, continue only on a known own-thread UUID',
18
+ file: 'conversation.md',
19
+ useWhen: 'Asking a Lightdash AI Agent a new question or continuing a known own-thread',
20
+ priority: 0.8,
21
+ },
22
+ ],
23
+ });
24
+ var invariants_js_1 = require("../invariants.js");
25
+ Object.defineProperty(exports, "AI_AGENT_CHAT_HARD_BANS", { enumerable: true, get: function () { return invariants_js_1.AI_AGENT_CHAT_HARD_BANS; } });
26
+ exports.getAllPlaybookMarkdown = playbooks.getAllPlaybookMarkdown;
27
+ exports.AI_AGENT_CHAT_CORE_PLAYBOOK = playbooks.CORE_PLAYBOOK;
28
+ exports.AI_AGENT_CHAT_TOPIC_PLAYBOOKS = playbooks.TOPIC_PLAYBOOKS;
29
+ exports.AI_AGENT_CHAT_TOPIC_META = playbooks.TOPIC_META;
30
+ function registerAiAgentChatPlaybook(server) {
31
+ playbooks.registerPlaybooks(server);
32
+ }
@@ -12,7 +12,7 @@ export declare const CONTENT_READER_INVARIANTS: readonly [{
12
12
  readonly short: "Do not download or bulk-export results.";
13
13
  }, {
14
14
  readonly id: "no-sql-chart-execution";
15
- readonly short: "Do not execute saved SQL charts (disabled by default on content-reader).";
15
+ readonly short: "Do not execute ad-hoc SQL or standalone SQL charts; saved dashboard SQL tiles are allowed.";
16
16
  }, {
17
17
  readonly id: "no-override-semantics";
18
18
  readonly short: "Do not override filter targets, operators, required-filter behavior, fields, metrics, dimensions, SQL, table calculations, or sorts.";
@@ -20,7 +20,7 @@ exports.CONTENT_READER_INVARIANTS = [
20
20
  },
21
21
  {
22
22
  id: 'no-sql-chart-execution',
23
- short: 'Do not execute saved SQL charts (disabled by default on content-reader).',
23
+ short: 'Do not execute ad-hoc SQL or standalone SQL charts; saved dashboard SQL tiles are allowed.',
24
24
  },
25
25
  {
26
26
  id: 'no-override-semantics',
@@ -22,7 +22,7 @@ Compare **definitions before values**. Matching titles/labels ≠ same metric, g
22
22
 
23
23
  Execute **only** if sides are structurally comparable **or** the user asked about value differences. Use equivalent valid context (same overrides if any). Cap at **≤2** executions unless the user expands scope.
24
24
 
25
- Skip execution when either side is SQL / non-executable — report that as a confirmed blocker.
25
+ Skip execution when either side is a **standalone** SQL chart (`run_chart` / `source=sql`) or otherwise non-executable — report that as a confirmed blocker. Dashboard `sql_chart` tiles may be executed via `run_dashboard_tile`.
26
26
 
27
27
  ## Report causes
28
28
 
@@ -11,7 +11,7 @@ Discover, explain, and **optionally execute** saved Lightdash charts/dashboards
11
11
  - Do not mutate Lightdash resources (create/update/delete/move/promote).
12
12
  - Do not execute arbitrary metric queries, raw SQL, SQL runner, or underlying-data downloads.
13
13
  - Do not bulk-export or page endlessly through result sets.
14
- - Do not execute saved SQL charts (`source=sql` / `chartType=sql`); default capability is off (`canExecuteSqlCharts=false`).
14
+ - Do not execute ad-hoc SQL, SQL runner, or standalone SQL charts (`source=sql` / `chartType=sql`; `canExecuteSqlCharts=false`). Saved dashboard SQL tiles (`sql_chart`, `canExecuteDashboardSqlTiles=true`) may be executed via `run_dashboard_tile`.
15
15
  - Do not override filter **targets/operators**, required-filter behavior, fields, metrics, dimensions, SQL, table calculations, or sorts — only allowed **value** overrides on existing filter ids / known parameters.
16
16
  - Do not execute content outside the resolved project.
17
17
  - Do not present truncated / incomplete coverage as a full answer.
@@ -57,7 +57,7 @@ Record budget / pagination / truncation stops in the answer.
57
57
  ## Phase 0 — Resolve project
58
58
 
59
59
  1. Always pass **`projectUuid`** (or rely on HTTP `X-Lightdash-Project` pin). Without either → `PROJECT_SCOPE_REQUIRED`; stop.
60
- 2. Call `get_project`. Record UUID, name, `context.projectPinned`, and `readerCapabilities` (`canExecuteSavedCharts`, `canExecuteSqlCharts`, `canExecuteDashboardTiles`).
60
+ 2. Call `get_project`. Record UUID, name, `context.projectPinned`, and `readerCapabilities` (`canExecuteSavedCharts`, `canExecuteSqlCharts`, `canExecuteDashboardTiles`, `canExecuteDashboardSqlTiles`).
61
61
  3. There is **no** org-wide project list on this profile — never invent one.
62
62
 
63
63
  ## Answer shape