@lightdash-tools/mcp 0.8.0 → 0.11.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 (339) hide show
  1. package/README.md +112 -236
  2. package/dist/audit/server-profile.d.ts +13 -0
  3. package/dist/audit/server-profile.js +28 -0
  4. package/dist/audit/server-profile.test.js +21 -0
  5. package/dist/auth/oauth-broker/pending-store.d.ts +6 -7
  6. package/dist/auth/oauth-broker/pending-store.js +3 -4
  7. package/dist/auth/oauth-broker/pending-store.test.d.ts +2 -3
  8. package/dist/auth/oauth-broker/pending-store.test.js +2 -39
  9. package/dist/auth/oauth-broker/routes.d.ts +1 -1
  10. package/dist/auth/oauth-broker/routes.js +3 -3
  11. package/dist/auth/oauth-broker/routes.test.js +1 -1
  12. package/dist/auth/request-state-key.d.ts +19 -0
  13. package/dist/auth/request-state-key.js +49 -0
  14. package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +1 -3
  15. package/dist/auth/resource-server/lightdash-oauth-middleware.js +1 -20
  16. package/dist/auth/resource-server/lightdash-oauth-middleware.test.js +14 -14
  17. package/dist/auth/resource-server/oauth-protected-resource.d.ts +6 -6
  18. package/dist/auth/resource-server/oauth-protected-resource.js +8 -8
  19. package/dist/auth/resource-server/token-scopes.d.ts +1 -1
  20. package/dist/auth/resource-server/token-scopes.js +1 -1
  21. package/dist/auth/resource-server/www-authenticate.test.js +11 -13
  22. package/dist/bin.js +54 -51
  23. package/dist/config/env.d.ts +8 -16
  24. package/dist/config/env.js +9 -17
  25. package/dist/config/load-mcp-config.d.ts +0 -4
  26. package/dist/config/load-mcp-config.js +9 -38
  27. package/dist/config/load-mcp-config.test.js +8 -2
  28. package/dist/config/normalize-url.d.ts +1 -1
  29. package/dist/config/normalize-url.js +1 -1
  30. package/dist/config/normalize-url.test.js +16 -13
  31. package/dist/config/obsolete-env.d.ts +5 -0
  32. package/dist/config/obsolete-env.js +48 -0
  33. package/dist/config/obsolete-env.test.js +22 -0
  34. package/dist/config/runtime.d.ts +3 -3
  35. package/dist/config/runtime.js +19 -23
  36. package/dist/config/runtime.test.js +23 -9
  37. package/dist/config/test-mcp-http-config.js +1 -1
  38. package/dist/destructive/content-promote.js +7 -1
  39. package/dist/destructive/promote-contract.test.js +106 -47
  40. package/dist/destructive/register-destructive-tool.js +6 -24
  41. package/dist/destructive/request-state.d.ts +2 -6
  42. package/dist/destructive/request-state.js +3 -38
  43. package/dist/destructive/types.d.ts +2 -1
  44. package/dist/governance/available-projects.d.ts +37 -0
  45. package/dist/governance/available-projects.js +132 -0
  46. package/dist/governance/available-projects.test.d.ts +4 -0
  47. package/dist/governance/available-projects.test.js +107 -0
  48. package/dist/governance/mcp-client-session.d.ts +3 -2
  49. package/dist/governance/mcp-client-session.js +3 -2
  50. package/dist/governance/mcp-post-factory-context.d.ts +15 -0
  51. package/dist/governance/mcp-post-factory-context.js +22 -0
  52. package/dist/governance/mcp-post-factory-context.test.js +34 -0
  53. package/dist/governance/project-scope.d.ts +8 -22
  54. package/dist/governance/project-scope.js +36 -44
  55. package/dist/governance/project-scope.test.d.ts +1 -1
  56. package/dist/governance/project-scope.test.js +21 -44
  57. package/dist/governance/promote-allowlist.d.ts +18 -0
  58. package/dist/governance/promote-allowlist.js +66 -0
  59. package/dist/governance/promote-allowlist.test.d.ts +4 -0
  60. package/dist/governance/promote-allowlist.test.js +87 -0
  61. package/dist/http.integration.test.js +116 -265
  62. package/dist/http.test.js +0 -12
  63. package/dist/index.d.ts +5 -1
  64. package/dist/index.integration.test.js +0 -4
  65. package/dist/index.js +31 -16
  66. package/dist/policy/content-developer.d.ts +3 -3
  67. package/dist/policy/content-developer.js +3 -3
  68. package/dist/policy/content-developer.test.js +10 -4
  69. package/dist/policy/content-reader.d.ts +15 -6
  70. package/dist/policy/content-reader.js +39 -10
  71. package/dist/policy/content-reader.test.js +5 -3
  72. package/dist/policy/envelope.d.ts +4 -2
  73. package/dist/policy/envelope.js +2 -2
  74. package/dist/policy/envelope.test.js +28 -0
  75. package/dist/policy/preview-ledger-fault.test.js +101 -426
  76. package/dist/policy/preview-ledger.d.ts +38 -74
  77. package/dist/policy/preview-ledger.js +108 -186
  78. package/dist/policy/preview-ledger.test.js +237 -111
  79. package/dist/policy/result-limits.d.ts +6 -1
  80. package/dist/policy/result-limits.js +28 -29
  81. package/dist/policy/result-limits.test.js +10 -1
  82. package/dist/profiles/ai-agent-ops/v1/index.d.ts +6 -0
  83. package/dist/profiles/ai-agent-ops/v1/index.js +20 -0
  84. package/dist/profiles/ai-agent-ops/v1/prompts.d.ts +5 -0
  85. package/dist/profiles/ai-agent-ops/v1/prompts.js +141 -0
  86. package/dist/profiles/ai-agent-ops/v1/prompts.test.d.ts +4 -0
  87. package/dist/profiles/ai-agent-ops/v1/prompts.test.js +26 -0
  88. package/dist/profiles/ai-agent-ops/v1/resources/playbooks/core.md +39 -0
  89. package/dist/profiles/ai-agent-ops/v1/resources/playbooks/evaluation.md +25 -0
  90. package/dist/profiles/ai-agent-ops/v1/resources/playbooks/index.md +14 -0
  91. package/dist/profiles/ai-agent-ops/v1/resources/playbooks/loop-engineering.md +28 -0
  92. package/dist/profiles/ai-agent-ops/v1/resources/playbooks/release-gate.md +22 -0
  93. package/dist/profiles/ai-agent-ops/v1/resources/playbooks.d.ts +10 -0
  94. package/dist/profiles/ai-agent-ops/v1/resources/playbooks.js +41 -0
  95. package/dist/profiles/content-developer/v1/index.d.ts +8 -0
  96. package/dist/profiles/content-developer/v1/index.js +22 -0
  97. package/dist/{personas → profiles}/content-developer/v1/prompts.d.ts +3 -0
  98. package/dist/profiles/content-developer/v1/prompts.js +157 -0
  99. package/dist/profiles/content-developer/v1/prompts.test.js +286 -0
  100. package/dist/profiles/content-developer/v1/resources/playbooks/chart-types.md +138 -0
  101. package/dist/profiles/content-developer/v1/resources/playbooks/content-move.md +22 -0
  102. package/dist/profiles/content-developer/v1/resources/playbooks/core.md +109 -0
  103. package/dist/profiles/content-developer/v1/resources/playbooks/dashboard-design.md +153 -0
  104. package/dist/profiles/content-developer/v1/resources/playbooks/dashboards.md +108 -0
  105. package/dist/profiles/content-developer/v1/resources/playbooks/index.md +15 -0
  106. package/dist/{personas → profiles}/content-developer/v1/resources/playbooks.d.ts +1 -1
  107. package/dist/profiles/content-developer/v1/resources/playbooks.js +65 -0
  108. package/dist/profiles/content-governance/v1/index.d.ts +7 -0
  109. package/dist/profiles/content-governance/v1/index.js +21 -0
  110. package/dist/{personas → profiles}/content-governance/v1/prompts.test.js +2 -2
  111. package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/core.md +3 -3
  112. package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/dashboards.md +1 -1
  113. package/dist/{personas → profiles}/content-governance/v1/resources/playbooks.js +4 -4
  114. package/dist/profiles/content-reader/v1/index.d.ts +6 -0
  115. package/dist/profiles/content-reader/v1/index.js +20 -0
  116. package/dist/profiles/content-reader/v1/prompts.js +162 -0
  117. package/dist/{personas → profiles}/content-reader/v1/prompts.test.js +2 -2
  118. package/dist/profiles/content-reader/v1/resources/playbooks/compare.md +36 -0
  119. package/dist/profiles/content-reader/v1/resources/playbooks/core.md +67 -0
  120. package/dist/profiles/content-reader/v1/resources/playbooks/discover.md +35 -0
  121. package/dist/profiles/content-reader/v1/resources/playbooks/explain-run.md +49 -0
  122. package/dist/profiles/content-reader/v1/resources/playbooks/index.md +14 -0
  123. package/dist/{personas → profiles}/content-reader/v1/resources/playbooks.js +4 -4
  124. package/dist/profiles/data-analyst/v1/index.d.ts +6 -0
  125. package/dist/profiles/data-analyst/v1/index.js +20 -0
  126. package/dist/profiles/data-analyst/v1/prompts.d.ts +5 -0
  127. package/dist/profiles/data-analyst/v1/prompts.js +41 -0
  128. package/dist/profiles/data-analyst/v1/prompts.test.d.ts +4 -0
  129. package/dist/profiles/data-analyst/v1/prompts.test.js +26 -0
  130. package/dist/profiles/data-analyst/v1/resources/playbooks/core.md +41 -0
  131. package/dist/profiles/data-analyst/v1/resources/playbooks/explore.md +26 -0
  132. package/dist/profiles/data-analyst/v1/resources/playbooks/index.md +8 -0
  133. package/dist/profiles/data-analyst/v1/resources/playbooks.d.ts +10 -0
  134. package/dist/profiles/data-analyst/v1/resources/playbooks.js +33 -0
  135. package/dist/profiles/index.d.ts +24 -0
  136. package/dist/profiles/index.js +73 -0
  137. package/dist/profiles/index.test.js +121 -0
  138. package/dist/{personas → profiles}/lib/playbook-resources.d.ts +12 -10
  139. package/dist/{personas → profiles}/lib/playbook-resources.js +28 -24
  140. package/dist/profiles/organization-audit/v1/index.d.ts +6 -0
  141. package/dist/profiles/organization-audit/v1/index.js +20 -0
  142. package/dist/profiles/organization-audit/v1/prompts.js +124 -0
  143. package/dist/{personas → profiles}/organization-audit/v1/prompts.test.js +2 -2
  144. package/dist/profiles/organization-audit/v1/resources/playbooks/access.md +21 -0
  145. package/dist/profiles/organization-audit/v1/resources/playbooks/content.md +19 -0
  146. package/dist/profiles/organization-audit/v1/resources/playbooks/core.md +69 -0
  147. package/dist/profiles/organization-audit/v1/resources/playbooks/deliveries.md +14 -0
  148. package/dist/profiles/organization-audit/v1/resources/playbooks/index.md +14 -0
  149. package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks.js +3 -3
  150. package/dist/profiles/profile.membership.test.js +36 -0
  151. package/dist/profiles/semantic-layer/v1/index.d.ts +6 -0
  152. package/dist/profiles/semantic-layer/v1/index.js +19 -0
  153. package/dist/profiles/semantic-layer/v1/prompts.js +96 -0
  154. package/dist/{personas → profiles}/semantic-layer/v1/prompts.test.js +2 -2
  155. package/dist/profiles/semantic-layer/v1/resources/playbooks/compose-compile.md +60 -0
  156. package/dist/profiles/semantic-layer/v1/resources/playbooks/core.md +71 -0
  157. package/dist/profiles/semantic-layer/v1/resources/playbooks/explore.md +79 -0
  158. package/dist/profiles/semantic-layer/v1/resources/playbooks/index.md +13 -0
  159. package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks.js +4 -4
  160. package/dist/{personas → profiles}/types.d.ts +6 -7
  161. package/dist/{personas → profiles}/types.js +1 -1
  162. package/dist/protocol-contract.test.js +48 -3
  163. package/dist/server/capabilities.d.ts +6 -6
  164. package/dist/server/capabilities.js +11 -8
  165. package/dist/server/capabilities.test.js +8 -7
  166. package/dist/server/server.js +17 -13
  167. package/dist/server/upstream-errors.d.ts +17 -0
  168. package/dist/server/upstream-errors.js +60 -0
  169. package/dist/server/upstream-errors.test.js +50 -0
  170. package/dist/stdio.process.test.js +65 -9
  171. package/dist/tools/ai-agents/agents.d.ts +7 -0
  172. package/dist/tools/ai-agents/agents.js +32 -0
  173. package/dist/tools/ai-agents/agents.test.d.ts +1 -0
  174. package/dist/tools/ai-agents/agents.test.js +176 -0
  175. package/dist/tools/ai-agents/discovery.d.ts +9 -0
  176. package/dist/tools/ai-agents/discovery.js +73 -0
  177. package/dist/tools/ai-agents/evaluations.d.ts +14 -0
  178. package/dist/tools/ai-agents/evaluations.js +177 -0
  179. package/dist/tools/ai-agents/helpers.d.ts +63 -0
  180. package/dist/tools/ai-agents/helpers.js +321 -0
  181. package/dist/tools/ai-agents/threads.d.ts +7 -0
  182. package/dist/tools/ai-agents/threads.js +40 -0
  183. package/dist/tools/composition/explain-content.js +3 -1
  184. package/dist/tools/index.d.ts +1 -1
  185. package/dist/tools/index.js +1 -1
  186. package/dist/tools/index.test.js +16 -10
  187. package/dist/tools/lib/schema-fields.d.ts +2 -0
  188. package/dist/tools/lib/schema-fields.js +4 -1
  189. package/dist/tools/lib/stable-stringify.d.ts +1 -1
  190. package/dist/tools/lib/stable-stringify.js +1 -1
  191. package/dist/tools/organization/invariants.test.d.ts +1 -1
  192. package/dist/tools/organization/invariants.test.js +5 -5
  193. package/dist/tools/organization/inventory.js +2 -1
  194. package/dist/tools/project/content.js +5 -1
  195. package/dist/tools/project/developer-content-preview.d.ts +3 -2
  196. package/dist/tools/project/developer-content-preview.js +41 -36
  197. package/dist/tools/project/developer-content-shared.d.ts +9 -3
  198. package/dist/tools/project/developer-content-shared.js +8 -4
  199. package/dist/tools/project/developer-content.d.ts +7 -8
  200. package/dist/tools/project/developer-content.js +72 -67
  201. package/dist/tools/project/developer-get-chart-as-code.d.ts +9 -0
  202. package/dist/tools/project/developer-get-chart-as-code.js +39 -0
  203. package/dist/tools/project/developer-get-chart-as-code.test.d.ts +4 -0
  204. package/dist/tools/project/developer-get-chart-as-code.test.js +70 -0
  205. package/dist/tools/project/developer-helpers.d.ts +1 -1
  206. package/dist/tools/project/developer-helpers.js +1 -1
  207. package/dist/tools/project/get-dashboard-promote-diff.js +12 -2
  208. package/dist/tools/project/invariants.test.d.ts +1 -1
  209. package/dist/tools/project/invariants.test.js +12 -10
  210. package/dist/tools/project/parameters.js +8 -3
  211. package/dist/tools/project/projects.d.ts +1 -4
  212. package/dist/tools/project/projects.js +37 -15
  213. package/dist/tools/project/projects.test.js +70 -8
  214. package/dist/tools/project/reader-content.js +6 -3
  215. package/dist/tools/project/reader-execution.js +4 -2
  216. package/dist/tools/project/reader-export-chart-image.d.ts +6 -0
  217. package/dist/tools/project/reader-export-chart-image.js +78 -0
  218. package/dist/tools/project/reader-export-chart-image.test.d.ts +4 -0
  219. package/dist/tools/project/reader-export-chart-image.test.js +149 -0
  220. package/dist/tools/project/spaces.js +12 -4
  221. package/dist/tools/project/spaces.test.d.ts +1 -0
  222. package/dist/tools/project/spaces.test.js +47 -0
  223. package/dist/tools/query/bounded-saved-query.d.ts +4 -3
  224. package/dist/tools/query/bounded-saved-query.js +4 -6
  225. package/dist/tools/query/lifecycle.d.ts +1 -1
  226. package/dist/tools/query/lifecycle.js +25 -31
  227. package/dist/tools/query/query-ledger.d.ts +17 -9
  228. package/dist/tools/query/query-ledger.js +21 -15
  229. package/dist/tools/query/query-ledger.test.js +13 -11
  230. package/dist/tools/query/reader-tool-helpers.d.ts +4 -2
  231. package/dist/tools/query/reader-tool-helpers.js +11 -8
  232. package/dist/tools/query/reader-tool-helpers.test.js +8 -4
  233. package/dist/tools/query/run-metric-query.d.ts +6 -0
  234. package/dist/tools/query/run-metric-query.js +94 -0
  235. package/dist/tools/query/run-metric-query.test.d.ts +4 -0
  236. package/dist/tools/query/run-metric-query.test.js +116 -0
  237. package/dist/tools/registry.d.ts +71 -8
  238. package/dist/tools/registry.js +36 -6
  239. package/dist/tools/semantic/explores.js +43 -17
  240. package/dist/tools/semantic/metrics.js +22 -8
  241. package/dist/tools/semantic/query.js +25 -17
  242. package/dist/tools/shared.d.ts +28 -9
  243. package/dist/tools/shared.js +62 -29
  244. package/dist/tools/shared.test.js +100 -4
  245. package/dist/transports/streamable-http.js +75 -223
  246. package/dist/transports/streamable-http.test.js +19 -12
  247. package/package.json +5 -6
  248. package/dist/destructive/confirmation-claim.d.ts +0 -21
  249. package/dist/destructive/confirmation-claim.js +0 -87
  250. package/dist/destructive/confirmation-claim.test.js +0 -50
  251. package/dist/personas/content-developer/v1/index.d.ts +0 -10
  252. package/dist/personas/content-developer/v1/index.js +0 -51
  253. package/dist/personas/content-developer/v1/prompts.js +0 -138
  254. package/dist/personas/content-developer/v1/prompts.test.js +0 -75
  255. package/dist/personas/content-developer/v1/resources/playbooks/content-move.md +0 -15
  256. package/dist/personas/content-developer/v1/resources/playbooks/core.md +0 -63
  257. package/dist/personas/content-developer/v1/resources/playbooks/dashboards.md +0 -55
  258. package/dist/personas/content-developer/v1/resources/playbooks/index.md +0 -13
  259. package/dist/personas/content-developer/v1/resources/playbooks.js +0 -44
  260. package/dist/personas/content-governance/v1/index.d.ts +0 -9
  261. package/dist/personas/content-governance/v1/index.js +0 -29
  262. package/dist/personas/content-reader/v1/index.d.ts +0 -8
  263. package/dist/personas/content-reader/v1/index.js +0 -37
  264. package/dist/personas/content-reader/v1/prompts.js +0 -128
  265. package/dist/personas/content-reader/v1/resources/playbooks/compare.md +0 -21
  266. package/dist/personas/content-reader/v1/resources/playbooks/core.md +0 -40
  267. package/dist/personas/content-reader/v1/resources/playbooks/discover.md +0 -13
  268. package/dist/personas/content-reader/v1/resources/playbooks/explain-run.md +0 -19
  269. package/dist/personas/content-reader/v1/resources/playbooks/index.md +0 -14
  270. package/dist/personas/index.d.ts +0 -22
  271. package/dist/personas/index.js +0 -73
  272. package/dist/personas/index.test.js +0 -109
  273. package/dist/personas/organization-audit/v1/index.d.ts +0 -8
  274. package/dist/personas/organization-audit/v1/index.js +0 -42
  275. package/dist/personas/organization-audit/v1/prompts.js +0 -92
  276. package/dist/personas/organization-audit/v1/resources/playbooks/access.md +0 -13
  277. package/dist/personas/organization-audit/v1/resources/playbooks/content.md +0 -9
  278. package/dist/personas/organization-audit/v1/resources/playbooks/core.md +0 -36
  279. package/dist/personas/organization-audit/v1/resources/playbooks/deliveries.md +0 -9
  280. package/dist/personas/organization-audit/v1/resources/playbooks/index.md +0 -14
  281. package/dist/personas/persona.parity.test.js +0 -26
  282. package/dist/personas/semantic-layer/v1/index.d.ts +0 -8
  283. package/dist/personas/semantic-layer/v1/index.js +0 -32
  284. package/dist/personas/semantic-layer/v1/prompts.js +0 -85
  285. package/dist/personas/semantic-layer/v1/resources/playbooks/compose-compile.md +0 -55
  286. package/dist/personas/semantic-layer/v1/resources/playbooks/core.md +0 -39
  287. package/dist/personas/semantic-layer/v1/resources/playbooks/explore.md +0 -76
  288. package/dist/personas/semantic-layer/v1/resources/playbooks/index.md +0 -13
  289. package/dist/store/config.d.ts +0 -11
  290. package/dist/store/config.js +0 -50
  291. package/dist/store/config.test.js +0 -56
  292. package/dist/store/create-oauth-broker-store.d.ts +0 -6
  293. package/dist/store/create-oauth-broker-store.js +0 -16
  294. package/dist/store/create-preview-store.d.ts +0 -10
  295. package/dist/store/create-preview-store.js +0 -30
  296. package/dist/store/create-session-store.d.ts +0 -19
  297. package/dist/store/create-session-store.js +0 -24
  298. package/dist/store/in-memory-preview-store.d.ts +0 -17
  299. package/dist/store/in-memory-preview-store.js +0 -72
  300. package/dist/store/redis-client.d.ts +0 -11
  301. package/dist/store/redis-client.js +0 -48
  302. package/dist/store/redis-oauth-broker-store.d.ts +0 -42
  303. package/dist/store/redis-oauth-broker-store.js +0 -167
  304. package/dist/store/redis-oauth-broker-store.test.js +0 -80
  305. package/dist/store/redis-preview-store.d.ts +0 -23
  306. package/dist/store/redis-preview-store.js +0 -94
  307. package/dist/store/redis-preview-store.test.js +0 -39
  308. package/dist/store/redis-session-index.d.ts +0 -33
  309. package/dist/store/redis-session-index.js +0 -49
  310. package/dist/store/types.d.ts +0 -13
  311. package/dist/store/types.js +0 -8
  312. package/dist/transports/http-request-utils.d.ts +0 -2
  313. package/dist/transports/http-request-utils.js +0 -13
  314. package/dist/transports/session-store.d.ts +0 -72
  315. package/dist/transports/session-store.js +0 -143
  316. package/dist/transports/session-store.test.js +0 -111
  317. /package/dist/{destructive/confirmation-claim.test.d.ts → audit/server-profile.test.d.ts} +0 -0
  318. /package/dist/{personas/index.test.d.ts → config/obsolete-env.test.d.ts} +0 -0
  319. /package/dist/{personas/persona.parity.test.d.ts → governance/mcp-post-factory-context.test.d.ts} +0 -0
  320. /package/dist/{store/config.test.d.ts → policy/envelope.test.d.ts} +0 -0
  321. /package/dist/{personas → profiles}/content-developer/v1/prompts.test.d.ts +0 -0
  322. /package/dist/{personas → profiles}/content-governance/v1/prompts.d.ts +0 -0
  323. /package/dist/{personas → profiles}/content-governance/v1/prompts.js +0 -0
  324. /package/dist/{personas → profiles}/content-governance/v1/prompts.test.d.ts +0 -0
  325. /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/charts.md +0 -0
  326. /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/index.md +0 -0
  327. /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks.d.ts +0 -0
  328. /package/dist/{personas → profiles}/content-reader/v1/prompts.d.ts +0 -0
  329. /package/dist/{personas → profiles}/content-reader/v1/prompts.test.d.ts +0 -0
  330. /package/dist/{personas → profiles}/content-reader/v1/resources/playbooks.d.ts +0 -0
  331. /package/dist/{store/redis-oauth-broker-store.test.d.ts → profiles/index.test.d.ts} +0 -0
  332. /package/dist/{personas → profiles}/organization-audit/v1/prompts.d.ts +0 -0
  333. /package/dist/{personas → profiles}/organization-audit/v1/prompts.test.d.ts +0 -0
  334. /package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks.d.ts +0 -0
  335. /package/dist/{store/redis-preview-store.test.d.ts → profiles/profile.membership.test.d.ts} +0 -0
  336. /package/dist/{personas → profiles}/semantic-layer/v1/prompts.d.ts +0 -0
  337. /package/dist/{personas → profiles}/semantic-layer/v1/prompts.test.d.ts +0 -0
  338. /package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks.d.ts +0 -0
  339. /package/dist/{transports/session-store.test.d.ts → server/upstream-errors.test.d.ts} +0 -0
@@ -1,36 +0,0 @@
1
- # Organization-audit core
2
-
3
- URI: `lightdash://playbooks/organization-audit/core`
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
- ## Hard bans
8
-
9
- - Do not mutate users, groups, roles, spaces, content, or schedulers.
10
- - Do not execute warehouse, SQL, chart, or underlying-data queries.
11
- - 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.
17
-
18
- ## Tool catalog (`lightdash_*`)
19
-
20
- Inventory: `get_org_profile`, `list_org_members`, `get_org_member`, `list_org_groups`, `list_org_projects`
21
-
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`
23
-
24
- Content / health: `list_content`, `get_dashboard_meta`, `list_validation_results`, `get_project_user_activity`
25
-
26
- Delivery: `list_project_schedulers`, `get_scheduler`
27
-
28
- ## Phase 0 — Scope
29
-
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`.
33
-
34
- ## Phase 5 — Report
35
-
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.
@@ -1,9 +0,0 @@
1
- # Organization-audit — scheduled deliveries
2
-
3
- URI: `lightdash://playbooks/organization-audit/deliveries`
4
-
5
- ## Phase 4 — Deliveries
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.
8
-
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.
@@ -1,14 +0,0 @@
1
- # Organization-audit playbooks
2
-
3
- URI: `lightdash://playbooks/organization-audit`
4
-
5
- Workflow-scoped playbooks. Prompts always embed **core**; topic prompts also embed one topic (overview prompts may be core-only):
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` |
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.
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const common_1 = require("@lightdash-tools/common");
4
- const vitest_1 = require("vitest");
5
- const index_js_1 = require("./content-developer/v1/index.js");
6
- const index_js_2 = require("./content-governance/v1/index.js");
7
- const index_js_3 = require("./content-reader/v1/index.js");
8
- const index_js_4 = require("./organization-audit/v1/index.js");
9
- const index_js_5 = require("./semantic-layer/v1/index.js");
10
- (0, vitest_1.describe)('persona catalog parity', () => {
11
- (0, vitest_1.it)('semantic-layer allowlist matches catalog semantic-discovery profile', () => {
12
- (0, vitest_1.expect)([...index_js_5.SEMANTIC_LAYER_TOOL_IDS].sort()).toEqual([...(0, common_1.listMcpToolNamesByProfile)('semantic-discovery')].sort());
13
- });
14
- (0, vitest_1.it)('organization-audit allowlist matches catalog org-audit-readonly profile', () => {
15
- (0, vitest_1.expect)([...index_js_4.ORGANIZATION_AUDIT_TOOL_IDS].sort()).toEqual([...(0, common_1.listMcpToolNamesByProfile)('org-audit-readonly')].sort());
16
- });
17
- (0, vitest_1.it)('content-reader allowlist matches catalog content-reader profile', () => {
18
- (0, vitest_1.expect)([...index_js_3.CONTENT_READER_TOOL_IDS].sort()).toEqual([...(0, common_1.listMcpToolNamesByProfile)('content-reader')].sort());
19
- });
20
- (0, vitest_1.it)('content-developer allowlist matches catalog content-developer profile', () => {
21
- (0, vitest_1.expect)([...index_js_1.CONTENT_DEVELOPER_TOOL_IDS].sort()).toEqual([...(0, common_1.listMcpToolNamesByProfile)('content-developer')].sort());
22
- });
23
- (0, vitest_1.it)('content-governance allowlist matches catalog content-governance profile', () => {
24
- (0, vitest_1.expect)([...index_js_2.CONTENT_GOVERNANCE_TOOL_IDS].sort()).toEqual([...(0, common_1.listMcpToolNamesByProfile)('content-governance')].sort());
25
- });
26
- });
@@ -1,8 +0,0 @@
1
- /**
2
- * Semantic-layer persona: compile/discovery tools + playbook/prompts.
3
- */
4
- import type { PersonaDefinition } from '../../types.js';
5
- export declare const SEMANTIC_LAYER_PERSONA_PATH: "/semantic-layer/v1/mcp";
6
- /** Explicit allowlist — must stay a deliberate subset of the shared registry. */
7
- export declare const SEMANTIC_LAYER_TOOL_IDS: readonly ["list_projects", "get_project", "list_explores", "get_explore", "list_dimensions", "get_field_lineage", "list_metrics", "get_metric", "compile_query"];
8
- export declare const semanticLayerPersona: PersonaDefinition;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /**
3
- * Semantic-layer persona: compile/discovery tools + playbook/prompts.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.semanticLayerPersona = exports.SEMANTIC_LAYER_TOOL_IDS = exports.SEMANTIC_LAYER_PERSONA_PATH = void 0;
7
- const prompts_js_1 = require("./prompts.js");
8
- const playbooks_js_1 = require("./resources/playbooks.js");
9
- exports.SEMANTIC_LAYER_PERSONA_PATH = '/semantic-layer/v1/mcp';
10
- /** Explicit allowlist — must stay a deliberate subset of the shared registry. */
11
- exports.SEMANTIC_LAYER_TOOL_IDS = [
12
- 'list_projects',
13
- 'get_project',
14
- 'list_explores',
15
- 'get_explore',
16
- 'list_dimensions',
17
- 'get_field_lineage',
18
- 'list_metrics',
19
- 'get_metric',
20
- 'compile_query',
21
- ];
22
- exports.semanticLayerPersona = {
23
- id: 'semantic-layer',
24
- path: exports.SEMANTIC_LAYER_PERSONA_PATH,
25
- toolIds: exports.SEMANTIC_LAYER_TOOL_IDS,
26
- registerPrompts: (server) => {
27
- (0, prompts_js_1.registerSemanticLayerPrompts)(server);
28
- },
29
- registerResources: (server) => {
30
- (0, playbooks_js_1.registerSemanticLayerPlaybook)(server);
31
- },
32
- };
@@ -1,85 +0,0 @@
1
- "use strict";
2
- /**
3
- * MCP prompts for semantic-layer discovery and compile workflows.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.registerSemanticLayerPrompts = registerSemanticLayerPrompts;
7
- const zod_1 = require("zod");
8
- const schema_fields_js_1 = require("../../../tools/lib/schema-fields.js");
9
- const schema_fields_js_2 = require("../../../tools/semantic/schema-fields.js");
10
- const playbook_resources_js_1 = require("../../lib/playbook-resources.js");
11
- const playbooks_js_1 = require("./resources/playbooks.js");
12
- const userMessages = (0, playbook_resources_js_1.createPromptPlaybookEmbedder)({
13
- core: playbooks_js_1.SEMANTIC_LAYER_CORE_PLAYBOOK,
14
- topics: playbooks_js_1.SEMANTIC_LAYER_TOPIC_PLAYBOOKS,
15
- });
16
- function registerSemanticLayerPrompts(server) {
17
- server.registerPrompt('lightdash_semantic_explore', {
18
- title: 'Explore semantic layer',
19
- description: 'Locate explores, metrics, and dimensions for a question without running warehouse queries',
20
- argsSchema: zod_1.z.object({
21
- projectUuid: (0, schema_fields_js_1.projectUuidField)(),
22
- question: zod_1.z.string().optional().describe('Natural-language question or topic'),
23
- }),
24
- }, async ({ projectUuid, question }) => {
25
- const topic = question ? ` Question/topic: ${question}.` : '';
26
- return userMessages([
27
- 'Discover the Lightdash semantic layer for this project. Compile is out of scope unless asked.',
28
- `Project: ${projectUuid}.${topic}`,
29
- playbooks_js_1.SEMANTIC_LAYER_HARD_BANS,
30
- 'Procedure:',
31
- '1) Stick to this projectUuid (do not switch from an org-wide list_projects). Warehouse/dataset/table hints are search keys only.',
32
- '2) Always lightdash_list_explores with search+limit; disambiguate per playbook (schemaName, label or name __{table}, skip empty schema when dataset known).',
33
- '3) Shortlist base-table dimensions by role; once explore is known prefer get_explore → tables[baseTable].metrics only (catalog keyword optional, still filter tableName === explore id).',
34
- 'Deliverable: shortlist name/label/schemaName/fieldId (+ why). Do not dump full explore/dimension/metric/lineage payloads.',
35
- `Follow the embedded playbooks (${playbooks_js_1.SEMANTIC_LAYER_CORE_URI}, ${playbooks_js_1.SEMANTIC_LAYER_EXPLORE_URI}). Use only lightdash_* tools.`,
36
- ].join('\n'), 'explore');
37
- });
38
- server.registerPrompt('lightdash_semantic_compose_compile', {
39
- title: 'Compose and compile query',
40
- description: 'Build a metric query and compile it with lightdash_compile_query; never execute against the warehouse',
41
- argsSchema: zod_1.z.object({
42
- projectUuid: (0, schema_fields_js_1.projectUuidField)(),
43
- question: zod_1.z.string().optional().describe('What the query should answer'),
44
- exploreId: (0, schema_fields_js_2.exploreIdField)().optional(),
45
- }),
46
- }, async ({ projectUuid, question, exploreId }) => {
47
- const topic = question ? ` Goal: ${question}.` : '';
48
- const explore = exploreId ? ` Preferred explore: ${exploreId}.` : '';
49
- return userMessages([
50
- 'Compose a Lightdash metric query and compile it with lightdash_compile_query. Do not run the query.',
51
- `Project: ${projectUuid}.${topic}${explore}`,
52
- playbooks_js_1.SEMANTIC_LAYER_HARD_BANS,
53
- 'Procedure:',
54
- '1) If exploreId is missing, resolve it per playbook (search + disambiguation).',
55
- '2) Use full fieldIds from list_dimensions / {exploreId}_{metricName}; prefer get_explore → tables[baseTable].metrics once explore is known.',
56
- '3) If the user asked for N insights, reuse one explore and compile N diverse cuts from available fields.',
57
- '4) Compile with fieldIds only; on empty SELECT or unknown field id, fix fieldIds and re-compile once. Extra related metrics in SQL can be OK. Stop after a good compile.',
58
- 'Deliverable: insight title(s) + fieldIds + compiled SQL (or errors). Never paste full explore/dimension/metric/lineage payloads.',
59
- `Follow the embedded playbooks (${playbooks_js_1.SEMANTIC_LAYER_CORE_URI}, ${playbooks_js_1.SEMANTIC_LAYER_COMPOSE_COMPILE_URI}).`,
60
- ].join('\n'), 'compose-compile');
61
- });
62
- server.registerPrompt('lightdash_semantic_compile_debug', {
63
- title: 'Debug compile errors',
64
- description: 'Interpret lightdash_compile_query failures, adjust the metric query, and re-compile',
65
- argsSchema: zod_1.z.object({
66
- projectUuid: (0, schema_fields_js_1.projectUuidField)(),
67
- exploreId: (0, schema_fields_js_2.exploreIdField)(),
68
- errorText: zod_1.z.string().optional().describe('Compile error text if already known'),
69
- }),
70
- }, async ({ projectUuid, exploreId, errorText }) => {
71
- const err = errorText ? ` Error: ${errorText}` : '';
72
- return userMessages([
73
- 'Debug a failing lightdash_compile_query call and re-compile until it succeeds or you explain blockers.',
74
- `Project: ${projectUuid}`,
75
- `Explore: ${exploreId}.${err}`,
76
- playbooks_js_1.SEMANTIC_LAYER_HARD_BANS,
77
- 'Checklist:',
78
- '- Empty SELECT or unknown field id → use fieldIds from lightdash_list_dimensions (base table).',
79
- '- Wrong explore → re-disambiguate per playbook (schemaName; label or name __{table}).',
80
- '- Metric not found / catalog empty → get_explore tables[baseTable].metrics; tableName must be the full explore id; compile as {exploreId}_{metricName}.',
81
- 'Deliverable: successful compile (SQL with expected columns) or a clear blocker. Stop after a good compile.',
82
- `Follow the embedded playbooks (${playbooks_js_1.SEMANTIC_LAYER_CORE_URI}, ${playbooks_js_1.SEMANTIC_LAYER_COMPOSE_COMPILE_URI}).`,
83
- ].join('\n'), 'compose-compile');
84
- });
85
- }
@@ -1,55 +0,0 @@
1
- # Semantic-layer — compose & compile
2
-
3
- URI: `lightdash://playbooks/semantic-layer/compose-compile`
4
-
5
- ## Multi-insight composition (“compose N queries”)
6
-
7
- When the user asks for several insights on one table/explore:
8
-
9
- 1. Disambiguate explore once; reuse the same `exploreId` and metric shortlist.
10
- 2. Pick **diverse** cuts from available metrics/dims (don’t repeat the same grain N times)—e.g. trend, breakdown by a categorical dim, quality/rate metrics, outcome metrics, acquisition/source—only when those fields exist.
11
- 3. Compile each with `lightdash_compile_query`; verify SELECT columns; present **insight title + metric/dimension fieldIds + compiled SQL** (or errors). Do not paste full dimension/explore payloads.
12
- 4. Metrics that join other tables may produce large CTE SQL — still OK; mention the join briefly.
13
-
14
- ## Field IDs and empty SELECT
15
-
16
- Prefer `fieldId` from `lightdash_list_dimensions` / `{exploreId}_{metricName}`.
17
-
18
- Short names alone are unsafe:
19
-
20
- 1. Upstream may “succeed” with an **empty `SELECT`** — this server returns **`isError`**. Fix to `fieldId`s and re-compile once.
21
- 2. Or hard-error on unknown field id.
22
-
23
- Compiled SQL may include **extra related metrics** the semantic layer pulls in — verify columns against the goal; unexpected helpers can be OK if the requested fields are present.
24
-
25
- ## metricQuery skeleton
26
-
27
- ```json
28
- {
29
- "exploreName": "{exploreId}",
30
- "dimensions": ["{exploreId}_{dim}"],
31
- "metrics": ["{exploreId}_{metric}"],
32
- "filters": {},
33
- "sorts": [{ "fieldId": "{exploreId}_{dim}", "descending": false }],
34
- "limit": 50,
35
- "tableCalculations": []
36
- }
37
- ```
38
-
39
- `metrics` may be `[]`.
40
-
41
- ## Recommended sequence
42
-
43
- 1. Scope: `lightdash_get_project` with the user-given project UUID (do not switch from an org-wide list)
44
- 2. Discover: search explores → disambiguate → base-table dimensions (shortlist) + explore-local metrics (`get_explore` metrics map; catalog keyword optional)
45
- 3. `lightdash_compile_query` with `fieldId`s (repeat for multi-insight)
46
- 4. Verify SELECT columns; stop
47
-
48
- ## Compose / debug stop criteria
49
-
50
- - Deliverable: insight title(s) + fieldIds + compiled SQL (or errors). Never paste full explore/dimension/metric/lineage payloads.
51
- - Stop after a good compile. Re-compile only while debugging (empty SELECT / unknown field id / wrong explore / metric not found).
52
- - Multi-insight: N titled queries with fieldIds + SQL; one explore resolution shared across them.
53
- - Empty SELECT or unknown field id → use fieldIds from `lightdash_list_dimensions` (base table) and re-compile once.
54
- - Wrong explore → re-disambiguate (schemaName; label or name `__{table}`).
55
- - Metric not found / catalog empty → `get_explore` `tables[baseTable].metrics`; `tableName` must be the full explore id; compile as `{exploreId}_{metricName}`.
@@ -1,39 +0,0 @@
1
- # Semantic-layer core
2
-
3
- URI: `lightdash://playbooks/semantic-layer/core`
4
-
5
- ## Purpose
6
-
7
- Discover the Lightdash semantic layer and **compose + compile** metric queries. Stop after a good compile (or clear compile errors). Do **not** run warehouse queries or mutate content.
8
-
9
- ## Allowed tools (always `lightdash_` prefix)
10
-
11
- | Tool | Use for |
12
- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
13
- | `lightdash_list_projects` / `lightdash_get_project` | Confirm project UUID ↔ name via `{ data, warnings }` metadata (no warehouse/dbt credentials) |
14
- | `lightdash_list_explores` | Summaries (`name`, `label`, `tags`, `databaseName`, `schemaName`, `errors?`); **always** pass `search` + `limit` |
15
- | `lightdash_list_dimensions` | Compact `{ name, label, table, type, fieldId }`; **default = `table === explore.baseTable`** |
16
- | `lightdash_list_metrics` / `lightdash_get_metric` | Catalog search; **always** filter `tableName === exploreId` client-side |
17
- | `lightdash_compile_query` | Compile only — never “run” |
18
- | `lightdash_get_explore` | Use when catalog filter yields **zero** explore-local metrics; extract `tables[baseTable].metrics` only |
19
- | `lightdash_get_field_lineage` | Optional; summarize, don’t dump |
20
-
21
- ## Hard bans
22
-
23
- Do **not** attempt or invent: run-query / SQL runner / validation jobs / charts / dashboards / spaces / users / groups / ACL / AI agents / agentops. Those tools are not on this server. Use Lightdash **compile** only (not warehouse execution).
24
-
25
- ## Project scope
26
-
27
- 1. If the user gave a **project UUID**, use it on every tool. Prefer `lightdash_get_project` to confirm the name.
28
- 2. Without an HTTP project pin, `lightdash_list_projects` may return the **entire org** — do **not** switch to another project from that list.
29
- 3. Lightdash **project UUID** ≠ warehouse cloud project. `list_projects` / `get_project` return metadata only (no `warehouseConnection` / `dbtConnection`). Match inventory project/dataset to explore **`databaseName`** / **`schemaName`** from `list_explores`.
30
-
31
- ## Answer shape
32
-
33
- Shortlists only: explore `name` / `label` / `schemaName` / why chosen; metric/dimension names + `fieldId`; compiled SQL or compile errors. Never paste full `get_explore`, full dimension arrays, full `get_metric`, or full lineage JSON.
34
-
35
- ## Stop / deliverables
36
-
37
- - **Explore prompt:** shortlist only — do not compile unless asked.
38
- - **Compose / debug:** compiled SQL or errors; stop after a good compile (re-compile only while debugging).
39
- - **Multi-insight:** N titled queries with fieldIds + SQL; one explore resolution shared across them.
@@ -1,76 +0,0 @@
1
- # Semantic-layer — explore / discover
2
-
3
- URI: `lightdash://playbooks/semantic-layer/explore`
4
-
5
- ## From warehouse inventory → explore
6
-
7
- When the user pastes warehouse inventory (dataset / table / partition field):
8
-
9
- | Inventory hint | MCP use |
10
- | ------------------------------- | ----------------------------------------------------------------------------------------- |
11
- | Dataset (`{dataset}`) | Prefer explores with matching **`schemaName`** |
12
- | TABLE (`{table}`) | `lightdash_list_explores` **`search`** = that table token; prefer **exact `label` match** |
13
- | Partition / time field | Candidate **dimension** `fieldId` for time-grain compiles |
14
- | Full id `project.dataset.table` | `databaseName` ≈ project, `schemaName` ≈ dataset, `label` ≈ table |
15
-
16
- Warehouse names are **search hints**, not explore IDs. Explore ids are usually compound (often `{project}__{dataset}__{table}`-style); use the explore `name` returned by tools.
17
-
18
- Some inventory tables have **no** explore. Empty `list_explores` → say so; try a related curated/summary table the user cares about.
19
-
20
- ## Always search explores
21
-
22
- On large projects, **never** use the default first-N explore list (alphabetical across unrelated domains). Always `search` + `limit`.
23
-
24
- ## Explore disambiguation
25
-
26
- Search for `{table}` often returns siblings (staging / EDA / reporting variants, and the warehouse table). **Do not pick the first hit.**
27
-
28
- 1. Skip explores with non-empty `errors`.
29
- 2. If the user named a dataset, prefer matching **`schemaName`**. Skip rows with **empty** `schemaName` unless nothing else matches.
30
- 3. Match warehouse table via **exact `label`** = `{table}`, **or** explore **`name`** ending with / containing `__{table}` (labels may be humanized).
31
- 4. Prefer tags such as `lightdash` when still tied.
32
- 5. Deprioritize staging / EDA / reporting-style name prefixes unless the user asked for them.
33
- 6. Duplicate labels with version suffixes: prefer the explore **`name`** without an extra `_vN` unless the user asked for that version.
34
- 7. State chosen explore **`name`**, `label`, and `schemaName` in the answer.
35
-
36
- ## Progressive discovery
37
-
38
- 1. `lightdash_list_explores` with search → disambiguate → note explore id (`name`, `label`, `schemaName`).
39
- 2. `lightdash_list_dimensions` (default: `table === explore.baseTable`, which may differ from explore id) for `fieldId`s. Set `baseTableOnly=false` only if you need joined-table fields (payload grows a lot).
40
- 3. Discover metrics (see below). Prefer **explore-local** metrics on the base table over unrelated catalog hits.
41
- 4. Stop at a shortlist unless the user asked to compile (compose/compile topic).
42
-
43
- ## Metrics: catalog vs explore-local (critical)
44
-
45
- `lightdash_list_metrics` searches the **org catalog**, not “metrics on this explore”.
46
-
47
- | Search token | Typical result |
48
- | ------------------------------ | --------------------------------------------------- |
49
- | Warehouse table / explore id | **Often zero** hits |
50
- | Broad domain / entity tokens | Hundreds of **other** tables — flood |
51
- | Goal keyword from the question | May hit this explore **and** siblings — must filter |
52
-
53
- Rules:
54
-
55
- 1. Once the explore is known, prefer **`lightdash_get_explore` → `tables[baseTable].metrics` only** for the full local menu (names + labels). Do **not** paste the full explore JSON. Ignore join tables under `tables`.
56
- 2. Optional: keyword `lightdash_list_metrics` for discovery. Response shape `{ pagination, data: Metric[] }`. Keep rows where `tableName` **equals the full explore id**. Table/explore-id search often returns **zero**.
57
- 3. `lightdash_get_metric` `tableName` must be the full explore id. Short warehouse labels → “Metric not found”. Summarize; do not paste huge `availableTimeDimensions` payloads.
58
- 4. Compile metric ids as `{exploreId}_{metricName}` (same pattern as dimension `fieldId`).
59
- 5. Dimension-only (`metrics: []`) is valid for volume-by-time; for “insights” prefer real explore metrics when available.
60
-
61
- ## Dimension shortlist (large explores)
62
-
63
- Base tables can expose **hundreds** of dimensions (nested structs, event arrays). Do **not** dump the full list.
64
-
65
- Prefer high-signal fields that appear in `list_dimensions`, by **role**:
66
-
67
- - Time grains (day / week / month; prefer local timezone grains when both UTC and local exist)
68
- - Channel / platform / traffic source
69
- - Segment / demographic / cohort dimensions relevant to the question
70
- - Core product or entity attributes named in the question
71
-
72
- Skip nested event dumps and deep struct paths unless the question targets them.
73
-
74
- ## Field lineage
75
-
76
- `lightdash_get_field_lineage` accepts full `fieldId` or short `name`. Summarize; do not paste the full graph.
@@ -1,13 +0,0 @@
1
- # Semantic-layer playbooks
2
-
3
- URI: `lightdash://playbooks/semantic-layer`
4
-
5
- Workflow-scoped playbooks (always load **core** plus one topic with a prompt):
6
-
7
- | Topic | URI |
8
- | ------------------- | ------------------------------------------------------ |
9
- | Core (gates & bans) | `lightdash://playbooks/semantic-layer/core` |
10
- | Explore / discover | `lightdash://playbooks/semantic-layer/explore` |
11
- | Compose & compile | `lightdash://playbooks/semantic-layer/compose-compile` |
12
-
13
- Discover the Lightdash semantic layer and **compose + compile** metric queries. Stop after a good compile (or clear compile errors). Do **not** run warehouse queries or mutate content.
@@ -1,11 +0,0 @@
1
- /**
2
- * Resolve LIGHTDASH_TOOLS_MCP_STORE (+ REDIS_URL) for ephemeral MCP state (ADR-0016).
3
- */
4
- import type { EphemeralStoreConfig } from './types.js';
5
- /**
6
- * Parse store backend env. Fail closed when `redis` is selected without a URL.
7
- * Default is memory (stdio/tests and single-instance HTTP).
8
- */
9
- export declare function resolveEphemeralStoreConfig(env?: NodeJS.ProcessEnv): EphemeralStoreConfig;
10
- /** Warn when HTTP uses in-memory ephemeral state (multi-instance / restart loss). */
11
- export declare function emitEphemeralStoreHttpWarning(config?: EphemeralStoreConfig): void;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- /**
3
- * Resolve LIGHTDASH_TOOLS_MCP_STORE (+ REDIS_URL) for ephemeral MCP state (ADR-0016).
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.resolveEphemeralStoreConfig = resolveEphemeralStoreConfig;
7
- exports.emitEphemeralStoreHttpWarning = emitEphemeralStoreHttpWarning;
8
- const env_js_1 = require("../config/env.js");
9
- function readEnv(name, env) {
10
- // eslint-disable-next-line security/detect-object-injection -- env var names are fixed constants
11
- const value = env[name];
12
- if (value == null) {
13
- return undefined;
14
- }
15
- const trimmed = value.trim();
16
- return trimmed.length > 0 ? trimmed : undefined;
17
- }
18
- function parseStoreBackend(raw) {
19
- if (raw == null || raw === 'memory') {
20
- return 'memory';
21
- }
22
- if (raw === 'redis') {
23
- return 'redis';
24
- }
25
- throw new Error(`${env_js_1.ENV_LIGHTDASH_TOOLS_MCP_STORE} must be 'memory' or 'redis' (got '${raw}').`);
26
- }
27
- /**
28
- * Parse store backend env. Fail closed when `redis` is selected without a URL.
29
- * Default is memory (stdio/tests and single-instance HTTP).
30
- */
31
- function resolveEphemeralStoreConfig(env = process.env) {
32
- const backend = parseStoreBackend(readEnv(env_js_1.ENV_LIGHTDASH_TOOLS_MCP_STORE, env));
33
- if (backend === 'memory') {
34
- return { backend: 'memory' };
35
- }
36
- const redisUrl = readEnv(env_js_1.ENV_LIGHTDASH_TOOLS_MCP_REDIS_URL, env);
37
- if (!redisUrl) {
38
- throw new Error(`${env_js_1.ENV_LIGHTDASH_TOOLS_MCP_REDIS_URL} is required when ${env_js_1.ENV_LIGHTDASH_TOOLS_MCP_STORE}=redis.`);
39
- }
40
- return { backend: 'redis', redisUrl };
41
- }
42
- /** Warn when HTTP uses in-memory ephemeral state (multi-instance / restart loss). */
43
- function emitEphemeralStoreHttpWarning(config = resolveEphemeralStoreConfig()) {
44
- if (config.backend === 'memory') {
45
- console.warn(`Warning: MCP HTTP ephemeral store is in-memory (${env_js_1.ENV_LIGHTDASH_TOOLS_MCP_STORE}=memory). ` +
46
- 'Preview ledger, transport sessions, and OAuth pending state are lost on process restart ' +
47
- 'and are not shared across instances. Use sticky routing or set ' +
48
- `${env_js_1.ENV_LIGHTDASH_TOOLS_MCP_STORE}=redis with ${env_js_1.ENV_LIGHTDASH_TOOLS_MCP_REDIS_URL} for horizontal scale.`);
49
- }
50
- }
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const vitest_1 = require("vitest");
4
- const config_js_1 = require("./config.js");
5
- (0, vitest_1.describe)('resolveEphemeralStoreConfig', () => {
6
- const originalStore = process.env.LIGHTDASH_TOOLS_MCP_STORE;
7
- const originalRedis = process.env.LIGHTDASH_TOOLS_MCP_REDIS_URL;
8
- (0, vitest_1.afterEach)(() => {
9
- if (originalStore === undefined) {
10
- delete process.env.LIGHTDASH_TOOLS_MCP_STORE;
11
- }
12
- else {
13
- process.env.LIGHTDASH_TOOLS_MCP_STORE = originalStore;
14
- }
15
- if (originalRedis === undefined) {
16
- delete process.env.LIGHTDASH_TOOLS_MCP_REDIS_URL;
17
- }
18
- else {
19
- process.env.LIGHTDASH_TOOLS_MCP_REDIS_URL = originalRedis;
20
- }
21
- });
22
- (0, vitest_1.it)('defaults to memory', () => {
23
- (0, vitest_1.expect)((0, config_js_1.resolveEphemeralStoreConfig)({})).toEqual({ backend: 'memory' });
24
- });
25
- (0, vitest_1.it)('accepts explicit memory', () => {
26
- (0, vitest_1.expect)((0, config_js_1.resolveEphemeralStoreConfig)({ LIGHTDASH_TOOLS_MCP_STORE: 'memory' })).toEqual({
27
- backend: 'memory',
28
- });
29
- });
30
- (0, vitest_1.it)('requires REDIS_URL when store=redis', () => {
31
- (0, vitest_1.expect)(() => (0, config_js_1.resolveEphemeralStoreConfig)({ LIGHTDASH_TOOLS_MCP_STORE: 'redis' })).toThrow(/LIGHTDASH_TOOLS_MCP_REDIS_URL/);
32
- });
33
- (0, vitest_1.it)('returns redis config when URL is set', () => {
34
- (0, vitest_1.expect)((0, config_js_1.resolveEphemeralStoreConfig)({
35
- LIGHTDASH_TOOLS_MCP_STORE: 'redis',
36
- LIGHTDASH_TOOLS_MCP_REDIS_URL: 'redis://localhost:6379',
37
- })).toEqual({ backend: 'redis', redisUrl: 'redis://localhost:6379' });
38
- });
39
- (0, vitest_1.it)('rejects unknown store values', () => {
40
- (0, vitest_1.expect)(() => (0, config_js_1.resolveEphemeralStoreConfig)({ LIGHTDASH_TOOLS_MCP_STORE: 'postgres' })).toThrow(/memory' or 'redis/);
41
- });
42
- (0, vitest_1.it)('emitEphemeralStoreHttpWarning warns for memory', () => {
43
- const warnings = [];
44
- const original = console.warn;
45
- console.warn = (msg) => {
46
- warnings.push(msg);
47
- };
48
- try {
49
- (0, config_js_1.emitEphemeralStoreHttpWarning)({ backend: 'memory' });
50
- (0, vitest_1.expect)(warnings.some((w) => w.includes('in-memory'))).toBe(true);
51
- }
52
- finally {
53
- console.warn = original;
54
- }
55
- });
56
- });
@@ -1,6 +0,0 @@
1
- /**
2
- * Factory for OAuthBrokerStore (ADR-0016).
3
- */
4
- import type { EphemeralStoreConfig } from './types.js';
5
- import type { OAuthBrokerStore, OAuthBrokerStoreOptions } from '../auth/oauth-broker/pending-store.js';
6
- export declare function createOAuthBrokerStore(config?: EphemeralStoreConfig, options?: OAuthBrokerStoreOptions): OAuthBrokerStore;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- /**
3
- * Factory for OAuthBrokerStore (ADR-0016).
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createOAuthBrokerStore = createOAuthBrokerStore;
7
- const pending_store_js_1 = require("../auth/oauth-broker/pending-store.js");
8
- const config_js_1 = require("./config.js");
9
- const redis_client_js_1 = require("./redis-client.js");
10
- const redis_oauth_broker_store_js_1 = require("./redis-oauth-broker-store.js");
11
- function createOAuthBrokerStore(config = (0, config_js_1.resolveEphemeralStoreConfig)(), options = {}) {
12
- if (config.backend === 'memory') {
13
- return new pending_store_js_1.InMemoryOAuthBrokerStore(options);
14
- }
15
- return new redis_oauth_broker_store_js_1.RedisOAuthBrokerStore(() => (0, redis_client_js_1.getSharedRedisClient)(config), options);
16
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Factory + process singleton for PreviewStore (ADR-0016).
3
- */
4
- import type { EphemeralStoreConfig } from './types.js';
5
- import type { PreviewStore } from '../policy/preview-ledger.js';
6
- export declare function createPreviewStore(config?: EphemeralStoreConfig): PreviewStore;
7
- /** Lazy process singleton (memory by default; redis when configured). */
8
- export declare function getPreviewStore(): PreviewStore;
9
- /** Test helper: inject or clear the process singleton. */
10
- export declare function setPreviewStoreForTests(store: PreviewStore | undefined): void;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- /**
3
- * Factory + process singleton for PreviewStore (ADR-0016).
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createPreviewStore = createPreviewStore;
7
- exports.getPreviewStore = getPreviewStore;
8
- exports.setPreviewStoreForTests = setPreviewStoreForTests;
9
- const config_js_1 = require("./config.js");
10
- const in_memory_preview_store_js_1 = require("./in-memory-preview-store.js");
11
- const redis_client_js_1 = require("./redis-client.js");
12
- const redis_preview_store_js_1 = require("./redis-preview-store.js");
13
- function createPreviewStore(config = (0, config_js_1.resolveEphemeralStoreConfig)()) {
14
- if (config.backend === 'memory') {
15
- return new in_memory_preview_store_js_1.InMemoryPreviewStore();
16
- }
17
- return new redis_preview_store_js_1.RedisPreviewStore(() => (0, redis_client_js_1.getSharedRedisClient)(config));
18
- }
19
- let processStore;
20
- /** Lazy process singleton (memory by default; redis when configured). */
21
- function getPreviewStore() {
22
- if (!processStore) {
23
- processStore = createPreviewStore();
24
- }
25
- return processStore;
26
- }
27
- /** Test helper: inject or clear the process singleton. */
28
- function setPreviewStoreForTests(store) {
29
- processStore = store;
30
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Factory for hybrid SessionStore (ADR-0016).
3
- */
4
- import { SessionStore } from '../transports/session-store.js';
5
- import type { EphemeralStoreConfig } from './types.js';
6
- export type CreateSessionStoreOptions = {
7
- sessionTtlMs: number;
8
- maxSessions: number;
9
- /** `0` disables the per-subject cap. */
10
- maxSessionsPerSubject: number;
11
- };
12
- /**
13
- * Build a SessionStore for the configured ephemeral backend.
14
- *
15
- * - memory: process-local Map only
16
- * - redis: process-local transports + Redis session index (sticky still required
17
- * for Streamable HTTP transport affinity)
18
- */
19
- export declare function createSessionStore(config: EphemeralStoreConfig | undefined, options: CreateSessionStoreOptions): SessionStore;