@lightdash-tools/mcp 0.8.0 → 0.9.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 (214) hide show
  1. package/README.md +108 -237
  2. package/dist/audit/server-persona.d.ts +10 -0
  3. package/dist/audit/server-persona.js +19 -0
  4. package/dist/auth/oauth-broker/pending-store.d.ts +6 -7
  5. package/dist/auth/oauth-broker/pending-store.js +3 -4
  6. package/dist/auth/oauth-broker/pending-store.test.d.ts +2 -3
  7. package/dist/auth/oauth-broker/pending-store.test.js +2 -39
  8. package/dist/auth/oauth-broker/routes.d.ts +1 -1
  9. package/dist/auth/oauth-broker/routes.js +3 -3
  10. package/dist/auth/oauth-broker/routes.test.js +1 -1
  11. package/dist/auth/request-state-key.d.ts +19 -0
  12. package/dist/auth/request-state-key.js +49 -0
  13. package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +0 -2
  14. package/dist/auth/resource-server/lightdash-oauth-middleware.js +0 -19
  15. package/dist/auth/resource-server/www-authenticate.test.js +0 -2
  16. package/dist/bin.js +9 -2
  17. package/dist/config/env.d.ts +5 -15
  18. package/dist/config/env.js +6 -16
  19. package/dist/config/load-mcp-config.d.ts +0 -4
  20. package/dist/config/load-mcp-config.js +8 -9
  21. package/dist/config/normalize-url.test.js +14 -11
  22. package/dist/config/runtime.d.ts +3 -3
  23. package/dist/config/runtime.js +19 -23
  24. package/dist/config/runtime.test.js +23 -9
  25. package/dist/config/test-mcp-http-config.js +1 -1
  26. package/dist/destructive/content-promote.js +7 -1
  27. package/dist/destructive/promote-contract.test.js +106 -47
  28. package/dist/destructive/register-destructive-tool.js +6 -24
  29. package/dist/destructive/request-state.d.ts +2 -6
  30. package/dist/destructive/request-state.js +3 -38
  31. package/dist/destructive/types.d.ts +2 -1
  32. package/dist/governance/available-projects.d.ts +37 -0
  33. package/dist/governance/available-projects.js +132 -0
  34. package/dist/governance/available-projects.test.d.ts +4 -0
  35. package/dist/governance/available-projects.test.js +107 -0
  36. package/dist/governance/client-capabilities-cache.d.ts +44 -0
  37. package/dist/governance/client-capabilities-cache.js +142 -0
  38. package/dist/governance/client-capabilities-cache.test.js +148 -0
  39. package/dist/governance/mcp-client-session.d.ts +3 -2
  40. package/dist/governance/mcp-client-session.js +3 -2
  41. package/dist/governance/project-scope.d.ts +8 -22
  42. package/dist/governance/project-scope.js +36 -44
  43. package/dist/governance/project-scope.test.d.ts +1 -1
  44. package/dist/governance/project-scope.test.js +21 -44
  45. package/dist/governance/promote-allowlist.d.ts +18 -0
  46. package/dist/governance/promote-allowlist.js +66 -0
  47. package/dist/governance/promote-allowlist.test.d.ts +4 -0
  48. package/dist/governance/promote-allowlist.test.js +87 -0
  49. package/dist/http.integration.test.js +117 -262
  50. package/dist/http.test.js +0 -12
  51. package/dist/index.integration.test.js +0 -4
  52. package/dist/index.js +3 -1
  53. package/dist/personas/ai-agent-ops/v1/index.d.ts +8 -0
  54. package/dist/personas/ai-agent-ops/v1/index.js +41 -0
  55. package/dist/personas/ai-agent-ops/v1/prompts.d.ts +5 -0
  56. package/dist/personas/ai-agent-ops/v1/prompts.js +141 -0
  57. package/dist/personas/ai-agent-ops/v1/prompts.test.d.ts +4 -0
  58. package/dist/personas/ai-agent-ops/v1/prompts.test.js +26 -0
  59. package/dist/personas/ai-agent-ops/v1/resources/playbooks/core.md +39 -0
  60. package/dist/personas/ai-agent-ops/v1/resources/playbooks/evaluation.md +25 -0
  61. package/dist/personas/ai-agent-ops/v1/resources/playbooks/index.md +14 -0
  62. package/dist/personas/ai-agent-ops/v1/resources/playbooks/loop-engineering.md +28 -0
  63. package/dist/personas/ai-agent-ops/v1/resources/playbooks/release-gate.md +22 -0
  64. package/dist/personas/ai-agent-ops/v1/resources/playbooks.d.ts +10 -0
  65. package/dist/personas/ai-agent-ops/v1/resources/playbooks.js +41 -0
  66. package/dist/personas/content-developer/v1/index.d.ts +1 -1
  67. package/dist/personas/content-developer/v1/index.js +1 -0
  68. package/dist/personas/content-developer/v1/prompts.d.ts +3 -0
  69. package/dist/personas/content-developer/v1/prompts.js +80 -61
  70. package/dist/personas/content-developer/v1/prompts.test.js +159 -3
  71. package/dist/personas/content-developer/v1/resources/playbooks/chart-types.md +123 -0
  72. package/dist/personas/content-developer/v1/resources/playbooks/content-move.md +13 -6
  73. package/dist/personas/content-developer/v1/resources/playbooks/core.md +91 -49
  74. package/dist/personas/content-developer/v1/resources/playbooks/dashboard-design.md +153 -0
  75. package/dist/personas/content-developer/v1/resources/playbooks/dashboards.md +82 -34
  76. package/dist/personas/content-developer/v1/resources/playbooks/index.md +9 -7
  77. package/dist/personas/content-developer/v1/resources/playbooks.d.ts +1 -1
  78. package/dist/personas/content-developer/v1/resources/playbooks.js +29 -10
  79. package/dist/personas/content-governance/v1/resources/playbooks/core.md +1 -1
  80. package/dist/personas/content-governance/v1/resources/playbooks/dashboards.md +1 -1
  81. package/dist/personas/content-reader/v1/index.d.ts +1 -1
  82. package/dist/personas/content-reader/v1/index.js +1 -0
  83. package/dist/personas/content-reader/v1/prompts.js +64 -30
  84. package/dist/personas/content-reader/v1/resources/playbooks/compare.md +24 -9
  85. package/dist/personas/content-reader/v1/resources/playbooks/core.md +56 -29
  86. package/dist/personas/content-reader/v1/resources/playbooks/discover.md +27 -5
  87. package/dist/personas/content-reader/v1/resources/playbooks/explain-run.md +38 -8
  88. package/dist/personas/content-reader/v1/resources/playbooks/index.md +8 -8
  89. package/dist/personas/content-reader/v1/resources/playbooks.js +2 -2
  90. package/dist/personas/index.d.ts +1 -0
  91. package/dist/personas/index.js +27 -22
  92. package/dist/personas/index.test.js +68 -53
  93. package/dist/personas/lib/playbook-resources.d.ts +4 -3
  94. package/dist/personas/lib/playbook-resources.js +14 -10
  95. package/dist/personas/organization-audit/v1/prompts.js +68 -36
  96. package/dist/personas/organization-audit/v1/resources/playbooks/access.md +12 -4
  97. package/dist/personas/organization-audit/v1/resources/playbooks/content.md +13 -3
  98. package/dist/personas/organization-audit/v1/resources/playbooks/core.md +49 -16
  99. package/dist/personas/organization-audit/v1/resources/playbooks/deliveries.md +8 -3
  100. package/dist/personas/organization-audit/v1/resources/playbooks/index.md +8 -8
  101. package/dist/personas/organization-audit/v1/resources/playbooks.js +1 -1
  102. package/dist/personas/persona.parity.test.js +14 -10
  103. package/dist/personas/semantic-layer/v1/prompts.js +50 -39
  104. package/dist/personas/semantic-layer/v1/resources/playbooks/compose-compile.md +36 -31
  105. package/dist/personas/semantic-layer/v1/resources/playbooks/core.md +53 -21
  106. package/dist/personas/semantic-layer/v1/resources/playbooks/explore.md +42 -39
  107. package/dist/personas/semantic-layer/v1/resources/playbooks/index.md +6 -6
  108. package/dist/personas/semantic-layer/v1/resources/playbooks.js +2 -2
  109. package/dist/personas/types.d.ts +1 -1
  110. package/dist/policy/content-developer.d.ts +3 -3
  111. package/dist/policy/content-developer.js +3 -3
  112. package/dist/policy/content-developer.test.js +10 -4
  113. package/dist/policy/content-reader.d.ts +5 -1
  114. package/dist/policy/content-reader.js +18 -3
  115. package/dist/policy/content-reader.test.js +2 -1
  116. package/dist/policy/preview-ledger-fault.test.js +101 -426
  117. package/dist/policy/preview-ledger.d.ts +38 -74
  118. package/dist/policy/preview-ledger.js +108 -186
  119. package/dist/policy/preview-ledger.test.js +237 -111
  120. package/dist/policy/result-limits.d.ts +6 -1
  121. package/dist/policy/result-limits.js +28 -29
  122. package/dist/policy/result-limits.test.js +10 -1
  123. package/dist/server/capabilities.js +2 -0
  124. package/dist/server/capabilities.test.js +2 -0
  125. package/dist/server/server.js +12 -8
  126. package/dist/server/upstream-errors.d.ts +17 -0
  127. package/dist/server/upstream-errors.js +60 -0
  128. package/dist/server/upstream-errors.test.js +50 -0
  129. package/dist/stdio.process.test.js +4 -2
  130. package/dist/tools/ai-agents/agents.d.ts +7 -0
  131. package/dist/tools/ai-agents/agents.js +32 -0
  132. package/dist/tools/ai-agents/agents.test.js +176 -0
  133. package/dist/tools/ai-agents/discovery.d.ts +9 -0
  134. package/dist/tools/ai-agents/discovery.js +73 -0
  135. package/dist/tools/ai-agents/evaluations.d.ts +14 -0
  136. package/dist/tools/ai-agents/evaluations.js +177 -0
  137. package/dist/tools/ai-agents/helpers.d.ts +64 -0
  138. package/dist/tools/ai-agents/helpers.js +323 -0
  139. package/dist/tools/ai-agents/threads.d.ts +7 -0
  140. package/dist/tools/ai-agents/threads.js +40 -0
  141. package/dist/tools/organization/inventory.js +2 -1
  142. package/dist/tools/project/content.js +5 -1
  143. package/dist/tools/project/developer-content-preview.d.ts +2 -1
  144. package/dist/tools/project/developer-content-preview.js +40 -35
  145. package/dist/tools/project/developer-content-shared.d.ts +8 -2
  146. package/dist/tools/project/developer-content-shared.js +7 -3
  147. package/dist/tools/project/developer-content.d.ts +7 -8
  148. package/dist/tools/project/developer-content.js +72 -67
  149. package/dist/tools/project/developer-get-chart-as-code.d.ts +9 -0
  150. package/dist/tools/project/developer-get-chart-as-code.js +39 -0
  151. package/dist/tools/project/developer-get-chart-as-code.test.d.ts +4 -0
  152. package/dist/tools/project/developer-get-chart-as-code.test.js +70 -0
  153. package/dist/tools/project/developer-helpers.d.ts +1 -1
  154. package/dist/tools/project/developer-helpers.js +1 -1
  155. package/dist/tools/project/get-dashboard-promote-diff.js +12 -2
  156. package/dist/tools/project/invariants.test.js +5 -3
  157. package/dist/tools/project/projects.js +6 -4
  158. package/dist/tools/project/projects.test.js +44 -5
  159. package/dist/tools/project/reader-export-chart-image.d.ts +6 -0
  160. package/dist/tools/project/reader-export-chart-image.js +78 -0
  161. package/dist/tools/project/reader-export-chart-image.test.d.ts +4 -0
  162. package/dist/tools/project/reader-export-chart-image.test.js +149 -0
  163. package/dist/tools/query/bounded-saved-query.js +1 -1
  164. package/dist/tools/query/lifecycle.d.ts +1 -1
  165. package/dist/tools/query/lifecycle.js +17 -25
  166. package/dist/tools/query/query-ledger.d.ts +15 -8
  167. package/dist/tools/query/query-ledger.js +21 -15
  168. package/dist/tools/query/query-ledger.test.js +13 -11
  169. package/dist/tools/query/reader-tool-helpers.js +4 -6
  170. package/dist/tools/query/reader-tool-helpers.test.js +8 -4
  171. package/dist/tools/registry.d.ts +63 -0
  172. package/dist/tools/registry.js +26 -0
  173. package/dist/tools/shared.d.ts +27 -8
  174. package/dist/tools/shared.js +61 -28
  175. package/dist/tools/shared.test.js +100 -4
  176. package/dist/transports/streamable-http.js +48 -206
  177. package/dist/transports/streamable-http.test.js +10 -3
  178. package/package.json +5 -6
  179. package/dist/destructive/confirmation-claim.d.ts +0 -21
  180. package/dist/destructive/confirmation-claim.js +0 -87
  181. package/dist/destructive/confirmation-claim.test.js +0 -50
  182. package/dist/store/config.d.ts +0 -11
  183. package/dist/store/config.js +0 -50
  184. package/dist/store/config.test.js +0 -56
  185. package/dist/store/create-oauth-broker-store.d.ts +0 -6
  186. package/dist/store/create-oauth-broker-store.js +0 -16
  187. package/dist/store/create-preview-store.d.ts +0 -10
  188. package/dist/store/create-preview-store.js +0 -30
  189. package/dist/store/create-session-store.d.ts +0 -19
  190. package/dist/store/create-session-store.js +0 -24
  191. package/dist/store/in-memory-preview-store.d.ts +0 -17
  192. package/dist/store/in-memory-preview-store.js +0 -72
  193. package/dist/store/redis-client.d.ts +0 -11
  194. package/dist/store/redis-client.js +0 -48
  195. package/dist/store/redis-oauth-broker-store.d.ts +0 -42
  196. package/dist/store/redis-oauth-broker-store.js +0 -167
  197. package/dist/store/redis-oauth-broker-store.test.js +0 -80
  198. package/dist/store/redis-preview-store.d.ts +0 -23
  199. package/dist/store/redis-preview-store.js +0 -94
  200. package/dist/store/redis-preview-store.test.d.ts +0 -1
  201. package/dist/store/redis-preview-store.test.js +0 -39
  202. package/dist/store/redis-session-index.d.ts +0 -33
  203. package/dist/store/redis-session-index.js +0 -49
  204. package/dist/store/types.d.ts +0 -13
  205. package/dist/store/types.js +0 -8
  206. package/dist/transports/http-request-utils.d.ts +0 -2
  207. package/dist/transports/http-request-utils.js +0 -13
  208. package/dist/transports/session-store.d.ts +0 -72
  209. package/dist/transports/session-store.js +0 -143
  210. package/dist/transports/session-store.test.d.ts +0 -1
  211. package/dist/transports/session-store.test.js +0 -111
  212. /package/dist/{destructive/confirmation-claim.test.d.ts → governance/client-capabilities-cache.test.d.ts} +0 -0
  213. /package/dist/{store/config.test.d.ts → server/upstream-errors.test.d.ts} +0 -0
  214. /package/dist/{store/redis-oauth-broker-store.test.d.ts → tools/ai-agents/agents.test.d.ts} +0 -0
@@ -3,84 +3,98 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const vitest_1 = require("vitest");
4
4
  const registry_js_1 = require("../tools/registry.js");
5
5
  const shared_js_1 = require("../tools/shared.js");
6
- const index_js_1 = require("./content-developer/v1/index.js");
7
- const index_js_2 = require("./content-governance/v1/index.js");
8
- const index_js_3 = require("./content-reader/v1/index.js");
9
- const index_js_4 = require("./organization-audit/v1/index.js");
10
- const index_js_5 = require("./index.js");
6
+ const index_js_1 = require("./ai-agent-ops/v1/index.js");
7
+ const index_js_2 = require("./content-developer/v1/index.js");
8
+ const index_js_3 = require("./content-governance/v1/index.js");
9
+ const index_js_4 = require("./content-reader/v1/index.js");
10
+ const index_js_5 = require("./organization-audit/v1/index.js");
11
+ const index_js_6 = require("./index.js");
11
12
  (0, vitest_1.describe)('personas', () => {
12
- (0, vitest_1.it)('ships five personas with fixed paths', () => {
13
- var _a, _b, _c, _d, _e;
14
- (0, vitest_1.expect)(Object.keys(index_js_5.PERSONAS).sort()).toEqual([
13
+ (0, vitest_1.it)('ships six personas with fixed paths', () => {
14
+ var _a, _b, _c, _d, _e, _f;
15
+ (0, vitest_1.expect)(Object.keys(index_js_6.PERSONAS).sort()).toEqual([
16
+ 'ai-agent-ops',
15
17
  'content-developer',
16
18
  'content-governance',
17
19
  'content-reader',
18
20
  'organization-audit',
19
21
  'semantic-layer',
20
22
  ]);
21
- (0, vitest_1.expect)(index_js_5.DEFAULT_PERSONA_ID).toBe('semantic-layer');
22
- (0, vitest_1.expect)((0, index_js_5.listPersonaPaths)().sort()).toEqual([
23
- index_js_5.CONTENT_DEVELOPER_PERSONA_PATH,
24
- index_js_5.CONTENT_GOVERNANCE_PERSONA_PATH,
25
- index_js_5.CONTENT_READER_PERSONA_PATH,
26
- index_js_5.ORGANIZATION_AUDIT_PERSONA_PATH,
27
- index_js_5.SEMANTIC_LAYER_PERSONA_PATH,
23
+ (0, vitest_1.expect)(index_js_6.DEFAULT_PERSONA_ID).toBe('semantic-layer');
24
+ (0, vitest_1.expect)((0, index_js_6.listPersonaPaths)().sort()).toEqual([
25
+ index_js_6.AI_AGENT_OPS_PERSONA_PATH,
26
+ index_js_6.CONTENT_DEVELOPER_PERSONA_PATH,
27
+ index_js_6.CONTENT_GOVERNANCE_PERSONA_PATH,
28
+ index_js_6.CONTENT_READER_PERSONA_PATH,
29
+ index_js_6.ORGANIZATION_AUDIT_PERSONA_PATH,
30
+ index_js_6.SEMANTIC_LAYER_PERSONA_PATH,
28
31
  ].sort());
29
- (0, vitest_1.expect)((_a = (0, index_js_5.getPersonaByPath)(index_js_5.SEMANTIC_LAYER_PERSONA_PATH)) === null || _a === void 0 ? void 0 : _a.id).toBe('semantic-layer');
30
- (0, vitest_1.expect)((_b = (0, index_js_5.getPersonaByPath)(index_js_5.ORGANIZATION_AUDIT_PERSONA_PATH)) === null || _b === void 0 ? void 0 : _b.id).toBe('organization-audit');
31
- (0, vitest_1.expect)((_c = (0, index_js_5.getPersonaByPath)(index_js_5.CONTENT_READER_PERSONA_PATH)) === null || _c === void 0 ? void 0 : _c.id).toBe('content-reader');
32
- (0, vitest_1.expect)((_d = (0, index_js_5.getPersonaByPath)(index_js_5.CONTENT_DEVELOPER_PERSONA_PATH)) === null || _d === void 0 ? void 0 : _d.id).toBe('content-developer');
33
- (0, vitest_1.expect)((_e = (0, index_js_5.getPersonaByPath)(index_js_5.CONTENT_GOVERNANCE_PERSONA_PATH)) === null || _e === void 0 ? void 0 : _e.id).toBe('content-governance');
34
- (0, vitest_1.expect)((0, index_js_5.getPersonaByPath)('/mcp')).toBeUndefined();
32
+ (0, vitest_1.expect)((_a = (0, index_js_6.getPersonaByPath)(index_js_6.SEMANTIC_LAYER_PERSONA_PATH)) === null || _a === void 0 ? void 0 : _a.id).toBe('semantic-layer');
33
+ (0, vitest_1.expect)((_b = (0, index_js_6.getPersonaByPath)(index_js_6.ORGANIZATION_AUDIT_PERSONA_PATH)) === null || _b === void 0 ? void 0 : _b.id).toBe('organization-audit');
34
+ (0, vitest_1.expect)((_c = (0, index_js_6.getPersonaByPath)(index_js_6.CONTENT_READER_PERSONA_PATH)) === null || _c === void 0 ? void 0 : _c.id).toBe('content-reader');
35
+ (0, vitest_1.expect)((_d = (0, index_js_6.getPersonaByPath)(index_js_6.CONTENT_DEVELOPER_PERSONA_PATH)) === null || _d === void 0 ? void 0 : _d.id).toBe('content-developer');
36
+ (0, vitest_1.expect)((_e = (0, index_js_6.getPersonaByPath)(index_js_6.CONTENT_GOVERNANCE_PERSONA_PATH)) === null || _e === void 0 ? void 0 : _e.id).toBe('content-governance');
37
+ (0, vitest_1.expect)((_f = (0, index_js_6.getPersonaByPath)(index_js_6.AI_AGENT_OPS_PERSONA_PATH)) === null || _f === void 0 ? void 0 : _f.id).toBe('ai-agent-ops');
38
+ (0, vitest_1.expect)((0, index_js_6.getPersonaByPath)('/mcp')).toBeUndefined();
35
39
  });
36
40
  (0, vitest_1.it)('normalizes trailing slashes when resolving path', () => {
37
- var _a, _b, _c, _d, _e;
38
- (0, vitest_1.expect)((_a = (0, index_js_5.getPersonaByPath)(`${index_js_5.SEMANTIC_LAYER_PERSONA_PATH}/`)) === null || _a === void 0 ? void 0 : _a.id).toBe('semantic-layer');
39
- (0, vitest_1.expect)((_b = (0, index_js_5.getPersonaByPath)(`${index_js_5.ORGANIZATION_AUDIT_PERSONA_PATH}/`)) === null || _b === void 0 ? void 0 : _b.id).toBe('organization-audit');
40
- (0, vitest_1.expect)((_c = (0, index_js_5.getPersonaByPath)(`${index_js_5.CONTENT_READER_PERSONA_PATH}/`)) === null || _c === void 0 ? void 0 : _c.id).toBe('content-reader');
41
- (0, vitest_1.expect)((_d = (0, index_js_5.getPersonaByPath)(`${index_js_5.CONTENT_DEVELOPER_PERSONA_PATH}/`)) === null || _d === void 0 ? void 0 : _d.id).toBe('content-developer');
42
- (0, vitest_1.expect)((_e = (0, index_js_5.getPersonaByPath)(`${index_js_5.CONTENT_GOVERNANCE_PERSONA_PATH}/`)) === null || _e === void 0 ? void 0 : _e.id).toBe('content-governance');
41
+ var _a, _b, _c, _d, _e, _f;
42
+ (0, vitest_1.expect)((_a = (0, index_js_6.getPersonaByPath)(`${index_js_6.SEMANTIC_LAYER_PERSONA_PATH}/`)) === null || _a === void 0 ? void 0 : _a.id).toBe('semantic-layer');
43
+ (0, vitest_1.expect)((_b = (0, index_js_6.getPersonaByPath)(`${index_js_6.ORGANIZATION_AUDIT_PERSONA_PATH}/`)) === null || _b === void 0 ? void 0 : _b.id).toBe('organization-audit');
44
+ (0, vitest_1.expect)((_c = (0, index_js_6.getPersonaByPath)(`${index_js_6.CONTENT_READER_PERSONA_PATH}/`)) === null || _c === void 0 ? void 0 : _c.id).toBe('content-reader');
45
+ (0, vitest_1.expect)((_d = (0, index_js_6.getPersonaByPath)(`${index_js_6.CONTENT_DEVELOPER_PERSONA_PATH}/`)) === null || _d === void 0 ? void 0 : _d.id).toBe('content-developer');
46
+ (0, vitest_1.expect)((_e = (0, index_js_6.getPersonaByPath)(`${index_js_6.CONTENT_GOVERNANCE_PERSONA_PATH}/`)) === null || _e === void 0 ? void 0 : _e.id).toBe('content-governance');
47
+ (0, vitest_1.expect)((_f = (0, index_js_6.getPersonaByPath)(`${index_js_6.AI_AGENT_OPS_PERSONA_PATH}/`)) === null || _f === void 0 ? void 0 : _f.id).toBe('ai-agent-ops');
43
48
  });
44
49
  (0, vitest_1.it)('semantic-layer allowlists exactly nine tools', () => {
45
- const persona = (0, index_js_5.getPersona)('semantic-layer');
50
+ const persona = (0, index_js_6.getPersona)('semantic-layer');
46
51
  (0, vitest_1.expect)(persona.toolIds).toHaveLength(9);
47
- (0, vitest_1.expect)((0, index_js_5.getDefaultPersona)().toolIds).toEqual(persona.toolIds);
52
+ (0, vitest_1.expect)((0, index_js_6.getDefaultPersona)().toolIds).toEqual(persona.toolIds);
48
53
  });
49
54
  (0, vitest_1.it)('organization-audit allowlists 18 tools and short server name', () => {
50
- const persona = (0, index_js_5.getPersona)('organization-audit');
55
+ const persona = (0, index_js_6.getPersona)('organization-audit');
51
56
  (0, vitest_1.expect)(persona.toolIds).toHaveLength(18);
52
- (0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_4.ORGANIZATION_AUDIT_TOOL_IDS]);
53
- (0, vitest_1.expect)((0, index_js_5.getPersonaServerName)(persona)).toBe('lightdash-mcp-org-audit');
57
+ (0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_5.ORGANIZATION_AUDIT_TOOL_IDS]);
58
+ (0, vitest_1.expect)((0, index_js_6.getPersonaServerName)(persona)).toBe('lightdash-mcp-org-audit');
54
59
  });
55
- (0, vitest_1.it)('content-reader allowlists 13 tools and server name', () => {
56
- const persona = (0, index_js_5.getPersona)('content-reader');
57
- (0, vitest_1.expect)(persona.toolIds).toHaveLength(13);
58
- (0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_3.CONTENT_READER_TOOL_IDS]);
59
- (0, vitest_1.expect)((0, index_js_5.getPersonaServerName)(persona)).toBe('lightdash-mcp-content');
60
+ (0, vitest_1.it)('content-reader allowlists 14 tools and server name', () => {
61
+ const persona = (0, index_js_6.getPersona)('content-reader');
62
+ (0, vitest_1.expect)(persona.toolIds).toHaveLength(14);
63
+ (0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_4.CONTENT_READER_TOOL_IDS]);
64
+ (0, vitest_1.expect)(persona.toolIds).toContain('export_chart_image');
65
+ (0, vitest_1.expect)((0, index_js_6.getPersonaServerName)(persona)).toBe('lightdash-mcp-content');
60
66
  });
61
- (0, vitest_1.it)('content-developer allowlists 25 tools and short server name', () => {
62
- const persona = (0, index_js_5.getPersona)('content-developer');
63
- (0, vitest_1.expect)(persona.toolIds).toHaveLength(25);
64
- (0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_1.CONTENT_DEVELOPER_TOOL_IDS]);
67
+ (0, vitest_1.it)('content-developer allowlists tools and short server name', () => {
68
+ const persona = (0, index_js_6.getPersona)('content-developer');
69
+ (0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_2.CONTENT_DEVELOPER_TOOL_IDS]);
70
+ (0, vitest_1.expect)(persona.toolIds).toContain('get_chart_as_code');
65
71
  (0, vitest_1.expect)(persona.toolIds).not.toContain('create_space');
66
72
  (0, vitest_1.expect)(persona.toolIds).not.toContain('update_space');
67
- (0, vitest_1.expect)((0, index_js_5.getPersonaServerName)(persona)).toBe('lightdash-mcp-cdev');
73
+ (0, vitest_1.expect)((0, index_js_6.getPersonaServerName)(persona)).toBe('lightdash-mcp-cdev');
68
74
  });
69
75
  (0, vitest_1.it)('content-governance allowlists soft-delete + promote tools and short server name', () => {
70
- const persona = (0, index_js_5.getPersona)('content-governance');
76
+ const persona = (0, index_js_6.getPersona)('content-governance');
71
77
  (0, vitest_1.expect)(persona.toolIds).toHaveLength(4);
72
- (0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_2.CONTENT_GOVERNANCE_TOOL_IDS]);
78
+ (0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_3.CONTENT_GOVERNANCE_TOOL_IDS]);
73
79
  (0, vitest_1.expect)(persona.toolIds).toEqual([
74
80
  'delete_chart',
75
81
  'delete_dashboard',
76
82
  'get_dashboard_promote_diff',
77
83
  'promote_dashboard',
78
84
  ]);
79
- (0, vitest_1.expect)((0, index_js_5.getPersonaServerName)(persona)).toBe('lightdash-mcp-gov');
85
+ (0, vitest_1.expect)((0, index_js_6.getPersonaServerName)(persona)).toBe('lightdash-mcp-gov');
86
+ });
87
+ (0, vitest_1.it)('ai-agent-ops allowlists 17 thin API tools and short server name', () => {
88
+ const persona = (0, index_js_6.getPersona)('ai-agent-ops');
89
+ (0, vitest_1.expect)(persona.toolIds).toHaveLength(17);
90
+ (0, vitest_1.expect)(persona.toolIds).toEqual([...index_js_1.AI_AGENT_OPS_TOOL_IDS]);
91
+ (0, vitest_1.expect)(persona.toolIds).not.toContain('create_project_agent');
92
+ (0, vitest_1.expect)(persona.toolIds).not.toContain('generate_agent_message');
93
+ (0, vitest_1.expect)((0, index_js_6.getPersonaServerName)(persona)).toBe('lightdash-mcp-aops');
80
94
  });
81
95
  (0, vitest_1.it)('keeps combined server+tool wire names under 60 characters', () => {
82
- for (const persona of Object.values(index_js_5.PERSONAS)) {
83
- const serverName = (0, index_js_5.getPersonaServerName)(persona);
96
+ for (const persona of Object.values(index_js_6.PERSONAS)) {
97
+ const serverName = (0, index_js_6.getPersonaServerName)(persona);
84
98
  for (const id of persona.toolIds) {
85
99
  const combined = serverName.length + (shared_js_1.TOOL_PREFIX + id).length;
86
100
  (0, vitest_1.expect)(combined, `${serverName}+${shared_js_1.TOOL_PREFIX}${id}`).toBeLessThanOrEqual(60);
@@ -88,12 +102,13 @@ const index_js_5 = require("./index.js");
88
102
  }
89
103
  });
90
104
  (0, vitest_1.it)('parsePersonaId validates known ids only', () => {
91
- (0, vitest_1.expect)((0, index_js_5.parsePersonaId)('semantic-layer')).toBe('semantic-layer');
92
- (0, vitest_1.expect)((0, index_js_5.parsePersonaId)('organization-audit')).toBe('organization-audit');
93
- (0, vitest_1.expect)((0, index_js_5.parsePersonaId)('content-reader')).toBe('content-reader');
94
- (0, vitest_1.expect)((0, index_js_5.parsePersonaId)('content-developer')).toBe('content-developer');
95
- (0, vitest_1.expect)((0, index_js_5.parsePersonaId)('content-governance')).toBe('content-governance');
96
- (0, vitest_1.expect)((0, index_js_5.parsePersonaId)('nope')).toBeUndefined();
105
+ (0, vitest_1.expect)((0, index_js_6.parsePersonaId)('semantic-layer')).toBe('semantic-layer');
106
+ (0, vitest_1.expect)((0, index_js_6.parsePersonaId)('organization-audit')).toBe('organization-audit');
107
+ (0, vitest_1.expect)((0, index_js_6.parsePersonaId)('content-reader')).toBe('content-reader');
108
+ (0, vitest_1.expect)((0, index_js_6.parsePersonaId)('content-developer')).toBe('content-developer');
109
+ (0, vitest_1.expect)((0, index_js_6.parsePersonaId)('content-governance')).toBe('content-governance');
110
+ (0, vitest_1.expect)((0, index_js_6.parsePersonaId)('ai-agent-ops')).toBe('ai-agent-ops');
111
+ (0, vitest_1.expect)((0, index_js_6.parsePersonaId)('nope')).toBeUndefined();
97
112
  });
98
113
  (0, vitest_1.it)('registerToolsByIds registers only allowlisted ids', () => {
99
114
  const registered = [];
@@ -34,13 +34,14 @@ type PromptUserMessage = {
34
34
  };
35
35
  };
36
36
  /**
37
- * Build prompt message helpers that embed core, and optionally one topic playbook,
38
- * after the user text message. When `topicId` is omitted, only core is embedded.
37
+ * Build prompt message helpers that embed core, and optionally one or more topic
38
+ * playbooks, after the user text message. When `topicId` is omitted, only core is
39
+ * embedded.
39
40
  */
40
41
  export declare function createPromptPlaybookEmbedder<TopicId extends string>(options: {
41
42
  core: EmbeddedPlaybook;
42
43
  topics: Readonly<Record<TopicId, EmbeddedPlaybook>>;
43
- }): (text: string, topicId?: TopicId) => {
44
+ }): (text: string, topicId?: TopicId | readonly TopicId[]) => {
44
45
  messages: PromptUserMessage[];
45
46
  };
46
47
  export type PersonaPlaybookTopicDef<TopicId extends string = string> = {
@@ -56,8 +56,9 @@ function embedResource(playbook) {
56
56
  };
57
57
  }
58
58
  /**
59
- * Build prompt message helpers that embed core, and optionally one topic playbook,
60
- * after the user text message. When `topicId` is omitted, only core is embedded.
59
+ * Build prompt message helpers that embed core, and optionally one or more topic
60
+ * playbooks, after the user text message. When `topicId` is omitted, only core is
61
+ * embedded.
61
62
  */
62
63
  function createPromptPlaybookEmbedder(options) {
63
64
  const { core, topics } = options;
@@ -75,15 +76,18 @@ function createPromptPlaybookEmbedder(options) {
75
76
  if (topicId === undefined) {
76
77
  return { messages };
77
78
  }
78
- // eslint-disable-next-line security/detect-object-injection -- topicId from persona PROMPT_TOPICS constants
79
- const topic = topics[topicId];
80
- if (!topic) {
81
- throw new Error(`Unknown playbook topic '${topicId}'`);
79
+ const topicIds = typeof topicId === 'string' ? [topicId] : topicId;
80
+ for (const id of topicIds) {
81
+ // eslint-disable-next-line security/detect-object-injection -- topic ids from persona prompt constants
82
+ const topic = topics[id];
83
+ if (!topic) {
84
+ throw new Error(`Unknown playbook topic '${id}'`);
85
+ }
86
+ messages.push({
87
+ role: 'user',
88
+ content: embedResource(topic),
89
+ });
82
90
  }
83
- messages.push({
84
- role: 'user',
85
- content: embedResource(topic),
86
- });
87
91
  return { messages };
88
92
  };
89
93
  }
@@ -15,78 +15,110 @@ const userMessages = (0, playbook_resources_js_1.createPromptPlaybookEmbedder)({
15
15
  function registerOrganizationAuditPrompts(server) {
16
16
  server.registerPrompt('audit_organization', {
17
17
  title: 'Audit organization',
18
- description: 'Evidence-backed read-only organization audit via primitive tools',
18
+ description: 'Bounded, evidence-backed read-only org audit via primitive lightdash_* tools (no audit_* mega-tools)',
19
19
  argsSchema: {
20
- projectUuids: zod_1.z.string().optional().describe('Comma-separated project UUIDs'),
20
+ projectUuids: zod_1.z
21
+ .string()
22
+ .optional()
23
+ .describe('Comma-separated project UUIDs to deep-dive (default: up to 3 non-preview projects, or HTTP pin)'),
21
24
  allowedEmailDomains: zod_1.z
22
25
  .string()
23
26
  .optional()
24
- .describe('Comma-separated allowed email domains'),
27
+ .describe('Comma-separated internal email domains; convert to a string[] for tool args'),
25
28
  },
26
- }, ({ projectUuids, allowedEmailDomains }) => userMessages(`Perform an evidence-backed, read-only audit of the current Lightdash organization.
29
+ }, ({ projectUuids, allowedEmailDomains }) => userMessages(`Perform a bounded, evidence-backed, read-only audit of the current Lightdash organization.
27
30
 
28
31
  ${playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS}
29
32
 
30
- Scope:
31
- - Use only the organization and projects visible to the authenticated caller.
32
- - Respect any project pin (X-Lightdash-Project).
33
- - Optional project filter: ${projectUuids !== null && projectUuids !== void 0 ? projectUuids : '(all accessible non-preview projects up to a small cap)'}.
34
- - Allowed email domains for delivery review: ${allowedEmailDomains !== null && allowedEmailDomains !== void 0 ? allowedEmailDomains : '(none — treat unknown domains carefully)'}.
33
+ Scope inputs:
34
+ - Optional project filter: ${projectUuids !== null && projectUuids !== void 0 ? projectUuids : '(none — sample ≤3 DEFAULT non-preview projects; honor X-Lightdash-Project pin if set)'}.
35
+ - Allowed email domains: ${allowedEmailDomains !== null && allowedEmailDomains !== void 0 ? allowedEmailDomains : '(none — convert to [] ; treat unknown domains carefully)'}.
36
+ - Split comma-separated args into arrays before calling tools.
35
37
 
36
38
  Procedure (primitives only — there are no lightdash_audit_* tools):
37
- 1. Resolve organization identity via lightdash_get_org_profile.
38
- 2. Follow the playbook phases: identity → projects/access → content → deliveries → report.
39
- 3. Paginate list tools only while pagination.complete is false, and stop after an agreed page/project budget.
40
- 4. Synthesize findings yourself from returned evidence; distinguish facts, inferred risks, assumptions, inaccessible areas, and truncation.
41
- 5. Cite every finding with lightdash_* tool names and resource UUIDs.
42
- 6. Do not claim formal compliance certification.`));
39
+ 1. Phase 0 (core): get_org_profile → list_org_projects → choose projects under budgets.
40
+ 2. Access (access playbook): members/groups sample → per project: list_project_roles → list_project_direct_access → list_space_access → resolve_effective_access (bounded). Empty direct_access is normal with group/org grants.
41
+ 3. Content (content playbook): per project list_content + list_validation_results + get_project_user_activity (summarize; do not dump weekly series).
42
+ 4. Deliveries (deliveries playbook): list_project_schedulers; get_scheduler only as needed.
43
+ 5. Phase 5 report: use the core finding template; cite tools + UUIDs; separate facts vs inferences; list budget/pagination/redaction gaps.
44
+ 6. Never claim formal compliance certification or exhaustive inventory when pagination/budgets stopped early.`));
43
45
  server.registerPrompt('review_access_governance', {
44
46
  title: 'Review access governance',
45
- description: 'Build an effective-access model from identity and access primitives',
46
- argsSchema: {},
47
- }, () => userMessages(`Review Lightdash identity and access governance.
47
+ description: 'Build a bounded effective-access picture from identity + project/space primitives',
48
+ argsSchema: {
49
+ projectUuids: zod_1.z
50
+ .string()
51
+ .optional()
52
+ .describe('Comma-separated project UUIDs (default: ≤3 sampled projects)'),
53
+ allowedEmailDomains: zod_1.z
54
+ .string()
55
+ .optional()
56
+ .describe('Comma-separated domains → string[] for tools'),
57
+ },
58
+ }, ({ projectUuids, allowedEmailDomains }) => userMessages(`Review Lightdash identity and access governance with core budgets.
48
59
 
49
60
  ${playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS}
50
61
 
51
- Use lightdash_list_org_members, lightdash_list_org_role_assignments, lightdash_list_project_roles, lightdash_list_project_direct_access, lightdash_list_space_access, and lightdash_resolve_effective_access.
52
- Do not treat lightdash_list_project_direct_access as complete effective access.
53
- State assumptions and coverage gaps.`, 'access'));
62
+ Projects: ${projectUuids !== null && projectUuids !== void 0 ? projectUuids : '(sample ≤3)'}.
63
+ Domains: ${allowedEmailDomains !== null && allowedEmailDomains !== void 0 ? allowedEmailDomains : '(none)'}.
64
+
65
+ Mandatory tool order per project: lightdash_list_project_roles → lightdash_list_project_direct_access → lightdash_list_space_access → lightdash_resolve_effective_access.
66
+ Also use lightdash_list_org_members, lightdash_list_org_groups, lightdash_list_org_role_assignments, lightdash_list_custom_roles as needed.
67
+ Empty direct_access ≠ no access. Truncation / INCOMPLETE_EFFECTIVE_ACCESS warnings must appear in the report.`, 'access'));
54
68
  server.registerPrompt('review_content_governance', {
55
69
  title: 'Review content governance',
56
- description: 'Inventory content health and ownership risks via list tools',
57
- argsSchema: {},
58
- }, () => userMessages(`Inventory charts, dashboards, and spaces; evaluate validation, ownership, and usage.
70
+ description: 'Inventory content health via list_content, validation, and user-activity evidence',
71
+ argsSchema: {
72
+ projectUuids: zod_1.z
73
+ .string()
74
+ .optional()
75
+ .describe('Comma-separated project UUIDs (required for useful inventory; else sample ≤3)'),
76
+ },
77
+ }, ({ projectUuids }) => userMessages(`Inventory charts, dashboards, and spaces; evaluate validation, ownership, and usage.
59
78
 
60
79
  ${playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS}
61
80
 
62
- Use lightdash_list_content, lightdash_list_validation_results, and lightdash_get_project_user_activity (plus lightdash_get_dashboard_meta when needed).
63
- Join results in the conversation — do not assume a server-side audit tool.
64
- Do not recommend deletion solely because content is unused.`, 'content'));
81
+ Projects: ${projectUuids !== null && projectUuids !== void 0 ? projectUuids : '(sample ≤3; always pass projectUuids into list_content)'}.
82
+
83
+ Use lightdash_list_content (sortBy views or last_updated_at), lightdash_list_validation_results, and lightdash_get_project_user_activity (summarize role counts + top views only). Optional lightdash_get_dashboard_meta.
84
+ Join in the conversation — no server-side audit crawler. Do not recommend deletion for low/zero views.`, 'content'));
65
85
  server.registerPrompt('review_scheduled_deliveries', {
66
86
  title: 'Review scheduled deliveries',
67
- description: 'Inspect schedulers without executing them',
87
+ description: 'Inspect schedulers without executing or mutating them',
68
88
  argsSchema: {
69
- allowedEmailDomains: zod_1.z.string().optional(),
89
+ projectUuids: zod_1.z
90
+ .string()
91
+ .optional()
92
+ .describe('Comma-separated project UUIDs (default: ≤3 sampled)'),
93
+ allowedEmailDomains: zod_1.z.string().optional().describe('Comma-separated domains → string[]'),
70
94
  },
71
- }, ({ allowedEmailDomains }) => userMessages(`Inspect scheduled deliveries without creating, editing, executing, enabling, disabling, or deleting schedules.
95
+ }, ({ projectUuids, allowedEmailDomains }) => userMessages(`Inspect scheduled deliveries without creating, editing, executing, enabling, disabling, or deleting schedules.
72
96
 
73
97
  ${playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS}
74
98
 
75
- Allowed email domains: ${allowedEmailDomains !== null && allowedEmailDomains !== void 0 ? allowedEmailDomains : '(none provided)'}.
76
- Use lightdash_list_project_schedulers and lightdash_get_scheduler.
77
- Redact destinations by default. External destinations are review signals, not automatic violations.`, 'deliveries'));
99
+ Projects: ${projectUuids !== null && projectUuids !== void 0 ? projectUuids : '(sample ≤3)'}.
100
+ Allowed email domains: ${allowedEmailDomains !== null && allowedEmailDomains !== void 0 ? allowedEmailDomains : '(none)'}.
101
+
102
+ Use lightdash_list_project_schedulers (destinations redacted by default) and lightdash_get_scheduler when needed.
103
+ Report enabled and disabled schedules. External destinations (if revealed) are review signals, not automatic violations.`, 'deliveries'));
78
104
  server.registerPrompt('investigate_audit_finding', {
79
105
  title: 'Investigate audit finding',
80
- description: 'Validate or refute one previously reported finding',
106
+ description: 'Validate or refute one previously reported finding with minimum extra metadata',
81
107
  argsSchema: {
82
108
  findingSummary: zod_1.z.string().describe('The finding claim to investigate'),
109
+ projectUuid: zod_1.z
110
+ .string()
111
+ .optional()
112
+ .describe('Project UUID when the finding is project-scoped'),
83
113
  },
84
- }, ({ findingSummary }) => userMessages(`Investigate this organization-audit finding with minimum additional metadata:
114
+ }, ({ findingSummary, projectUuid }) => userMessages(`Investigate this organization-audit finding with minimum additional metadata:
85
115
 
86
116
  ${findingSummary}
87
117
 
118
+ Project context: ${projectUuid !== null && projectUuid !== void 0 ? projectUuid : '(org-level or unspecified — ask only if needed)'}.
119
+
88
120
  ${playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS}
89
121
 
90
- Use only primitive list/get tools. Report supporting evidence, contradictory evidence, remaining uncertainty, and whether severity/confidence changed.`));
122
+ Use only primitive list/get tools under core budgets. Report supporting evidence, contradictory evidence, remaining uncertainty, and whether severity/confidence changed. Prefer targeted get_* / single-project lists over org-wide crawls.`));
91
123
  }
92
124
  /* eslint-enable @typescript-eslint/no-deprecated */
@@ -4,10 +4,18 @@ URI: `lightdash://playbooks/organization-audit/access`
4
4
 
5
5
  ## Phase 1 — Identity
6
6
 
7
- Call `list_org_members` (paginate while `pagination.complete` is false, or stop after a small page budget). Optionally `list_org_groups`, `list_org_role_assignments`, `list_custom_roles`, `get_org_member` for spot checks.
7
+ 1. `lightdash_list_org_members` with budgets from core (`pageSize=50`, ≤3 pages). Note `pagination.totalResults` when present (large orgs are normal).
8
+ 2. Emails are **redacted by default**. Pass `includeEmail=true` only when the user needs full addresses. Use `allowedEmailDomains` so `isExternalDomain` classification is meaningful while redacted.
9
+ 3. Optionally `lightdash_list_org_groups` (≤2 pages). Prefer group **names/UUIDs** over expanding every member unless investigating one group.
10
+ 4. `lightdash_list_org_role_assignments` and `lightdash_list_custom_roles` for org-level / role catalog context. Use `lightdash_get_custom_role` / `lightdash_get_org_member` for spot checks only.
8
11
 
9
- ## Phase 2 — Projects and access
12
+ ## Phase 2 — Projects and access (per sampled project)
10
13
 
11
- Call `list_org_projects`, then for a capped set of projects: `list_project_roles`, `list_project_direct_access`, `list_space_access`, and `resolve_effective_access`. Treat `list_project_direct_access` as direct grants only; emails are masked by default — pass `includeEmail=true` only when required. Pass `allowedEmailDomains` when classifying external direct-access principals. Honor incomplete flags and truncation warnings.
14
+ Run in this order — **group project roles matter more than empty direct grants**:
12
15
 
13
- Do not treat `list_project_direct_access` as complete effective access. State assumptions and coverage gaps.
16
+ 1. **`lightdash_list_project_roles`** (v2 assignments: users **and** groups). This is usually the primary project ACL signal.
17
+ 2. **`lightdash_list_project_direct_access`** — returns **explicit user grants only** (`accessSemantics: direct_only`). **Empty data is expected** when everyone reaches the project via org admin or groups. Always surface the `INCOMPLETE_EFFECTIVE_ACCESS` warning; never conclude “nobody has access” from an empty list.
18
+ 3. **`lightdash_list_space_access`** — composed space list/get; includes inheritance (`inheritedFrom`: organization / group / parent_space). Nested spaces can explode row counts; summarize by space UUID + notable direct grants.
19
+ 4. **`lightdash_resolve_effective_access`** — best-effort composition. With only `projectUuid`, results may still be org-role heavy and hit `maxPrincipals` truncation (`TRUNCATED`). Prefer it to **cross-check** a principal or space (`spaceUuid`), not as a full dump of the org.
20
+
21
+ State assumptions: role precedence across conflicting paths is **not** invented by the server; honor `complete=false` on individual principal rows and envelope warnings.
@@ -2,8 +2,18 @@
2
2
 
3
3
  URI: `lightdash://playbooks/organization-audit/content`
4
4
 
5
- ## Phase 3 — Content and health
5
+ ## Phase 3 — Content and health (per sampled project)
6
6
 
7
- Per project (capped): `list_content` (use `sortBy`/`sortDirection`/`page` intentionally), `list_validation_results`, `get_project_user_activity`. Use `get_dashboard_meta` only when needed. Host joins validation, views, and ownership into findings — do not invent a server-side crawler.
7
+ Always pass **`projectUuids: [that project]`** (do not run org-wide content without an explicit ask).
8
8
 
9
- Do not recommend deletion solely because content is unused. Join results in the conversation — do not assume a server-side audit tool.
9
+ 1. **`lightdash_list_content`**
10
+ - Prefer two passes when useful: `contentTypes: ["dashboard"]` and `["chart"]` (spaces optional).
11
+ - Sort intentionally: `sortBy=views` + `sortDirection=desc` for popularity; `sortBy=last_updated_at` for staleness.
12
+ - Stay within core page budgets. Record `source` (`dbt_explore` vs `sql`) when relevant.
13
+ 2. **`lightdash_list_validation_results`** — empty list means no current validation failures observed, not “perfect catalog forever”.
14
+ 3. **`lightdash_get_project_user_activity`** — treat as **activity evidence**, not an unused-content API (`V1_FALLBACK` / `usageSemantics: activity_evidence`).
15
+ - **Summarize** for the report: `numberUsers` / role counts, `numberWeeklyQueryingUsers`, top `dashboardViews` / `chartViews`, `userMostViewedDashboards`.
16
+ - **Do not** paste entire `chartWeeklyQueryingUsers` / `chartWeeklyAverageQueries` series into the user reply.
17
+ 4. **`lightdash_get_dashboard_meta`** only when you need dashboard structure without executing tiles.
18
+
19
+ Host-join validation + views + ownership into findings. **Zero or low views ⇒ review signal only — never a deletion recommendation.**
@@ -2,35 +2,68 @@
2
2
 
3
3
  URI: `lightdash://playbooks/organization-audit/core`
4
4
 
5
- Read-only evidence collection for Lightdash organization administrators. Findings are review signals synthesized by the host from primitive tool results — not compliance certifications. There are no composed `audit_*` MCP tools; chain bounded `lightdash_*` reads instead.
6
-
7
5
  ## Hard bans
8
6
 
9
7
  - Do not mutate users, groups, roles, spaces, content, or schedulers.
10
8
  - Do not execute warehouse, SQL, chart, or underlying-data queries.
11
9
  - Do not download user-activity CSV (`POST .../download`).
12
- - Do not treat direct project access as complete effective access.
13
- - Do not recommend deletion solely because content has low usage.
14
- - Do not claim SOC 2 / GDPR / ISO / HIPAA certification from these tools.
15
- - Do not crawl the whole org in one step — respect `pagination.complete` and stop after agreed page/project limits.
16
- - Do not request warehouse/dbt connection secrets via MCP — `warehouseConnection`, `dbtConnection`, and related credentials are never returned (ADR-0011); use `@lightdash-tools/client` or the CLI when operators need them.
10
+ - Do not treat `list_project_direct_access` as complete effective access (it is **direct grants only**; empty is common when access is via org role or groups).
11
+ - Do not recommend deletion solely because content has low or zero views.
12
+ - Do not claim SOC 2 / GDPR / ISO / HIPAA (or any) certification from these tools.
13
+ - Do not crawl the whole org in one pass — honor budgets below.
14
+ - Do not request warehouse/dbt secrets via MCP — credentials are never returned (ADR-0011).
15
+
16
+ ## Default budgets (override only if the user expands scope)
17
+
18
+ | Resource | Default |
19
+ | -------------------------- | ---------------------------------------------------------------------------------------------- |
20
+ | Member list pages | `pageSize=50`, stop after **3 pages** or when `pagination.complete` |
21
+ | Groups pages | `pageSize=50`, stop after **2 pages** |
22
+ | Projects in depth | **3** non-preview projects (or only those in `projectUuids` / HTTP pin) |
23
+ | Content pages per project | `pageSize=50`, **2** pages max per contentTypes pass |
24
+ | `resolve_effective_access` | `maxPrincipals=50`; prefer with a `projectUuid` (and `spaceUuid` when investigating one space) |
25
+ | Schedulers pages | `pageSize=50`, **2** pages |
26
+
27
+ Always record when you stopped early (`pagination.complete=false`, budget hit, or user-capped project list).
28
+
29
+ ## Coverage semantics (do not confuse)
30
+
31
+ - **`pagination.complete`**: this list response finished paging (or you stopped).
32
+ - **`coverage.complete`**: often **false** even when a single call succeeded — it means the _audit envelope_ is not a full org certification. **Do not** treat `coverage.complete=false` alone as “tool failed”.
33
+ - Prefer citing `pagination`, `warnings[]` codes (`REDACTED`, `INCOMPLETE_EFFECTIVE_ACCESS`, `TRUNCATED`, `V1_FALLBACK`), and `accessSemantics`.
17
34
 
18
35
  ## Tool catalog (`lightdash_*`)
19
36
 
20
- Inventory: `get_org_profile`, `list_org_members`, `get_org_member`, `list_org_groups`, `list_org_projects`
37
+ **Org inventory:** `get_org_profile`, `list_org_members`, `get_org_member`, `list_org_groups`, `list_org_projects`
21
38
 
22
- Access: `list_org_role_assignments`, `list_custom_roles`, `get_custom_role`, `list_project_roles`, `list_project_direct_access`, `list_space_access`, `resolve_effective_access`
39
+ **Access:** `list_org_role_assignments`, `list_custom_roles`, `get_custom_role`, `list_project_roles`, `list_project_direct_access`, `list_space_access`, `resolve_effective_access`
23
40
 
24
- Content / health: `list_content`, `get_dashboard_meta`, `list_validation_results`, `get_project_user_activity`
41
+ **Content / health:** `list_content`, `get_dashboard_meta`, `list_validation_results`, `get_project_user_activity`
25
42
 
26
- Delivery: `list_project_schedulers`, `get_scheduler`
43
+ **Delivery:** `list_project_schedulers`, `get_scheduler`
27
44
 
28
45
  ## Phase 0 — Scope
29
46
 
30
- 1. Call `lightdash_get_org_profile`.
31
- 2. Record organization UUID, project pin (`X-Lightdash-Project`), thresholds, and `auditVisibility`.
32
- 3. Downgrade organization-wide claims when visibility is `partial`.
47
+ 1. Call `lightdash_get_org_profile`. Record `organizationUuid`, caller role, `auditVisibility`, and `capabilities`.
48
+ 2. If `auditVisibility` is not `organization_admin`, downgrade org-wide claims and note inaccessible scopes.
49
+ 3. Call `lightdash_list_org_projects` (`includePreviewProjects=false` unless asked).
50
+ 4. **Project selection:**
51
+ - Prefer the HTTP pin (`X-Lightdash-Project`) or user-supplied `projectUuids`.
52
+ - Otherwise pick up to **3** `type=DEFAULT` projects.
53
+ - Flag (or skip unless asked) names that look soft-deleted / temporary (e.g. contain `Deleted`, `Preview`, or have `upstreamProjectUuid` set for throwaway clones).
54
+ 5. Convert prompt `allowedEmailDomains` comma-strings into **string arrays** for tools that accept `allowedEmailDomains`.
55
+
56
+ ## Phase 5 — Report template
57
+
58
+ For each finding use:
33
59
 
34
- ## Phase 5 — Report
60
+ ```text
61
+ ### [severity: high|medium|low|info] Title
62
+ - Fact: …
63
+ - Evidence: tool=lightdash_… ; resource UUIDs=… ; warning codes=…
64
+ - Inference (optional): …
65
+ - Gaps: pagination/budget/redaction/incomplete effective access
66
+ - Suggested review action: … (never auto-delete / never mutate)
67
+ ```
35
68
 
36
- Synthesize findings from tool evidence in the conversation. Always include coverage gaps, assumptions, truncation, and resource UUIDs. Never claim the inventory was exhaustive when `pagination.complete` is false. Distinguish facts, inferred risks, assumptions, inaccessible areas, and truncation. Cite every finding with `lightdash_*` tool names and resource UUIDs. Do not claim formal compliance certification.
69
+ End with: projects sampled, pages fetched, redaction state, and explicit non-certification statement.
@@ -2,8 +2,13 @@
2
2
 
3
3
  URI: `lightdash://playbooks/organization-audit/deliveries`
4
4
 
5
- ## Phase 4 — Deliveries
5
+ ## Phase 4 — Deliveries (per sampled project)
6
6
 
7
- Per project (capped): `list_project_schedulers` (destinations redacted by default; pass `revealDestinations` only when required). Use `get_scheduler` with `projectUuid` + `schedulerUuid` for one schedule. Pass `allowedEmailDomains` when reviewing external email destinations.
7
+ 1. **`lightdash_list_project_schedulers`** with required `projectUuid`. Destinations stay redacted unless the user asks for `revealDestinations=true`.
8
+ 2. Pass `allowedEmailDomains` (array) when classifying external email destinations after reveal.
9
+ 3. Note `enabled`, `format` (e.g. `gsheets`, email), `cron`, linked `savedChartUuid` / `dashboardUuid`, and creator UUIDs.
10
+ 4. **`enabled: false`** is still inventory — report as disabled schedule, not as “safe / ignore”.
11
+ 5. Use **`lightdash_get_scheduler`** (`projectUuid` + `schedulerUuid`) for one schedule when list rows are insufficient.
12
+ 6. Cross-link chart/dashboard UUIDs to `list_content` names when helpful.
8
13
 
9
- Inspect scheduled deliveries without creating, editing, executing, enabling, disabling, or deleting schedules. Redact destinations by default. External destinations are review signals, not automatic violations.
14
+ Never create, edit, run, enable, disable, or delete schedules. External destinations (when revealed) are **review signals**, not automatic policy violations.
@@ -2,13 +2,13 @@
2
2
 
3
3
  URI: `lightdash://playbooks/organization-audit`
4
4
 
5
- Workflow-scoped playbooks. Prompts always embed **core**; topic prompts also embed one topic (overview prompts may be core-only):
5
+ Read-only evidence collection for Lightdash organization administrators. The host synthesizes findings from primitive `lightdash_*` tools — there are **no** composed `audit_*` tools and **no** compliance certification.
6
6
 
7
- | Topic | URI |
8
- | --------------------- | ----------------------------------------------------- |
9
- | Core (gates & report) | `lightdash://playbooks/organization-audit/core` |
10
- | Access governance | `lightdash://playbooks/organization-audit/access` |
11
- | Content and health | `lightdash://playbooks/organization-audit/content` |
12
- | Scheduled deliveries | `lightdash://playbooks/organization-audit/deliveries` |
7
+ | Topic | URI | When to load |
8
+ | ---------------------------- | ----------------------------------------------------- | ------------------------------------------------- |
9
+ | Core (budgets, bans, report) | `lightdash://playbooks/organization-audit/core` | Always (embedded in every prompt) |
10
+ | Access governance | `lightdash://playbooks/organization-audit/access` | `review_access_governance` / access chapters |
11
+ | Content and health | `lightdash://playbooks/organization-audit/content` | `review_content_governance` / content chapters |
12
+ | Scheduled deliveries | `lightdash://playbooks/organization-audit/deliveries` | `review_scheduled_deliveries` / delivery chapters |
13
13
 
14
- Read-only evidence collection for Lightdash organization administrators. Findings are review signals synthesized by the host from primitive tool results — not compliance certifications. There are no composed `audit_*` MCP tools; chain bounded `lightdash_*` reads instead.
14
+ **Live-org reality check:** organizations often have hundreds of members and many projects. Default to **bounded samples** (see core budgets). Never crawl every member page or every project unless the user explicitly expands scope.
@@ -9,7 +9,7 @@ const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
9
9
  const playbooks = (0, playbook_resources_js_1.definePersonaPlaybooks)({
10
10
  personaId: 'organization-audit',
11
11
  moduleDir: __dirname,
12
- hardBans: 'Do not mutate users/groups/roles/content/schedulers, execute warehouse or chart queries, download user-activity CSV, reveal secrets, or claim compliance certification. Those capabilities are not available on this server.',
12
+ hardBans: 'Do not mutate users/groups/roles/content/schedulers, execute warehouse or chart queries, download user-activity CSV, reveal secrets, crawl unbounded org inventories, or claim compliance certification. Prefer core budgets (page/project caps). Those capabilities are not available on this server.',
13
13
  coreDescription: 'Hard bans, tool catalog, scope, and report rules',
14
14
  topics: [
15
15
  {