@lightdash-tools/mcp 0.6.0 → 0.8.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.
- package/README.md +205 -58
- package/dist/audit/audit.d.ts +5 -0
- package/dist/{audit.js → audit/audit.js} +1 -2
- package/dist/audit/tool-audit-context.d.ts +6 -0
- package/dist/audit/tool-audit-context.js +12 -0
- package/dist/audit/tool-audit-context.test.d.ts +1 -0
- package/dist/audit/tool-audit-context.test.js +19 -0
- package/dist/auth/auth-mode.d.ts +4 -0
- package/dist/auth/auth-mode.js +6 -0
- package/dist/auth/bearer.d.ts +3 -0
- package/dist/auth/bearer.js +13 -0
- package/dist/auth/lightdash-oauth-upstream-contract.d.ts +22 -0
- package/dist/auth/lightdash-oauth-upstream-contract.js +36 -0
- package/dist/auth/lightdash-oauth-upstream-contract.test.d.ts +1 -0
- package/dist/auth/lightdash-oauth-upstream-contract.test.js +56 -0
- package/dist/auth/oauth-broker/as-metadata.d.ts +14 -0
- package/dist/auth/oauth-broker/as-metadata.js +20 -0
- package/dist/auth/oauth-broker/lightdash-token.d.ts +20 -0
- package/dist/auth/oauth-broker/lightdash-token.js +76 -0
- package/dist/auth/oauth-broker/pending-store.d.ts +127 -0
- package/dist/auth/oauth-broker/pending-store.js +151 -0
- package/dist/auth/oauth-broker/pending-store.test.d.ts +6 -0
- package/dist/auth/oauth-broker/pending-store.test.js +146 -0
- package/dist/auth/oauth-broker/pkce.d.ts +2 -0
- package/dist/auth/oauth-broker/pkce.js +17 -0
- package/dist/auth/oauth-broker/routes.d.ts +13 -0
- package/dist/auth/oauth-broker/routes.js +452 -0
- package/dist/auth/oauth-broker/routes.test.d.ts +1 -0
- package/dist/auth/oauth-broker/routes.test.js +242 -0
- package/dist/auth/providers/bearer-context-provider.d.ts +24 -0
- package/dist/auth/providers/bearer-context-provider.js +52 -0
- package/dist/auth/providers/env-context-provider.d.ts +13 -0
- package/dist/auth/providers/env-context-provider.js +19 -0
- package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +23 -0
- package/dist/auth/resource-server/lightdash-oauth-middleware.js +115 -0
- package/dist/auth/resource-server/lightdash-oauth-middleware.test.d.ts +1 -0
- package/dist/auth/resource-server/lightdash-oauth-middleware.test.js +202 -0
- package/dist/auth/resource-server/lightdash-token-validation.d.ts +14 -0
- package/dist/auth/resource-server/lightdash-token-validation.js +82 -0
- package/dist/auth/resource-server/lightdash-token-validation.test.d.ts +1 -0
- package/dist/auth/resource-server/lightdash-token-validation.test.js +177 -0
- package/dist/auth/resource-server/oauth-protected-resource.d.ts +25 -0
- package/dist/auth/resource-server/oauth-protected-resource.js +67 -0
- package/dist/auth/resource-server/shared-key-middleware.d.ts +13 -0
- package/dist/auth/resource-server/shared-key-middleware.js +24 -0
- package/dist/auth/resource-server/token-scopes.d.ts +15 -0
- package/dist/auth/resource-server/token-scopes.js +76 -0
- package/dist/auth/resource-server/token-scopes.test.d.ts +1 -0
- package/dist/auth/resource-server/token-scopes.test.js +51 -0
- package/dist/auth/resource-server/token-validation-cache.d.ts +15 -0
- package/dist/auth/resource-server/token-validation-cache.js +44 -0
- package/dist/auth/resource-server/token-validation-cache.test.d.ts +1 -0
- package/dist/auth/resource-server/token-validation-cache.test.js +41 -0
- package/dist/auth/resource-server/token-validation-error.d.ts +6 -0
- package/dist/auth/resource-server/token-validation-error.js +13 -0
- package/dist/auth/resource-server/www-authenticate.d.ts +8 -0
- package/dist/auth/resource-server/www-authenticate.js +24 -0
- package/dist/auth/resource-server/www-authenticate.test.d.ts +1 -0
- package/dist/auth/resource-server/www-authenticate.test.js +70 -0
- package/dist/auth/token-hash.d.ts +2 -0
- package/dist/auth/token-hash.js +8 -0
- package/dist/bin.d.ts +0 -4
- package/dist/bin.js +62 -33
- package/dist/config/env.d.ts +57 -0
- package/dist/config/env.js +60 -0
- package/dist/config/load-mcp-config.d.ts +30 -0
- package/dist/config/load-mcp-config.js +286 -0
- package/dist/config/load-mcp-config.test.d.ts +1 -0
- package/dist/config/load-mcp-config.test.js +202 -0
- package/dist/config/normalize-url.d.ts +13 -0
- package/dist/config/normalize-url.js +52 -0
- package/dist/config/normalize-url.test.d.ts +1 -0
- package/dist/config/normalize-url.test.js +47 -0
- package/dist/config/public-url.d.ts +3 -0
- package/dist/config/public-url.js +10 -0
- package/dist/config/runtime.d.ts +15 -0
- package/dist/config/runtime.js +48 -0
- package/dist/config/runtime.test.d.ts +1 -0
- package/dist/config/runtime.test.js +69 -0
- package/dist/config/test-mcp-http-config.d.ts +3 -0
- package/dist/config/test-mcp-http-config.js +7 -0
- package/dist/destructive/capability.d.ts +13 -0
- package/dist/destructive/capability.js +37 -0
- package/dist/destructive/capability.test.d.ts +1 -0
- package/dist/destructive/capability.test.js +46 -0
- package/dist/destructive/confirmation-claim.d.ts +21 -0
- package/dist/destructive/confirmation-claim.js +87 -0
- package/dist/destructive/confirmation-claim.test.d.ts +1 -0
- package/dist/destructive/confirmation-claim.test.js +50 -0
- package/dist/destructive/confirmation.d.ts +58 -0
- package/dist/destructive/confirmation.js +99 -0
- package/dist/destructive/confirmation.test.d.ts +1 -0
- package/dist/destructive/confirmation.test.js +75 -0
- package/dist/destructive/content-promote.d.ts +8 -0
- package/dist/destructive/content-promote.js +144 -0
- package/dist/destructive/content-soft-delete.d.ts +7 -0
- package/dist/destructive/content-soft-delete.js +106 -0
- package/dist/destructive/destructive-contract.test.d.ts +1 -0
- package/dist/destructive/destructive-contract.test.js +269 -0
- package/dist/destructive/precondition.d.ts +14 -0
- package/dist/destructive/precondition.js +31 -0
- package/dist/destructive/precondition.test.d.ts +1 -0
- package/dist/destructive/precondition.test.js +72 -0
- package/dist/destructive/promote-contract.test.d.ts +1 -0
- package/dist/destructive/promote-contract.test.js +339 -0
- package/dist/destructive/register-destructive-tool.d.ts +54 -0
- package/dist/destructive/register-destructive-tool.js +301 -0
- package/dist/destructive/request-state.d.ts +16 -0
- package/dist/destructive/request-state.js +76 -0
- package/dist/destructive/types.d.ts +64 -0
- package/dist/destructive/types.js +10 -0
- package/dist/governance/mcp-client-session.d.ts +9 -0
- package/dist/governance/mcp-client-session.js +30 -0
- package/dist/governance/mcp-client-session.test.d.ts +1 -0
- package/dist/governance/mcp-client-session.test.js +31 -0
- package/dist/governance/project-pin.d.ts +14 -0
- package/dist/governance/project-pin.js +44 -0
- package/dist/governance/project-pin.test.d.ts +1 -0
- package/dist/governance/project-pin.test.js +35 -0
- package/dist/governance/project-scope.d.ts +38 -0
- package/dist/governance/project-scope.js +79 -0
- package/dist/governance/project-scope.test.d.ts +4 -0
- package/dist/governance/project-scope.test.js +103 -0
- package/dist/http.d.ts +1 -2
- package/dist/http.integration.test.d.ts +1 -0
- package/dist/http.integration.test.js +722 -0
- package/dist/http.js +3 -170
- package/dist/http.test.d.ts +4 -0
- package/dist/http.test.js +131 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.integration.test.js +73 -30
- package/dist/index.js +28 -27
- package/dist/index.test.js +3 -3
- package/dist/logging/structured.d.ts +27 -0
- package/dist/logging/structured.js +32 -0
- package/dist/logging/structured.test.d.ts +1 -0
- package/dist/logging/structured.test.js +33 -0
- package/dist/personas/content-developer/v1/index.d.ts +10 -0
- package/dist/personas/content-developer/v1/index.js +51 -0
- package/dist/personas/content-developer/v1/prompts.d.ts +5 -0
- package/dist/personas/content-developer/v1/prompts.js +138 -0
- package/dist/personas/content-developer/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-developer/v1/prompts.test.js +75 -0
- package/dist/personas/content-developer/v1/resources/playbooks/content-move.md +15 -0
- package/dist/personas/content-developer/v1/resources/playbooks/core.md +63 -0
- package/dist/personas/content-developer/v1/resources/playbooks/dashboards.md +55 -0
- package/dist/personas/content-developer/v1/resources/playbooks/index.md +13 -0
- package/dist/personas/content-developer/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-developer/v1/resources/playbooks.js +44 -0
- package/dist/personas/content-governance/v1/index.d.ts +9 -0
- package/dist/personas/content-governance/v1/index.js +29 -0
- package/dist/personas/content-governance/v1/prompts.d.ts +5 -0
- package/dist/personas/content-governance/v1/prompts.js +87 -0
- package/dist/personas/content-governance/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-governance/v1/prompts.test.js +75 -0
- package/dist/personas/content-governance/v1/resources/playbooks/charts.md +29 -0
- package/dist/personas/content-governance/v1/resources/playbooks/core.md +52 -0
- package/dist/personas/content-governance/v1/resources/playbooks/dashboards.md +48 -0
- package/dist/personas/content-governance/v1/resources/playbooks/index.md +13 -0
- package/dist/personas/content-governance/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-governance/v1/resources/playbooks.js +41 -0
- package/dist/personas/content-reader/v1/index.d.ts +8 -0
- package/dist/personas/content-reader/v1/index.js +37 -0
- package/dist/personas/content-reader/v1/prompts.d.ts +5 -0
- package/dist/personas/content-reader/v1/prompts.js +128 -0
- package/dist/personas/content-reader/v1/prompts.test.d.ts +4 -0
- package/dist/personas/content-reader/v1/prompts.test.js +25 -0
- package/dist/personas/content-reader/v1/resources/playbooks/compare.md +21 -0
- package/dist/personas/content-reader/v1/resources/playbooks/core.md +40 -0
- package/dist/personas/content-reader/v1/resources/playbooks/discover.md +13 -0
- package/dist/personas/content-reader/v1/resources/playbooks/explain-run.md +19 -0
- package/dist/personas/content-reader/v1/resources/playbooks/index.md +14 -0
- package/dist/personas/content-reader/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/content-reader/v1/resources/playbooks.js +49 -0
- package/dist/personas/index.d.ts +22 -0
- package/dist/personas/index.js +73 -0
- package/dist/personas/index.test.d.ts +1 -0
- package/dist/personas/index.test.js +109 -0
- package/dist/personas/lib/playbook-resources.d.ts +79 -0
- package/dist/personas/lib/playbook-resources.js +165 -0
- package/dist/personas/organization-audit/v1/index.d.ts +8 -0
- package/dist/personas/organization-audit/v1/index.js +42 -0
- package/dist/personas/organization-audit/v1/prompts.d.ts +5 -0
- package/dist/personas/organization-audit/v1/prompts.js +92 -0
- package/dist/personas/organization-audit/v1/prompts.test.d.ts +4 -0
- package/dist/personas/organization-audit/v1/prompts.test.js +25 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/access.md +13 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/content.md +9 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/core.md +36 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/deliveries.md +9 -0
- package/dist/personas/organization-audit/v1/resources/playbooks/index.md +14 -0
- package/dist/personas/organization-audit/v1/resources/playbooks.d.ts +10 -0
- package/dist/personas/organization-audit/v1/resources/playbooks.js +41 -0
- package/dist/personas/persona.parity.test.d.ts +1 -0
- package/dist/personas/persona.parity.test.js +26 -0
- package/dist/personas/semantic-layer/v1/index.d.ts +8 -0
- package/dist/personas/semantic-layer/v1/index.js +32 -0
- package/dist/personas/semantic-layer/v1/prompts.d.ts +5 -0
- package/dist/personas/semantic-layer/v1/prompts.js +85 -0
- package/dist/personas/semantic-layer/v1/prompts.test.d.ts +4 -0
- package/dist/personas/semantic-layer/v1/prompts.test.js +19 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/compose-compile.md +55 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/core.md +39 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/explore.md +76 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks/index.md +13 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks.d.ts +13 -0
- package/dist/personas/semantic-layer/v1/resources/playbooks.js +39 -0
- package/dist/personas/types.d.ts +19 -0
- package/dist/personas/types.js +5 -0
- package/dist/policy/content-developer.d.ts +35 -0
- package/dist/policy/content-developer.js +91 -0
- package/dist/policy/content-developer.test.d.ts +4 -0
- package/dist/policy/content-developer.test.js +48 -0
- package/dist/policy/content-reader.d.ts +24 -0
- package/dist/policy/content-reader.js +52 -0
- package/dist/policy/content-reader.test.d.ts +4 -0
- package/dist/policy/content-reader.test.js +22 -0
- package/dist/policy/envelope.d.ts +31 -0
- package/dist/policy/envelope.js +24 -0
- package/dist/policy/preview-ledger-fault.test.d.ts +1 -0
- package/dist/policy/preview-ledger-fault.test.js +527 -0
- package/dist/policy/preview-ledger.d.ts +118 -0
- package/dist/policy/preview-ledger.js +243 -0
- package/dist/policy/preview-ledger.test.d.ts +1 -0
- package/dist/policy/preview-ledger.test.js +267 -0
- package/dist/policy/result-limits.d.ts +27 -0
- package/dist/policy/result-limits.js +107 -0
- package/dist/policy/result-limits.test.d.ts +4 -0
- package/dist/policy/result-limits.test.js +28 -0
- package/dist/protocol-contract.test.d.ts +1 -0
- package/dist/protocol-contract.test.js +42 -0
- package/dist/server/capabilities.d.ts +15 -0
- package/dist/server/capabilities.js +19 -0
- package/dist/server/capabilities.test.d.ts +1 -0
- package/dist/server/capabilities.test.js +41 -0
- package/dist/server/errors.test.d.ts +1 -0
- package/dist/server/errors.test.js +53 -0
- package/dist/server/request-context.d.ts +13 -0
- package/dist/server/request-context.js +2 -0
- package/dist/server/server.d.ts +4 -0
- package/dist/server/server.js +28 -0
- package/dist/server/server.test.d.ts +1 -0
- package/dist/server/server.test.js +15 -0
- package/dist/server/version.d.ts +1 -0
- package/dist/server/version.js +7 -0
- package/dist/server/version.test.d.ts +1 -0
- package/dist/server/version.test.js +9 -0
- package/dist/stdio.process.test.d.ts +1 -0
- package/dist/stdio.process.test.js +274 -0
- package/dist/store/config.d.ts +11 -0
- package/dist/store/config.js +50 -0
- package/dist/store/config.test.d.ts +1 -0
- package/dist/store/config.test.js +56 -0
- package/dist/store/create-oauth-broker-store.d.ts +6 -0
- package/dist/store/create-oauth-broker-store.js +16 -0
- package/dist/store/create-preview-store.d.ts +10 -0
- package/dist/store/create-preview-store.js +30 -0
- package/dist/store/create-session-store.d.ts +19 -0
- package/dist/store/create-session-store.js +24 -0
- package/dist/store/in-memory-preview-store.d.ts +17 -0
- package/dist/store/in-memory-preview-store.js +72 -0
- package/dist/store/redis-client.d.ts +11 -0
- package/dist/store/redis-client.js +48 -0
- package/dist/store/redis-oauth-broker-store.d.ts +42 -0
- package/dist/store/redis-oauth-broker-store.js +167 -0
- package/dist/store/redis-oauth-broker-store.test.d.ts +1 -0
- package/dist/store/redis-oauth-broker-store.test.js +80 -0
- package/dist/store/redis-preview-store.d.ts +23 -0
- package/dist/store/redis-preview-store.js +94 -0
- package/dist/store/redis-preview-store.test.d.ts +1 -0
- package/dist/store/redis-preview-store.test.js +39 -0
- package/dist/store/redis-session-index.d.ts +33 -0
- package/dist/store/redis-session-index.js +49 -0
- package/dist/store/types.d.ts +13 -0
- package/dist/store/types.js +8 -0
- package/dist/tools/composition/explain-content.d.ts +6 -0
- package/dist/tools/composition/explain-content.js +108 -0
- package/dist/tools/index.d.ts +2 -4
- package/dist/tools/index.js +4 -30
- package/dist/tools/index.test.d.ts +1 -0
- package/dist/tools/index.test.js +72 -0
- package/dist/tools/lib/api-errors.d.ts +11 -0
- package/dist/tools/lib/api-errors.js +27 -0
- package/dist/tools/lib/api-shape.d.ts +16 -0
- package/dist/tools/lib/api-shape.js +47 -0
- package/dist/tools/lib/assert-safe.d.ts +13 -0
- package/dist/tools/lib/assert-safe.js +21 -0
- package/dist/tools/lib/assert-safe.test.d.ts +4 -0
- package/dist/tools/lib/assert-safe.test.js +32 -0
- package/dist/tools/lib/concurrency.d.ts +4 -0
- package/dist/tools/lib/concurrency.js +24 -0
- package/dist/tools/lib/contracts.d.ts +34 -0
- package/dist/tools/lib/contracts.js +30 -0
- package/dist/tools/lib/redaction.d.ts +107 -0
- package/dist/tools/lib/redaction.js +299 -0
- package/dist/tools/lib/redaction.test.d.ts +4 -0
- package/dist/tools/lib/redaction.test.js +216 -0
- package/dist/tools/lib/register-org-audit.d.ts +9 -0
- package/dist/tools/lib/register-org-audit.js +20 -0
- package/dist/tools/lib/schema-fields.d.ts +9 -0
- package/dist/tools/lib/schema-fields.js +19 -0
- package/dist/tools/lib/stable-stringify.d.ts +9 -0
- package/dist/tools/lib/stable-stringify.js +35 -0
- package/dist/tools/organization/binding.d.ts +14 -0
- package/dist/tools/organization/binding.js +31 -0
- package/dist/tools/organization/invariants.test.d.ts +4 -0
- package/dist/tools/organization/invariants.test.js +28 -0
- package/dist/tools/organization/inventory.d.ts +10 -0
- package/dist/tools/organization/inventory.js +189 -0
- package/dist/tools/organization/roles.d.ts +10 -0
- package/dist/tools/organization/roles.js +213 -0
- package/dist/tools/project/content.d.ts +9 -0
- package/dist/tools/project/content.js +192 -0
- package/dist/tools/project/delete-chart.d.ts +4 -0
- package/dist/tools/project/delete-chart.js +8 -0
- package/dist/tools/project/delete-dashboard.d.ts +4 -0
- package/dist/tools/project/delete-dashboard.js +8 -0
- package/dist/tools/project/developer-content-preview.d.ts +12 -0
- package/dist/tools/project/developer-content-preview.js +286 -0
- package/dist/tools/project/developer-content-shared.d.ts +18 -0
- package/dist/tools/project/developer-content-shared.js +46 -0
- package/dist/tools/project/developer-content-shared.test.d.ts +1 -0
- package/dist/tools/project/developer-content-shared.test.js +25 -0
- package/dist/tools/project/developer-content.d.ts +39 -0
- package/dist/tools/project/developer-content.js +584 -0
- package/dist/tools/project/developer-helpers.d.ts +180 -0
- package/dist/tools/project/developer-helpers.js +484 -0
- package/dist/tools/project/developer-helpers.test.d.ts +1 -0
- package/dist/tools/project/developer-helpers.test.js +509 -0
- package/dist/tools/project/get-dashboard-promote-diff.d.ts +6 -0
- package/dist/tools/project/get-dashboard-promote-diff.js +42 -0
- package/dist/tools/project/invariants.test.d.ts +4 -0
- package/dist/tools/project/invariants.test.js +42 -0
- package/dist/tools/project/parameters.d.ts +7 -0
- package/dist/tools/project/parameters.js +74 -0
- package/dist/tools/project/projects.d.ts +10 -0
- package/dist/tools/project/projects.js +102 -0
- package/dist/tools/project/projects.test.d.ts +1 -0
- package/dist/tools/project/projects.test.js +154 -0
- package/dist/tools/project/promote-dashboard.d.ts +4 -0
- package/dist/tools/project/promote-dashboard.js +8 -0
- package/dist/tools/project/reader-content.d.ts +9 -0
- package/dist/tools/project/reader-content.js +208 -0
- package/dist/tools/project/reader-execution.d.ts +7 -0
- package/dist/tools/project/reader-execution.js +214 -0
- package/dist/tools/project/schedulers.d.ts +7 -0
- package/dist/tools/project/schedulers.js +115 -0
- package/dist/tools/project/schemas/chart-upsert.d.ts +33 -0
- package/dist/tools/project/schemas/chart-upsert.js +66 -0
- package/dist/tools/project/schemas/dashboard-tile.d.ts +29 -0
- package/dist/tools/project/schemas/dashboard-tile.js +57 -0
- package/dist/tools/project/schemas/dashboard.d.ts +70 -0
- package/dist/tools/project/schemas/dashboard.js +101 -0
- package/dist/tools/project/schemas/duplicate.d.ts +30 -0
- package/dist/tools/project/schemas/duplicate.js +86 -0
- package/dist/tools/project/schemas/index.d.ts +7 -0
- package/dist/tools/project/schemas/index.js +26 -0
- package/dist/tools/project/schemas/parse-helpers.d.ts +14 -0
- package/dist/tools/project/schemas/parse-helpers.js +34 -0
- package/dist/tools/project/schemas/payload-schemas.test.d.ts +1 -0
- package/dist/tools/project/schemas/payload-schemas.test.js +204 -0
- package/dist/tools/project/spaces.d.ts +7 -0
- package/dist/tools/project/spaces.js +101 -0
- package/dist/tools/query/bounded-saved-query.d.ts +37 -0
- package/dist/tools/query/bounded-saved-query.js +80 -0
- package/dist/tools/query/bounded-saved-query.test.d.ts +4 -0
- package/dist/tools/query/bounded-saved-query.test.js +82 -0
- package/dist/tools/query/chart-source.d.ts +10 -0
- package/dist/tools/query/chart-source.js +36 -0
- package/dist/tools/query/chart-source.test.d.ts +1 -0
- package/dist/tools/query/chart-source.test.js +62 -0
- package/dist/tools/query/filter-overrides.d.ts +34 -0
- package/dist/tools/query/filter-overrides.js +75 -0
- package/dist/tools/query/filter-overrides.test.d.ts +1 -0
- package/dist/tools/query/filter-overrides.test.js +21 -0
- package/dist/tools/query/lifecycle.d.ts +7 -0
- package/dist/tools/query/lifecycle.js +112 -0
- package/dist/tools/query/query-ledger.d.ts +34 -0
- package/dist/tools/query/query-ledger.js +86 -0
- package/dist/tools/query/query-ledger.test.d.ts +1 -0
- package/dist/tools/query/query-ledger.test.js +73 -0
- package/dist/tools/query/reader-tool-helpers.d.ts +12 -0
- package/dist/tools/query/reader-tool-helpers.js +59 -0
- package/dist/tools/query/reader-tool-helpers.test.d.ts +1 -0
- package/dist/tools/query/reader-tool-helpers.test.js +49 -0
- package/dist/tools/query/result-normalizer.d.ts +27 -0
- package/dist/tools/query/result-normalizer.js +133 -0
- package/dist/tools/query/result-normalizer.test.d.ts +1 -0
- package/dist/tools/query/result-normalizer.test.js +41 -0
- package/dist/tools/query/wait-for-async.d.ts +10 -0
- package/dist/tools/query/wait-for-async.js +46 -0
- package/dist/tools/query/wait-for-async.test.d.ts +1 -0
- package/dist/tools/query/wait-for-async.test.js +45 -0
- package/dist/tools/registry.d.ts +225 -0
- package/dist/tools/registry.js +115 -0
- package/dist/tools/semantic/explore-helpers.d.ts +56 -0
- package/dist/tools/semantic/explore-helpers.js +115 -0
- package/dist/tools/semantic/explore-helpers.test.d.ts +1 -0
- package/dist/tools/semantic/explore-helpers.test.js +170 -0
- package/dist/tools/semantic/explores.d.ts +9 -0
- package/dist/tools/semantic/explores.js +80 -0
- package/dist/tools/semantic/metrics.d.ts +7 -0
- package/dist/tools/semantic/metrics.js +53 -0
- package/dist/tools/semantic/query.d.ts +6 -0
- package/dist/tools/semantic/query.js +42 -0
- package/dist/tools/semantic/schema-fields.d.ts +3 -0
- package/dist/tools/semantic/schema-fields.js +7 -0
- package/dist/tools/shared.d.ts +51 -15
- package/dist/tools/shared.js +171 -163
- package/dist/tools/shared.test.js +137 -184
- package/dist/tools/space/access.d.ts +66 -0
- package/dist/tools/space/access.js +322 -0
- package/dist/tools/space/access.test.d.ts +4 -0
- package/dist/tools/space/access.test.js +90 -0
- package/dist/transports/http-body.d.ts +5 -0
- package/dist/transports/http-body.js +50 -0
- package/dist/transports/http-request-utils.d.ts +2 -0
- package/dist/transports/http-request-utils.js +13 -0
- package/dist/transports/http-response.d.ts +6 -0
- package/dist/transports/http-response.js +56 -0
- package/dist/transports/session-store.d.ts +72 -0
- package/dist/transports/session-store.js +143 -0
- package/dist/transports/session-store.test.d.ts +1 -0
- package/dist/transports/session-store.test.js +111 -0
- package/dist/transports/streamable-http.d.ts +9 -0
- package/dist/transports/streamable-http.js +461 -0
- package/dist/transports/streamable-http.test.d.ts +1 -0
- package/dist/transports/streamable-http.test.js +100 -0
- package/package.json +26 -10
- package/dist/audit.d.ts +0 -6
- package/dist/config.d.ts +0 -47
- package/dist/config.js +0 -82
- package/dist/tools/ai-agents.d.ts +0 -6
- package/dist/tools/ai-agents.js +0 -388
- package/dist/tools/charts.d.ts +0 -6
- package/dist/tools/charts.js +0 -55
- package/dist/tools/content.d.ts +0 -6
- package/dist/tools/content.js +0 -37
- package/dist/tools/dashboards.d.ts +0 -6
- package/dist/tools/dashboards.js +0 -28
- package/dist/tools/explores.d.ts +0 -6
- package/dist/tools/explores.js +0 -65
- package/dist/tools/groups.d.ts +0 -6
- package/dist/tools/groups.js +0 -121
- package/dist/tools/metrics.d.ts +0 -6
- package/dist/tools/metrics.js +0 -45
- package/dist/tools/projects.d.ts +0 -6
- package/dist/tools/projects.js +0 -58
- package/dist/tools/query.d.ts +0 -6
- package/dist/tools/query.js +0 -34
- package/dist/tools/schedulers.d.ts +0 -6
- package/dist/tools/schedulers.js +0 -45
- package/dist/tools/spaces.d.ts +0 -6
- package/dist/tools/spaces.js +0 -128
- package/dist/tools/tags.d.ts +0 -6
- package/dist/tools/tags.js +0 -28
- package/dist/tools/users.d.ts +0 -6
- package/dist/tools/users.js +0 -50
- package/src/audit.ts +0 -6
- package/src/bin.ts +0 -58
- package/src/config.ts +0 -83
- package/src/errors.ts +0 -27
- package/src/http.ts +0 -187
- package/src/index.integration.test.ts +0 -57
- package/src/index.test.ts +0 -8
- package/src/index.ts +0 -31
- package/src/tools/ai-agents.ts +0 -759
- package/src/tools/charts.ts +0 -85
- package/src/tools/content.ts +0 -44
- package/src/tools/dashboards.ts +0 -25
- package/src/tools/explores.ts +0 -98
- package/src/tools/groups.ts +0 -180
- package/src/tools/index.ts +0 -35
- package/src/tools/metrics.ts +0 -42
- package/src/tools/projects.ts +0 -74
- package/src/tools/query.ts +0 -47
- package/src/tools/schedulers.ts +0 -42
- package/src/tools/shared.test.ts +0 -365
- package/src/tools/shared.ts +0 -274
- package/src/tools/spaces.ts +0 -217
- package/src/tools/tags.ts +0 -25
- package/src/tools/users.ts +0 -64
- package/tsconfig.json +0 -13
- /package/dist/{errors.d.ts → server/errors.d.ts} +0 -0
- /package/dist/{errors.js → server/errors.js} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Organization-audit prompt/playbook invariants.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const vitest_1 = require("vitest");
|
|
7
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
8
|
+
const index_js_1 = require("./index.js");
|
|
9
|
+
(0, vitest_1.describe)('organization-audit prompts/playbook', () => {
|
|
10
|
+
(0, vitest_1.it)('playbook references only registered tool short ids', () => {
|
|
11
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
|
|
12
|
+
for (const id of index_js_1.ORGANIZATION_AUDIT_TOOL_IDS) {
|
|
13
|
+
(0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
|
|
14
|
+
}
|
|
15
|
+
(0, vitest_1.expect)(md).not.toMatch(/\bldt__/);
|
|
16
|
+
(0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
|
|
17
|
+
(0, vitest_1.expect)(playbooks_js_1.ORGANIZATION_AUDIT_HARD_BANS.toLowerCase()).toContain('compliance');
|
|
18
|
+
});
|
|
19
|
+
(0, vitest_1.it)('playbook forbids mutation and warehouse queries', () => {
|
|
20
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)().toLowerCase();
|
|
21
|
+
(0, vitest_1.expect)(md).toContain('do not mutate');
|
|
22
|
+
(0, vitest_1.expect)(md).toContain('warehouse');
|
|
23
|
+
(0, vitest_1.expect)(md).toContain('deletion');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Organization-audit — access governance
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/organization-audit/access`
|
|
4
|
+
|
|
5
|
+
## Phase 1 — Identity
|
|
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.
|
|
8
|
+
|
|
9
|
+
## Phase 2 — Projects and access
|
|
10
|
+
|
|
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.
|
|
12
|
+
|
|
13
|
+
Do not treat `list_project_direct_access` as complete effective access. State assumptions and coverage gaps.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Organization-audit — content and health
|
|
2
|
+
|
|
3
|
+
URI: `lightdash://playbooks/organization-audit/content`
|
|
4
|
+
|
|
5
|
+
## Phase 3 — Content and health
|
|
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.
|
|
8
|
+
|
|
9
|
+
Do not recommend deletion solely because content is unused. Join results in the conversation — do not assume a server-side audit tool.
|
|
@@ -0,0 +1,36 @@
|
|
|
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.
|
|
@@ -0,0 +1,9 @@
|
|
|
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.
|
|
@@ -0,0 +1,14 @@
|
|
|
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.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization-audit multi-playbook resources (core + topics + index).
|
|
3
|
+
*/
|
|
4
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
5
|
+
export type OrganizationAuditPlaybookTopic = 'access' | 'content' | 'deliveries';
|
|
6
|
+
export declare const ORGANIZATION_AUDIT_HARD_BANS: string;
|
|
7
|
+
export declare const getAllPlaybookMarkdown: () => string;
|
|
8
|
+
export declare const ORGANIZATION_AUDIT_CORE_PLAYBOOK: import("../../../lib/playbook-resources.js").EmbeddedPlaybook;
|
|
9
|
+
export declare const ORGANIZATION_AUDIT_TOPIC_PLAYBOOKS: Readonly<Record<OrganizationAuditPlaybookTopic, import("../../../lib/playbook-resources.js").EmbeddedPlaybook>>;
|
|
10
|
+
export declare function registerOrganizationAuditPlaybook(server: McpServer): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Organization-audit multi-playbook resources (core + topics + index).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ORGANIZATION_AUDIT_TOPIC_PLAYBOOKS = exports.ORGANIZATION_AUDIT_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.ORGANIZATION_AUDIT_HARD_BANS = void 0;
|
|
7
|
+
exports.registerOrganizationAuditPlaybook = registerOrganizationAuditPlaybook;
|
|
8
|
+
const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
|
|
9
|
+
const playbooks = (0, playbook_resources_js_1.definePersonaPlaybooks)({
|
|
10
|
+
personaId: 'organization-audit',
|
|
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.',
|
|
13
|
+
coreDescription: 'Hard bans, tool catalog, scope, and report rules',
|
|
14
|
+
topics: [
|
|
15
|
+
{
|
|
16
|
+
id: 'access',
|
|
17
|
+
title: 'Organization-audit access playbook',
|
|
18
|
+
description: 'Identity and project/access governance phases',
|
|
19
|
+
file: 'access.md',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'content',
|
|
23
|
+
title: 'Organization-audit content playbook',
|
|
24
|
+
description: 'Content inventory, validation, and usage health',
|
|
25
|
+
file: 'content.md',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'deliveries',
|
|
29
|
+
title: 'Organization-audit deliveries playbook',
|
|
30
|
+
description: 'Scheduled delivery review without mutation',
|
|
31
|
+
file: 'deliveries.md',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
});
|
|
35
|
+
exports.ORGANIZATION_AUDIT_HARD_BANS = playbooks.HARD_BANS;
|
|
36
|
+
exports.getAllPlaybookMarkdown = playbooks.getAllPlaybookMarkdown;
|
|
37
|
+
exports.ORGANIZATION_AUDIT_CORE_PLAYBOOK = playbooks.CORE_PLAYBOOK;
|
|
38
|
+
exports.ORGANIZATION_AUDIT_TOPIC_PLAYBOOKS = playbooks.TOPIC_PLAYBOOKS;
|
|
39
|
+
function registerOrganizationAuditPlaybook(server) {
|
|
40
|
+
playbooks.registerPlaybooks(server);
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
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;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Semantic-layer prompt/playbook invariants.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const vitest_1 = require("vitest");
|
|
7
|
+
const playbooks_js_1 = require("./resources/playbooks.js");
|
|
8
|
+
const index_js_1 = require("./index.js");
|
|
9
|
+
(0, vitest_1.describe)('semantic-layer prompts/playbook', () => {
|
|
10
|
+
(0, vitest_1.it)('playbooks reference only registered tool short ids', () => {
|
|
11
|
+
const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
|
|
12
|
+
for (const id of index_js_1.SEMANTIC_LAYER_TOOL_IDS) {
|
|
13
|
+
(0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
|
|
14
|
+
}
|
|
15
|
+
(0, vitest_1.expect)(md).not.toMatch(/\bldt__/);
|
|
16
|
+
(0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
|
|
17
|
+
(0, vitest_1.expect)(playbooks_js_1.SEMANTIC_LAYER_HARD_BANS.toLowerCase()).toContain('sql');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
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}`.
|
|
@@ -0,0 +1,39 @@
|
|
|
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.
|
|
@@ -0,0 +1,76 @@
|
|
|
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.
|
|
@@ -0,0 +1,13 @@
|
|
|
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.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic-layer multi-playbook resources (core + topics + index).
|
|
3
|
+
*/
|
|
4
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
5
|
+
export type SemanticLayerPlaybookTopic = 'compose-compile' | 'explore';
|
|
6
|
+
export declare const SEMANTIC_LAYER_CORE_URI: string;
|
|
7
|
+
export declare const SEMANTIC_LAYER_EXPLORE_URI: string;
|
|
8
|
+
export declare const SEMANTIC_LAYER_COMPOSE_COMPILE_URI: string;
|
|
9
|
+
export declare const SEMANTIC_LAYER_HARD_BANS: string;
|
|
10
|
+
export declare const getAllPlaybookMarkdown: () => string;
|
|
11
|
+
export declare const SEMANTIC_LAYER_CORE_PLAYBOOK: import("../../../lib/playbook-resources.js").EmbeddedPlaybook;
|
|
12
|
+
export declare const SEMANTIC_LAYER_TOPIC_PLAYBOOKS: Readonly<Record<SemanticLayerPlaybookTopic, import("../../../lib/playbook-resources.js").EmbeddedPlaybook>>;
|
|
13
|
+
export declare function registerSemanticLayerPlaybook(server: McpServer): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Semantic-layer multi-playbook resources (core + topics + index).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SEMANTIC_LAYER_TOPIC_PLAYBOOKS = exports.SEMANTIC_LAYER_CORE_PLAYBOOK = exports.getAllPlaybookMarkdown = exports.SEMANTIC_LAYER_HARD_BANS = exports.SEMANTIC_LAYER_COMPOSE_COMPILE_URI = exports.SEMANTIC_LAYER_EXPLORE_URI = exports.SEMANTIC_LAYER_CORE_URI = void 0;
|
|
7
|
+
exports.registerSemanticLayerPlaybook = registerSemanticLayerPlaybook;
|
|
8
|
+
const playbook_resources_js_1 = require("../../../lib/playbook-resources.js");
|
|
9
|
+
const playbooks = (0, playbook_resources_js_1.definePersonaPlaybooks)({
|
|
10
|
+
personaId: 'semantic-layer',
|
|
11
|
+
moduleDir: __dirname,
|
|
12
|
+
/** Shared hard-ban text for prompts (keep in sync with playbooks/core.md Hard bans section). */
|
|
13
|
+
hardBans: 'Do not run metric/SQL/chart queries, use SQL runner, trigger validation jobs, mutate content, or call AI/identity tools. Those are not available on this server.',
|
|
14
|
+
coreDescription: 'Hard bans, allowed tools, project scope, and stop criteria',
|
|
15
|
+
topics: [
|
|
16
|
+
{
|
|
17
|
+
id: 'explore',
|
|
18
|
+
title: 'Semantic-layer explore playbook',
|
|
19
|
+
description: 'Explore discovery, disambiguation, and field shortlisting',
|
|
20
|
+
file: 'explore.md',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'compose-compile',
|
|
24
|
+
title: 'Semantic-layer compose/compile playbook',
|
|
25
|
+
description: 'Compose metric queries and compile without warehouse execution',
|
|
26
|
+
file: 'compose-compile.md',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
});
|
|
30
|
+
exports.SEMANTIC_LAYER_CORE_URI = playbooks.URIs.core;
|
|
31
|
+
exports.SEMANTIC_LAYER_EXPLORE_URI = playbooks.URIs.topics.explore;
|
|
32
|
+
exports.SEMANTIC_LAYER_COMPOSE_COMPILE_URI = playbooks.URIs.topics['compose-compile'];
|
|
33
|
+
exports.SEMANTIC_LAYER_HARD_BANS = playbooks.HARD_BANS;
|
|
34
|
+
exports.getAllPlaybookMarkdown = playbooks.getAllPlaybookMarkdown;
|
|
35
|
+
exports.SEMANTIC_LAYER_CORE_PLAYBOOK = playbooks.CORE_PLAYBOOK;
|
|
36
|
+
exports.SEMANTIC_LAYER_TOPIC_PLAYBOOKS = playbooks.TOPIC_PLAYBOOKS;
|
|
37
|
+
function registerSemanticLayerPlaybook(server) {
|
|
38
|
+
playbooks.registerPlaybooks(server);
|
|
39
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persona type definitions (tools selected from shared registry).
|
|
3
|
+
*/
|
|
4
|
+
import type { ToolId } from '../tools/registry.js';
|
|
5
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
6
|
+
export type PersonaId = 'content-developer' | 'content-governance' | 'content-reader' | 'organization-audit' | 'semantic-layer';
|
|
7
|
+
export type PersonaDefinition = {
|
|
8
|
+
id: PersonaId;
|
|
9
|
+
/** Fixed Streamable HTTP MCP endpoint path for this persona. */
|
|
10
|
+
path: `/${string}`;
|
|
11
|
+
/**
|
|
12
|
+
* MCP server display name. Defaults to `lightdash-mcp-${id}`.
|
|
13
|
+
* Use a shorter name when combined with `lightdash_*` tools would exceed ~60 chars.
|
|
14
|
+
*/
|
|
15
|
+
serverName?: string;
|
|
16
|
+
toolIds: readonly ToolId[];
|
|
17
|
+
registerPrompts: (server: McpServer) => void;
|
|
18
|
+
registerResources: (server: McpServer) => void;
|
|
19
|
+
};
|