@lightdash-tools/mcp 0.12.0 → 0.13.1

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 (127) hide show
  1. package/README.md +23 -14
  2. package/dist/bin.d.ts +1 -0
  3. package/dist/bin.js +31 -57
  4. package/dist/cli-help.d.ts +5 -0
  5. package/dist/cli-help.js +23 -0
  6. package/dist/cli-help.test.js +24 -0
  7. package/dist/config/env.d.ts +2 -2
  8. package/dist/config/env.js +3 -3
  9. package/dist/config/load-mcp-config.js +10 -2
  10. package/dist/config/load-mcp-config.test.js +34 -6
  11. package/dist/config/obsolete-env.js +0 -4
  12. package/dist/config/obsolete-env.test.js +0 -5
  13. package/dist/config/runtime.js +1 -1
  14. package/dist/index.d.ts +5 -2
  15. package/dist/index.js +22 -32
  16. package/dist/notifications/operation-reporter.d.ts +13 -0
  17. package/dist/notifications/operation-reporter.js +45 -0
  18. package/dist/notifications/operation-reporter.test.js +79 -0
  19. package/dist/profiles/ai-agent-ops/v1/index.js +25 -6
  20. package/dist/profiles/ai-agent-ops/v1/prompts.test.js +2 -5
  21. package/dist/profiles/content-developer/v1/index.js +36 -6
  22. package/dist/profiles/content-developer/v1/prompts.test.js +7 -8
  23. package/dist/profiles/content-governance/v1/index.js +7 -6
  24. package/dist/profiles/content-governance/v1/prompts.test.js +2 -5
  25. package/dist/profiles/content-reader/v1/index.js +26 -6
  26. package/dist/profiles/content-reader/v1/prompts.test.js +2 -5
  27. package/dist/profiles/data-analyst/v1/index.js +19 -6
  28. package/dist/profiles/data-analyst/v1/prompts.test.js +2 -4
  29. package/dist/profiles/index.d.ts +3 -1
  30. package/dist/profiles/index.js +6 -1
  31. package/dist/profiles/index.test.js +29 -14
  32. package/dist/profiles/organization-audit/v1/index.js +27 -6
  33. package/dist/profiles/organization-audit/v1/prompts.test.js +2 -5
  34. package/dist/profiles/semantic-layer/v1/index.js +17 -6
  35. package/dist/profiles/semantic-layer/v1/prompts.js +3 -2
  36. package/dist/profiles/semantic-layer/v1/prompts.test.js +2 -5
  37. package/dist/profiles/semantic-layer/v1/resources/playbooks/compose-compile.md +14 -8
  38. package/dist/profiles/semantic-layer/v1/resources/playbooks/core.md +9 -9
  39. package/dist/profiles/semantic-layer/v1/resources/playbooks/explore.md +4 -3
  40. package/dist/profiles/test-support/playbook-invariants.d.ts +5 -0
  41. package/dist/profiles/test-support/playbook-invariants.js +14 -0
  42. package/dist/profiles/types.d.ts +6 -1
  43. package/dist/profiles/types.js +1 -1
  44. package/dist/protocol-contract.test.js +2 -2
  45. package/dist/server/capabilities.d.ts +2 -2
  46. package/dist/server/capabilities.js +3 -4
  47. package/dist/server/capabilities.test.js +4 -5
  48. package/dist/stdio.process.test.js +114 -193
  49. package/dist/tools/ai-agents/agents.d.ts +2 -0
  50. package/dist/tools/ai-agents/agents.js +5 -0
  51. package/dist/tools/ai-agents/discovery.d.ts +4 -0
  52. package/dist/tools/ai-agents/discovery.js +7 -0
  53. package/dist/tools/ai-agents/evaluations.d.ts +9 -0
  54. package/dist/tools/ai-agents/evaluations.js +12 -0
  55. package/dist/tools/ai-agents/threads.d.ts +2 -0
  56. package/dist/tools/ai-agents/threads.js +5 -0
  57. package/dist/tools/composition/explain-content.d.ts +1 -0
  58. package/dist/tools/composition/explain-content.js +4 -0
  59. package/dist/tools/organization/invariants.test.js +7 -3
  60. package/dist/tools/organization/inventory.d.ts +5 -0
  61. package/dist/tools/organization/inventory.js +8 -0
  62. package/dist/tools/organization/roles.d.ts +5 -0
  63. package/dist/tools/organization/roles.js +8 -0
  64. package/dist/tools/project/content.d.ts +4 -0
  65. package/dist/tools/project/content.js +7 -0
  66. package/dist/tools/project/delete-chart.d.ts +3 -1
  67. package/dist/tools/project/delete-chart.js +4 -2
  68. package/dist/tools/project/delete-dashboard.d.ts +3 -1
  69. package/dist/tools/project/delete-dashboard.js +4 -2
  70. package/dist/tools/project/developer-content-preview.d.ts +3 -0
  71. package/dist/tools/project/developer-content-preview.js +6 -0
  72. package/dist/tools/project/developer-content.d.ts +16 -1
  73. package/dist/tools/project/developer-content.js +18 -5
  74. package/dist/tools/project/developer-get-chart-as-code.d.ts +1 -0
  75. package/dist/tools/project/developer-get-chart-as-code.js +4 -0
  76. package/dist/tools/project/get-dashboard-promote-diff.d.ts +1 -0
  77. package/dist/tools/project/get-dashboard-promote-diff.js +4 -0
  78. package/dist/tools/project/invariants.test.js +6 -18
  79. package/dist/tools/project/parameters.d.ts +2 -0
  80. package/dist/tools/project/parameters.js +5 -0
  81. package/dist/tools/project/projects.d.ts +8 -2
  82. package/dist/tools/project/projects.js +34 -38
  83. package/dist/tools/project/projects.test.js +6 -6
  84. package/dist/tools/project/promote-dashboard.d.ts +3 -1
  85. package/dist/tools/project/promote-dashboard.js +4 -2
  86. package/dist/tools/project/reader-content.d.ts +3 -0
  87. package/dist/tools/project/reader-content.js +6 -0
  88. package/dist/tools/project/reader-execution.d.ts +2 -0
  89. package/dist/tools/project/reader-execution.js +5 -0
  90. package/dist/tools/project/reader-export-chart-image.d.ts +1 -0
  91. package/dist/tools/project/reader-export-chart-image.js +4 -0
  92. package/dist/tools/project/schedulers.d.ts +2 -0
  93. package/dist/tools/project/schedulers.js +5 -0
  94. package/dist/tools/project/spaces.d.ts +2 -0
  95. package/dist/tools/project/spaces.js +5 -0
  96. package/dist/tools/query/lifecycle.d.ts +2 -0
  97. package/dist/tools/query/lifecycle.js +5 -0
  98. package/dist/tools/query/run-metric-query.d.ts +1 -0
  99. package/dist/tools/query/run-metric-query.js +4 -0
  100. package/dist/tools/registry.d.ts +5 -284
  101. package/dist/tools/registry.js +9 -137
  102. package/dist/tools/registry.test.js +36 -0
  103. package/dist/tools/semantic/explores.d.ts +5 -1
  104. package/dist/tools/semantic/explores.js +8 -1
  105. package/dist/tools/semantic/metrics.d.ts +3 -1
  106. package/dist/tools/semantic/metrics.js +6 -1
  107. package/dist/tools/semantic/query.d.ts +2 -1
  108. package/dist/tools/semantic/query.js +11 -3
  109. package/dist/tools/semantic/query.test.d.ts +4 -0
  110. package/dist/tools/semantic/query.test.js +134 -0
  111. package/dist/tools/shared.d.ts +4 -1
  112. package/dist/tools/shared.js +6 -3
  113. package/dist/tools/space/access.d.ts +2 -0
  114. package/dist/tools/space/access.js +5 -0
  115. package/dist/tools/types.d.ts +18 -0
  116. package/dist/tools/types.js +29 -0
  117. package/dist/tools/types.test.d.ts +1 -0
  118. package/dist/tools/types.test.js +50 -0
  119. package/package.json +5 -5
  120. package/dist/index.test.js +0 -9
  121. package/dist/profiles/profile.membership.test.js +0 -36
  122. package/dist/tools/index.d.ts +0 -4
  123. package/dist/tools/index.js +0 -8
  124. package/dist/tools/index.test.js +0 -78
  125. /package/dist/{index.test.d.ts → cli-help.test.d.ts} +0 -0
  126. /package/dist/{profiles/profile.membership.test.d.ts → notifications/operation-reporter.test.d.ts} +0 -0
  127. /package/dist/tools/{index.test.d.ts → registry.test.d.ts} +0 -0
@@ -4,16 +4,27 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.semanticLayerProfile = exports.SEMANTIC_LAYER_PROFILE_PATH = void 0;
7
+ const projects_js_1 = require("../../../tools/project/projects.js");
8
+ const explores_js_1 = require("../../../tools/semantic/explores.js");
9
+ const metrics_js_1 = require("../../../tools/semantic/metrics.js");
10
+ const query_js_1 = require("../../../tools/semantic/query.js");
7
11
  const prompts_js_1 = require("./prompts.js");
8
12
  const playbooks_js_1 = require("./resources/playbooks.js");
9
13
  exports.SEMANTIC_LAYER_PROFILE_PATH = '/semantic-layer/v1/mcp';
10
14
  exports.semanticLayerProfile = {
11
15
  id: 'semantic-layer',
12
16
  path: exports.SEMANTIC_LAYER_PROFILE_PATH,
13
- registerPrompts: (server) => {
14
- (0, prompts_js_1.registerSemanticLayerPrompts)(server);
15
- },
16
- registerResources: (server) => {
17
- (0, playbooks_js_1.registerSemanticLayerPlaybook)(server);
18
- },
17
+ tools: [
18
+ projects_js_1.listProjectsTool,
19
+ projects_js_1.getProjectTool,
20
+ explores_js_1.listExploresTool,
21
+ explores_js_1.getExploreTool,
22
+ explores_js_1.listDimensionsTool,
23
+ explores_js_1.getFieldLineageTool,
24
+ metrics_js_1.listMetricsTool,
25
+ metrics_js_1.getMetricTool,
26
+ query_js_1.compileQueryTool,
27
+ ],
28
+ registerPrompts: prompts_js_1.registerSemanticLayerPrompts,
29
+ registerResources: playbooks_js_1.registerSemanticLayerPlaybook,
19
30
  };
@@ -62,7 +62,7 @@ Procedure:
62
62
  1. If exploreId is missing, resolve it per explore playbook (search + disambiguation). Stay on this projectUuid.
63
63
  2. Copy fieldIds from list_dimensions and {exploreId}_{metricName} from get_explore → tables[baseTable].metrics. Never invent grains.
64
64
  3. If the user asked for N insights, reuse one explore and compile N diverse cuts.
65
- 4. compile_query with fieldIds only. After each compile, verify every requested fieldId appears as a SELECT alias (missing alias = failure even without isError). ≤2 fix retries.
65
+ 4. Build metricQuery from the compose-compile skeleton (fieldIds only; tool sets exploreName from exploreId and defaults missing tableCalculations to []). After each compile, verify every requested fieldId appears as a SELECT alias (missing alias = failure even without isError). Prefer SELECT aliases over metric name/label. ≤2 fix retries.
66
66
  5. Deliverable: insight title(s) + fieldIds + compiled SQL (or errors). Never paste full explore/dimension/metric/lineage payloads.
67
67
 
68
68
  Follow embedded playbooks (${playbooks_js_1.SEMANTIC_LAYER_CORE_URI}, ${playbooks_js_1.SEMANTIC_LAYER_COMPOSE_COMPILE_URI}).`, 'compose-compile');
@@ -86,7 +86,8 @@ ${err}
86
86
  ${playbooks_js_1.SEMANTIC_LAYER_HARD_BANS}
87
87
 
88
88
  Checklist:
89
- - unknown field id / empty SELECT / missing SELECT alias → use fieldIds from list_dimensions (base table) + explore-local metrics; re-compile (≤2 retries).
89
+ - unknown field id / empty SELECT / missing SELECT alias → use fieldIds from list_dimensions (base table) + explore-local metrics; re-compile (≤2 retries). Prefer SELECT aliases / compiledSql over metric name/label.
90
+ - Other OpenAPI-required keys still failing (filters, sorts, limit, …) → copy the compose-compile skeleton; MCP fills exploreName and missing tableCalculations.
90
91
  - Wrong explore → re-disambiguate (schemaName; label or name __{table}; skip empty schema / eda unless asked).
91
92
  - Metric not found / catalog empty → get_explore tables[baseTable].metrics; tableName must be the full explore id; compile as {exploreId}_{metricName}.
92
93
  - Verify SELECT aliases after every compile. Stop after a good compile or a clear blocker.
@@ -3,16 +3,13 @@
3
3
  * Semantic-layer prompt/playbook invariants.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const common_1 = require("@lightdash-tools/common");
7
6
  const vitest_1 = require("vitest");
7
+ const playbook_invariants_js_1 = require("../../test-support/playbook-invariants.js");
8
8
  const playbooks_js_1 = require("./resources/playbooks.js");
9
9
  (0, vitest_1.describe)('semantic-layer prompts/playbook', () => {
10
10
  (0, vitest_1.it)('playbooks reference only registered tool short ids', () => {
11
11
  const md = (0, playbooks_js_1.getAllPlaybookMarkdown)();
12
- for (const id of (0, common_1.listMcpToolNamesByProfile)('semantic-layer')) {
13
- (0, vitest_1.expect)(md.includes(id) || md.includes(`lightdash_${id}`)).toBe(true);
14
- }
15
- (0, vitest_1.expect)(md).not.toMatch(/\bldt__/);
12
+ (0, playbook_invariants_js_1.expectPlaybookCoversProfileTools)('semantic-layer', md);
16
13
  (0, vitest_1.expect)(md.toLowerCase()).toContain('hard bans');
17
14
  (0, vitest_1.expect)(playbooks_js_1.SEMANTIC_LAYER_HARD_BANS.toLowerCase()).toContain('sql');
18
15
  });
@@ -25,16 +25,21 @@ URI: `lightdash://playbooks/semantic-layer/compose-compile`
25
25
 
26
26
  `metrics` may be `[]`. Every string in `dimensions` / `metrics` / `sorts[].fieldId` must appear in prior tool output.
27
27
 
28
+ MCP `compile_query` always sets `exploreName` from the tool `exploreId` (path is authoritative) and defaults missing `tableCalculations` to `[]`. Keep the full skeleton for other OpenAPI-required keys (`filters`, `sorts`, `limit`, …) and for CLI/JSON callers. Prefer SELECT aliases / metric `compiledSql` over metric **name/label** when they disagree.
29
+
28
30
  ## Field IDs — failure modes
29
31
 
30
- | Symptom | Cause | Fix |
31
- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
32
- | `unknown field id` / hard error | Short names or typos | Use full `fieldId` from `list_dimensions` / `{exploreId}_{metricName}` |
33
- | Server `isError` + empty SELECT | Upstream accepted bad ids with **zero** columns | Replace with real fieldIds; re-compile once |
34
- | SQL “succeeds” but a requested dim/metric is **missing** from SELECT | Invented or wrong fieldId (e.g. non-existent `*_session_day`) while another field still projected | Re-check against `list_dimensions` / metrics map; re-compile |
35
- | `Metric not found` on `get_metric` | `tableName` was warehouse label | Use full explore id |
32
+ | Symptom | Cause | Fix |
33
+ | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
34
+ | `unknown field id` / hard error | Short names or typos | Use full `fieldId` from `list_dimensions` / `{exploreId}_{metricName}` |
35
+ | Server `isError` + empty SELECT | Upstream accepted bad ids with **zero** columns | Replace with real fieldIds; re-compile once |
36
+ | SQL “succeeds” but a requested dim/metric is **missing** from SELECT | Invented or wrong fieldId (e.g. non-existent `*_session_day`) while another field still projected | Re-check against `list_dimensions` / metrics map; re-compile |
37
+ | `UPSTREAM_VALIDATION` / `'tableCalculations' is required` | Body omitted `tableCalculations` (pre-harden / non-MCP clients) | MCP defaults to `[]`; pass `tableCalculations: []` explicitly if needed |
38
+ | `UPSTREAM_VALIDATION` / `'exploreName' is required` | Body omitted `exploreName` (pre-harden / non-MCP clients) or wrong exploreId | Pass locked `exploreId`; MCP fills `exploreName` — re-compile once |
39
+ | `Metric not found` on `get_metric` | `tableName` was warehouse label | Use full explore id |
40
+ | Lineage works with short name but compile fails | `get_field_lineage` accepts short names; `compile_query` does not | Always copy full `fieldId` into `metricQuery` |
36
41
 
37
- Compiled SQL may include **extra related metrics** the semantic layer pulls in — OK if every **requested** fieldId still appears as a SELECT alias.
42
+ Compiled SQL may include **extra related metrics** the semantic layer pulls in — OK if every **requested** fieldId still appears as a SELECT alias. Prefer SELECT aliases / metric `compiledSql` over metric **name/label** when they disagree (e.g. a metric named `num_unique_order_ids` that actually `COUNT(DISTINCT customer_id)`).
38
43
 
39
44
  ## Verify after every compile (mandatory)
40
45
 
@@ -54,7 +59,8 @@ When the user asks for N insights on one table/explore:
54
59
 
55
60
  ## Debug checklist
56
61
 
57
- - Empty SELECT / unknown field id / missing alias → fix fieldIds from `list_dimensions` + explore-local metrics; re-compile (≤2 retries).
62
+ - Unknown field id / short names / empty SELECT / missing SELECT alias → fix fieldIds from `list_dimensions` + explore-local metrics; re-compile (≤2 retries). Prefer SELECT aliases / `compiledSql` over metric name/label.
63
+ - Other OpenAPI-required keys still failing (`filters`, `sorts`, `limit`, …) → copy the skeleton; MCP already fills `exploreName` and missing `tableCalculations`.
58
64
  - Wrong explore → re-disambiguate (`schemaName`; exact `label` or `name` `__{table}`; skip empty schema / eda unless asked).
59
65
  - Catalog empty / metric not found → `get_explore` `tables[baseTable].metrics`; compile as `{exploreId}_{metricName}`.
60
66
  - Stop after a good verified compile or a clear blocker.
@@ -31,15 +31,15 @@ Record when a budget stopped you.
31
31
 
32
32
  ## Allowed tools (`lightdash_` prefix)
33
33
 
34
- | Tool | Use for |
35
- | ------------------------------- | --------------------------------------------------------------------------------------------- |
36
- | `list_projects` / `get_project` | Confirm UUID ↔ name. Credentials never returned (`REDACTED` warning is normal). |
37
- | `list_explores` | Summaries only. **Always** pass `search` + `limit`. |
38
- | `list_dimensions` | Compact `{ name, label, table, type, fieldId }`. Default = base table only. |
39
- | `get_explore` | **Preferred** metric menu: `tables[baseTable].metrics` names/labels only. Ignore join tables. |
40
- | `list_metrics` / `get_metric` | Optional catalog / definition dig. Filter `tableName === exploreId`. |
41
- | `compile_query` | Compile only — never “run”. |
42
- | `get_field_lineage` | Optional provenance; summarize, don’t dump. |
34
+ | Tool | Use for |
35
+ | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
36
+ | `list_projects` / `get_project` | Confirm UUID ↔ name. Credentials never returned (`REDACTED` warning is normal). |
37
+ | `list_explores` | Summaries only. **Always** pass `search` + `limit`. |
38
+ | `list_dimensions` | Compact `{ name, label, table, type, fieldId }`. Default = base table only. |
39
+ | `get_explore` | **Preferred** metric menu: `tables[baseTable].metrics` names/labels only. Ignore join **metrics**; joined dims via `list_dimensions` (`baseTableOnly=false`) when needed. |
40
+ | `list_metrics` / `get_metric` | Optional catalog / definition dig. Filter `tableName === exploreId`. |
41
+ | `compile_query` | Compile only — never “run”. Sets `exploreName` from `exploreId`; defaults missing `tableCalculations` to `[]`. Prefer compiled SQL aliases over metric labels. |
42
+ | `get_field_lineage` | Optional provenance; summarize, don’t dump. |
43
43
 
44
44
  ## Project scope (critical)
45
45
 
@@ -37,7 +37,7 @@ Remember: `databaseName` may differ from the Lightdash project’s usual warehou
37
37
 
38
38
  1. `list_explores` → disambiguate → lock `exploreId` (= explore `name`).
39
39
  2. `list_dimensions` (default `baseTableOnly=true`). Set `baseTableOnly=false` only if you need joined-table fields (payload grows a lot).
40
- 3. Metrics: **`get_explore` → `tables[baseTable].metrics` only** (see below). Do not dump the explore JSON.
40
+ 3. Metrics: **`get_explore` → `tables[baseTable].metrics` only** (see below). Ignore join metrics; do not dump the explore JSON.
41
41
  4. Stop at a shortlist unless the user asked to compile.
42
42
 
43
43
  ## Metrics: catalog vs explore-local (critical)
@@ -53,11 +53,12 @@ Remember: `databaseName` may differ from the Lightdash project’s usual warehou
53
53
 
54
54
  Rules:
55
55
 
56
- 1. Once the explore is known, prefer **`get_explore` → `tables[baseTable].metrics`** for the local menu (names + labels only). Ignore other keys under `tables` (joins).
56
+ 1. Once the explore is known, prefer **`get_explore` → `tables[baseTable].metrics`** for the local menu (names + labels only). Ignore join **metrics** under other `tables` keys; do not dump the explore JSON.
57
57
  2. Optional catalog: at most **one** `list_metrics` page. Keep rows where `tableName` **equals the full explore id**.
58
- 3. `get_metric` `tableName` must be the full explore id. Short labels → “Metric not found”. Call only when definition/SQL is needed; summarize — payloads include huge `availableTimeDimensions` from joins.
58
+ 3. `get_metric` `tableName` must be the full explore id. Short labels → “Metric not found”. Call only when definition/SQL is needed; summarize — payloads include huge `availableTimeDimensions` from joins. Prefer `compiledSql` over name/label when they disagree.
59
59
  4. Compile metric ids as `{exploreId}_{metricName}` (same pattern as dimension `fieldId` from `list_dimensions`).
60
60
  5. Dimension-only (`metrics: []`) is valid for volume-by-time; for “insights” prefer real explore metrics when available.
61
+ 6. Joined **dimension** `fieldId`s (e.g. `customers_*` on an `orders` explore) are valid when `list_dimensions` with `baseTableOnly=false` returns them — use only those copied ids.
61
62
 
62
63
  ## Dimension shortlist (large explores)
63
64
 
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Shared playbook coverage checks for profile prompt tests.
3
+ */
4
+ import type { ProfileId } from '../types.js';
5
+ export declare function expectPlaybookCoversProfileTools(profileId: ProfileId, markdown: string): void;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * Shared playbook coverage checks for profile prompt tests.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.expectPlaybookCoversProfileTools = expectPlaybookCoversProfileTools;
7
+ const vitest_1 = require("vitest");
8
+ const index_js_1 = require("../index.js");
9
+ function expectPlaybookCoversProfileTools(profileId, markdown) {
10
+ for (const id of (0, index_js_1.listToolIds)((0, index_js_1.getProfile)(profileId))) {
11
+ (0, vitest_1.expect)(markdown.includes(id) || markdown.includes(`lightdash_${id}`)).toBe(true);
12
+ }
13
+ (0, vitest_1.expect)(markdown).not.toMatch(/\bldt__/);
14
+ }
@@ -1,6 +1,7 @@
1
1
  /**
2
- * Profile packaging types (tools from the operation catalog, ADR-0006).
2
+ * Profile packaging types — tools are ToolModules imported by each profile.
3
3
  */
4
+ import type { ToolModule } from '../tools/types.js';
4
5
  import type { ProfileId } from '@lightdash-tools/common';
5
6
  import type { McpServer } from '@modelcontextprotocol/server';
6
7
  export type { ProfileId };
@@ -13,6 +14,10 @@ export type ProfileDefinition = {
13
14
  * Use a shorter name when combined with `lightdash_*` tools would exceed ~60 chars.
14
15
  */
15
16
  serverName?: string;
17
+ /**
18
+ * Mounted tools for this profile (import ToolModules; array order is tools/list order).
19
+ */
20
+ tools: readonly ToolModule[];
16
21
  registerPrompts: (server: McpServer) => void;
17
22
  registerResources: (server: McpServer) => void;
18
23
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  /**
3
- * Profile packaging types (tools from the operation catalog, ADR-0006).
3
+ * Profile packaging types — tools are ToolModules imported by each profile.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  * (createMcpHandler + StreamableHTTPClientTransport with versionNegotiation).
6
6
  * No Lightdash network calls — stub McpContextProvider only.
7
7
  */
8
- const common_1 = require("@lightdash-tools/common");
9
8
  const client_1 = require("@modelcontextprotocol/client");
10
9
  const server_1 = require("@modelcontextprotocol/server");
11
10
  const vitest_1 = require("vitest");
11
+ const index_js_1 = require("./profiles/index.js");
12
12
  const server_js_1 = require("./server/server.js");
13
13
  const shared_js_1 = require("./tools/shared.js");
14
- const EXPECTED_TOOL_COUNT = (0, common_1.listMcpToolNamesByProfile)('semantic-layer').length;
14
+ const EXPECTED_TOOL_COUNT = (0, index_js_1.getProfile)('semantic-layer').tools.length;
15
15
  function createStubContextProvider() {
16
16
  return {
17
17
  getContext: async () => ({
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Register tools / prompts / resources for a profile.
2
+ * Registers MCP capabilities for a profile.
3
3
  */
4
4
  import type { McpContextProvider } from './request-context.js';
5
5
  import type { ProfileDefinition } from '../profiles/types.js';
@@ -10,6 +10,6 @@ export type RegisterCapabilitiesOptions = {
10
10
  };
11
11
  /**
12
12
  * Registers MCP capabilities for the given profile.
13
- * Tools come from the operation catalog via listMcpToolNamesByProfile (ADR-0006).
13
+ * Tools come from profile.tools (ToolModule imports).
14
14
  */
15
15
  export declare function registerCapabilities(server: McpServer, contextProvider: McpContextProvider, options?: RegisterCapabilitiesOptions): void;
@@ -1,22 +1,21 @@
1
1
  "use strict";
2
2
  /**
3
- * Register tools / prompts / resources for a profile.
3
+ * Registers MCP capabilities for a profile.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.registerCapabilities = registerCapabilities;
7
- const common_1 = require("@lightdash-tools/common");
8
7
  const server_profile_js_1 = require("../audit/server-profile.js");
9
8
  const index_js_1 = require("../profiles/index.js");
10
9
  const registry_js_1 = require("../tools/registry.js");
11
10
  /**
12
11
  * Registers MCP capabilities for the given profile.
13
- * Tools come from the operation catalog via listMcpToolNamesByProfile (ADR-0006).
12
+ * Tools come from profile.tools (ToolModule imports).
14
13
  */
15
14
  function registerCapabilities(server, contextProvider, options) {
16
15
  var _a;
17
16
  const profile = (_a = options === null || options === void 0 ? void 0 : options.profile) !== null && _a !== void 0 ? _a : (0, index_js_1.getDefaultProfile)();
18
17
  (0, server_profile_js_1.bindServerProfile)(server, profile.id);
19
- (0, registry_js_1.registerToolsByIds)(server, contextProvider, (0, common_1.listMcpToolNamesByProfile)(profile.id));
18
+ (0, registry_js_1.registerTools)(server, contextProvider, profile.tools);
20
19
  profile.registerPrompts(server);
21
20
  profile.registerResources(server);
22
21
  }
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const common_1 = require("@lightdash-tools/common");
4
3
  const server_1 = require("@modelcontextprotocol/server");
5
4
  const vitest_1 = require("vitest");
6
5
  const server_profile_js_1 = require("../audit/server-profile.js");
@@ -10,7 +9,7 @@ const capabilities_js_1 = require("./capabilities.js");
10
9
  vitest_1.vi.mock('../tools/registry.js', async (importOriginal) => {
11
10
  // eslint-disable-next-line @typescript-eslint/consistent-type-imports -- vitest importOriginal
12
11
  const actual = await importOriginal();
13
- return Object.assign(Object.assign({}, actual), { registerToolsByIds: vitest_1.vi.fn() });
12
+ return Object.assign(Object.assign({}, actual), { registerTools: vitest_1.vi.fn() });
14
13
  });
15
14
  function createMockContextProvider(lightdashClient = {}) {
16
15
  return {
@@ -29,13 +28,13 @@ function createMockContextProvider(lightdashClient = {}) {
29
28
  server = new server_1.McpServer({ name: 'test', version: '0.0.0' });
30
29
  registerPromptSpy = vitest_1.vi.spyOn(server, 'registerPrompt');
31
30
  registerResourceSpy = vitest_1.vi.spyOn(server, 'registerResource');
32
- vitest_1.vi.mocked(registry_js_1.registerToolsByIds).mockClear();
31
+ vitest_1.vi.mocked(registry_js_1.registerTools).mockClear();
33
32
  });
34
- (0, vitest_1.it)('registers catalog tools and prompts/resources for the profile', () => {
33
+ (0, vitest_1.it)('registers profile tools and prompts/resources', () => {
35
34
  const profile = (0, index_js_1.getDefaultProfile)();
36
35
  (0, capabilities_js_1.registerCapabilities)(server, mockContextProvider, { profile });
37
36
  (0, vitest_1.expect)((0, server_profile_js_1.getServerProfile)(server)).toBe(profile.id);
38
- (0, vitest_1.expect)(registry_js_1.registerToolsByIds).toHaveBeenCalledWith(server, mockContextProvider, (0, common_1.listMcpToolNamesByProfile)(profile.id));
37
+ (0, vitest_1.expect)(registry_js_1.registerTools).toHaveBeenCalledWith(server, mockContextProvider, profile.tools);
39
38
  (0, vitest_1.expect)(registerPromptSpy).toHaveBeenCalled();
40
39
  (0, vitest_1.expect)(registerResourceSpy).toHaveBeenCalled();
41
40
  });