@cyanheads/brapi-mcp-server 0.4.13 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CLAUDE.md +25 -19
  2. package/README.md +40 -26
  3. package/changelog/0.4.x/0.4.13.md +15 -0
  4. package/changelog/0.4.x/0.4.14.md +22 -0
  5. package/changelog/0.5.x/0.5.0.md +59 -0
  6. package/dist/config/builtin-aliases.d.ts +1 -1
  7. package/dist/config/builtin-aliases.js +1 -1
  8. package/dist/config/server-config.d.ts +3 -3
  9. package/dist/config/server-config.d.ts.map +1 -1
  10. package/dist/config/server-config.js +13 -13
  11. package/dist/config/server-config.js.map +1 -1
  12. package/dist/index.js +62 -15
  13. package/dist/index.js.map +1 -1
  14. package/dist/mcp-server/prompts/definitions/brapi-eda-study.prompt.js +1 -1
  15. package/dist/mcp-server/prompts/definitions/brapi-eda-study.prompt.js.map +1 -1
  16. package/dist/mcp-server/prompts/definitions/brapi-meta-analysis.prompt.js +3 -3
  17. package/dist/mcp-server/prompts/definitions/brapi-meta-analysis.prompt.js.map +1 -1
  18. package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.d.ts +8 -11
  19. package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.d.ts.map +1 -1
  20. package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.js +15 -25
  21. package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.js.map +1 -1
  22. package/dist/mcp-server/tools/definitions/brapi-dataframe-drop.tool.d.ts +6 -10
  23. package/dist/mcp-server/tools/definitions/brapi-dataframe-drop.tool.d.ts.map +1 -1
  24. package/dist/mcp-server/tools/definitions/brapi-dataframe-drop.tool.js +6 -16
  25. package/dist/mcp-server/tools/definitions/brapi-dataframe-drop.tool.js.map +1 -1
  26. package/dist/mcp-server/tools/definitions/brapi-dataframe-export.tool.d.ts +69 -0
  27. package/dist/mcp-server/tools/definitions/brapi-dataframe-export.tool.d.ts.map +1 -0
  28. package/dist/mcp-server/tools/definitions/brapi-dataframe-export.tool.js +233 -0
  29. package/dist/mcp-server/tools/definitions/brapi-dataframe-export.tool.js.map +1 -0
  30. package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.d.ts +19 -11
  31. package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.d.ts.map +1 -1
  32. package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.js +80 -28
  33. package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.js.map +1 -1
  34. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.d.ts +4 -6
  35. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.d.ts.map +1 -1
  36. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.js +28 -36
  37. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.js.map +1 -1
  38. package/dist/mcp-server/tools/definitions/brapi-find-germplasm.tool.d.ts +3 -5
  39. package/dist/mcp-server/tools/definitions/brapi-find-germplasm.tool.d.ts.map +1 -1
  40. package/dist/mcp-server/tools/definitions/brapi-find-germplasm.tool.js +21 -17
  41. package/dist/mcp-server/tools/definitions/brapi-find-germplasm.tool.js.map +1 -1
  42. package/dist/mcp-server/tools/definitions/brapi-find-images.tool.d.ts +4 -6
  43. package/dist/mcp-server/tools/definitions/brapi-find-images.tool.d.ts.map +1 -1
  44. package/dist/mcp-server/tools/definitions/brapi-find-images.tool.js +16 -16
  45. package/dist/mcp-server/tools/definitions/brapi-find-images.tool.js.map +1 -1
  46. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.d.ts +3 -5
  47. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.d.ts.map +1 -1
  48. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.js +15 -15
  49. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.js.map +1 -1
  50. package/dist/mcp-server/tools/definitions/brapi-find-observations.tool.d.ts +4 -6
  51. package/dist/mcp-server/tools/definitions/brapi-find-observations.tool.d.ts.map +1 -1
  52. package/dist/mcp-server/tools/definitions/brapi-find-observations.tool.js +17 -17
  53. package/dist/mcp-server/tools/definitions/brapi-find-observations.tool.js.map +1 -1
  54. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.d.ts +4 -6
  55. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.d.ts.map +1 -1
  56. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.js +17 -17
  57. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.js.map +1 -1
  58. package/dist/mcp-server/tools/definitions/brapi-find-variables.tool.d.ts +2 -4
  59. package/dist/mcp-server/tools/definitions/brapi-find-variables.tool.d.ts.map +1 -1
  60. package/dist/mcp-server/tools/definitions/brapi-find-variables.tool.js +60 -19
  61. package/dist/mcp-server/tools/definitions/brapi-find-variables.tool.js.map +1 -1
  62. package/dist/mcp-server/tools/definitions/brapi-find-variants.tool.d.ts +3 -5
  63. package/dist/mcp-server/tools/definitions/brapi-find-variants.tool.d.ts.map +1 -1
  64. package/dist/mcp-server/tools/definitions/brapi-find-variants.tool.js +15 -15
  65. package/dist/mcp-server/tools/definitions/brapi-find-variants.tool.js.map +1 -1
  66. package/dist/mcp-server/tools/definitions/brapi-get-germplasm.tool.d.ts.map +1 -1
  67. package/dist/mcp-server/tools/definitions/brapi-get-germplasm.tool.js +6 -2
  68. package/dist/mcp-server/tools/definitions/brapi-get-germplasm.tool.js.map +1 -1
  69. package/dist/mcp-server/tools/definitions/brapi-raw-get.tool.d.ts +17 -2
  70. package/dist/mcp-server/tools/definitions/brapi-raw-get.tool.d.ts.map +1 -1
  71. package/dist/mcp-server/tools/definitions/brapi-raw-get.tool.js +51 -7
  72. package/dist/mcp-server/tools/definitions/brapi-raw-get.tool.js.map +1 -1
  73. package/dist/mcp-server/tools/definitions/brapi-raw-search.tool.d.ts +16 -2
  74. package/dist/mcp-server/tools/definitions/brapi-raw-search.tool.d.ts.map +1 -1
  75. package/dist/mcp-server/tools/definitions/brapi-raw-search.tool.js +51 -5
  76. package/dist/mcp-server/tools/definitions/brapi-raw-search.tool.js.map +1 -1
  77. package/dist/mcp-server/tools/definitions/index.d.ts +141 -165
  78. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
  79. package/dist/mcp-server/tools/definitions/index.js +28 -17
  80. package/dist/mcp-server/tools/definitions/index.js.map +1 -1
  81. package/dist/mcp-server/tools/shared/find-helpers.d.ts +79 -39
  82. package/dist/mcp-server/tools/shared/find-helpers.d.ts.map +1 -1
  83. package/dist/mcp-server/tools/shared/find-helpers.js +167 -70
  84. package/dist/mcp-server/tools/shared/find-helpers.js.map +1 -1
  85. package/dist/mcp-server/tools/shared/raw-routing-hints.d.ts.map +1 -1
  86. package/dist/mcp-server/tools/shared/raw-routing-hints.js +6 -6
  87. package/dist/mcp-server/tools/shared/raw-routing-hints.js.map +1 -1
  88. package/dist/services/canvas-bridge/canvas-bridge.d.ts +69 -44
  89. package/dist/services/canvas-bridge/canvas-bridge.d.ts.map +1 -1
  90. package/dist/services/canvas-bridge/canvas-bridge.js +220 -103
  91. package/dist/services/canvas-bridge/canvas-bridge.js.map +1 -1
  92. package/dist/services/canvas-bridge/index.d.ts +1 -1
  93. package/dist/services/canvas-bridge/index.d.ts.map +1 -1
  94. package/dist/services/canvas-bridge/index.js +1 -1
  95. package/dist/services/canvas-bridge/index.js.map +1 -1
  96. package/dist/services/canvas-bridge/types.d.ts +11 -12
  97. package/dist/services/canvas-bridge/types.d.ts.map +1 -1
  98. package/dist/services/canvas-bridge/types.js +4 -4
  99. package/package.json +3 -11
  100. package/server.json +3 -3
  101. package/dist/mcp-server/resources/definitions/brapi-dataset.resource.d.ts +0 -13
  102. package/dist/mcp-server/resources/definitions/brapi-dataset.resource.d.ts.map +0 -1
  103. package/dist/mcp-server/resources/definitions/brapi-dataset.resource.js +0 -26
  104. package/dist/mcp-server/resources/definitions/brapi-dataset.resource.js.map +0 -1
  105. package/dist/mcp-server/tools/definitions/brapi-manage-dataset.tool.d.ts +0 -89
  106. package/dist/mcp-server/tools/definitions/brapi-manage-dataset.tool.d.ts.map +0 -1
  107. package/dist/mcp-server/tools/definitions/brapi-manage-dataset.tool.js +0 -306
  108. package/dist/mcp-server/tools/definitions/brapi-manage-dataset.tool.js.map +0 -1
  109. package/dist/services/dataset-store/dataset-store.d.ts +0 -44
  110. package/dist/services/dataset-store/dataset-store.d.ts.map +0 -1
  111. package/dist/services/dataset-store/dataset-store.js +0 -208
  112. package/dist/services/dataset-store/dataset-store.js.map +0 -1
  113. package/dist/services/dataset-store/index.d.ts +0 -8
  114. package/dist/services/dataset-store/index.d.ts.map +0 -1
  115. package/dist/services/dataset-store/index.js +0 -7
  116. package/dist/services/dataset-store/index.js.map +0 -1
  117. package/dist/services/dataset-store/types.d.ts +0 -72
  118. package/dist/services/dataset-store/types.d.ts.map +0 -1
  119. package/dist/services/dataset-store/types.js +0 -8
  120. package/dist/services/dataset-store/types.js.map +0 -1
package/dist/index.js CHANGED
@@ -6,45 +6,91 @@
6
6
  *
7
7
  * @module index
8
8
  */
9
+ // Default the framework canvas provider to DuckDB. The framework defaults
10
+ // `CANVAS_PROVIDER_TYPE` to `'none'`; this server requires a live canvas
11
+ // for spillover, so we override the default before `createApp` reads
12
+ // config. Operator-set values (including `'none'` for diagnostic runs)
13
+ // pass through untouched.
14
+ //
15
+ // ESM hoists the import below ahead of this statement, but the framework's
16
+ // `config` is a lazy Proxy — importing it only declares the Proxy, the
17
+ // underlying `parseConfig()` runs on first property access (which happens
18
+ // inside `createApp`). So this line lands in the window between
19
+ // import-time evaluation and `createApp`'s config read.
20
+ process.env.CANVAS_PROVIDER_TYPE ??= 'duckdb';
21
+ // Bridge `BRAPI_EXPORT_DIR` → `CANVAS_EXPORT_PATH` so the framework's canvas
22
+ // path-traversal sandbox uses the operator-set export root. `??=` so an
23
+ // explicit `CANVAS_EXPORT_PATH` wins (operators who configure the framework
24
+ // directly retain control). When `BRAPI_EXPORT_DIR` is unset, neither is
25
+ // set — the export tool's registration gate fails closed and the canvas
26
+ // runs without an export root (any export call would hit the framework's
27
+ // sandbox check).
28
+ if (process.env.BRAPI_EXPORT_DIR) {
29
+ process.env.CANVAS_EXPORT_PATH ??= process.env.BRAPI_EXPORT_DIR;
30
+ }
9
31
  import { createApp } from '@cyanheads/mcp-ts-core';
32
+ import { configurationError } from '@cyanheads/mcp-ts-core/errors';
10
33
  import { disabledTool } from '@cyanheads/mcp-ts-core/tools';
11
34
  import { getServerConfig } from './config/server-config.js';
12
35
  import { initBrapiClient } from './services/brapi-client/index.js';
13
36
  import { initBrapiDialectRegistry } from './services/brapi-dialect/index.js';
14
37
  import { initCanvasBridge } from './services/canvas-bridge/index.js';
15
38
  import { initCapabilityRegistry } from './services/capability-registry/index.js';
16
- import { initDatasetStore } from './services/dataset-store/index.js';
17
39
  import { initOntologyResolver } from './services/ontology-resolver/index.js';
18
40
  import { initReferenceDataCache } from './services/reference-data-cache/index.js';
19
41
  import { initServerRegistry } from './services/server-registry/index.js';
20
42
  import { brapiEdaStudy } from './mcp-server/prompts/definitions/brapi-eda-study.prompt.js';
21
43
  import { brapiMetaAnalysis } from './mcp-server/prompts/definitions/brapi-meta-analysis.prompt.js';
22
44
  import { brapiCallsResource } from './mcp-server/resources/definitions/brapi-calls.resource.js';
23
- import { brapiDatasetResource } from './mcp-server/resources/definitions/brapi-dataset.resource.js';
24
45
  import { brapiFiltersResource } from './mcp-server/resources/definitions/brapi-filters.resource.js';
25
46
  import { brapiGermplasmResource } from './mcp-server/resources/definitions/brapi-germplasm.resource.js';
26
47
  import { brapiServerInfoResource } from './mcp-server/resources/definitions/brapi-server-info.resource.js';
27
48
  import { brapiStudyResource } from './mcp-server/resources/definitions/brapi-study.resource.js';
28
- import { dataframeToolDefinitions, readOnlyToolDefinitions, writeToolDefinitions, } from './mcp-server/tools/definitions/index.js';
49
+ import { dropToolDefinitions, exportToolDefinitions, readOnlyToolDefinitions, writeToolDefinitions, } from './mcp-server/tools/definitions/index.js';
29
50
  const serverConfig = getServerConfig();
30
51
  /**
31
- * Operator-facing metadata for the dataframe surface gate (BRAPI_CANVAS_ENABLED).
32
- * Surfaces in /.well-known/mcp.json and the HTML landing page so operators see
33
- * the gated tools with reason + hint. The framework's CANVAS_PROVIDER_TYPE
34
- * acts as a second runtime gate inside the bridge — when that's missing the
35
- * tools still register but throw `dataframe_disabled`.
52
+ * Operator-facing metadata for the dataframe-drop gate. Surfaces in
53
+ * /.well-known/mcp.json and the HTML landing page so operators see the
54
+ * gated tool with reason + hint.
36
55
  */
37
- const dataframeDisabled = {
38
- reason: 'Dataframe surface is gated off (BRAPI_CANVAS_ENABLED=false).',
39
- hint: 'Set BRAPI_CANVAS_ENABLED=true and CANVAS_PROVIDER_TYPE=duckdb to enable.',
56
+ const dropDisabled = {
57
+ reason: 'Dataframe drop is gated off (BRAPI_CANVAS_DROP_ENABLED=false).',
58
+ hint: 'Set BRAPI_CANVAS_DROP_ENABLED=true to enable explicit drop. Dataframes also expire via TTL when left unmanaged.',
40
59
  };
41
60
  const writesDisabled = {
42
61
  reason: 'Writes are disabled (BRAPI_ENABLE_WRITES=false).',
43
62
  hint: 'Set BRAPI_ENABLE_WRITES=true to enable observation submission.',
44
63
  };
64
+ /**
65
+ * Resolve the dataframe-export gate. Two reasons it can be off:
66
+ * (1) running under HTTP transport — file paths only make sense when the
67
+ * server lives on the user's machine,
68
+ * (2) `BRAPI_EXPORT_DIR` unset — setting it is the opt-in (no separate
69
+ * enable flag).
70
+ * Returns `null` when the tool should register, otherwise the operator
71
+ * metadata to wrap the disabled tool with.
72
+ */
73
+ function resolveExportGate() {
74
+ const transportMode = process.env.MCP_TRANSPORT_TYPE ?? 'stdio';
75
+ if (transportMode !== 'stdio') {
76
+ return {
77
+ reason: 'Dataframe export requires stdio transport.',
78
+ hint: 'File paths must resolve on the same machine as the user — run the server with MCP_TRANSPORT_TYPE=stdio to enable.',
79
+ };
80
+ }
81
+ if (!serverConfig.exportDir) {
82
+ return {
83
+ reason: 'Dataframe export is unconfigured (BRAPI_EXPORT_DIR unset).',
84
+ hint: 'Set BRAPI_EXPORT_DIR to a writable directory on the server host to enable file export.',
85
+ };
86
+ }
87
+ return null;
88
+ }
89
+ const exportDisabled = resolveExportGate();
45
90
  const tools = [
46
91
  ...readOnlyToolDefinitions,
47
- ...dataframeToolDefinitions.map((d) => serverConfig.canvasEnabled ? d : disabledTool(d, dataframeDisabled)),
92
+ ...dropToolDefinitions.map((d) => serverConfig.canvasDropEnabled ? d : disabledTool(d, dropDisabled)),
93
+ ...exportToolDefinitions.map((d) => (exportDisabled ? disabledTool(d, exportDisabled) : d)),
48
94
  ...writeToolDefinitions.map((d) => serverConfig.enableWrites ? d : disabledTool(d, writesDisabled)),
49
95
  ];
50
96
  await createApp({
@@ -54,17 +100,18 @@ await createApp({
54
100
  brapiCallsResource,
55
101
  brapiStudyResource,
56
102
  brapiGermplasmResource,
57
- brapiDatasetResource,
58
103
  brapiFiltersResource,
59
104
  ],
60
105
  prompts: [brapiEdaStudy, brapiMetaAnalysis],
61
106
  setup(core) {
62
- const canvasBridge = initCanvasBridge(core.canvas, serverConfig);
107
+ if (!core.canvas) {
108
+ throw configurationError('brapi-mcp-server requires the framework canvas service (DuckDB) for dataframe spillover. Set CANVAS_PROVIDER_TYPE=duckdb (the default) and ensure @duckdb/node-api is installed.', { canvasProviderType: process.env.CANVAS_PROVIDER_TYPE ?? 'duckdb' });
109
+ }
110
+ initCanvasBridge(core.canvas, serverConfig);
63
111
  initBrapiClient(serverConfig);
64
112
  initCapabilityRegistry(serverConfig);
65
113
  initBrapiDialectRegistry();
66
114
  initReferenceDataCache(serverConfig);
67
- initDatasetStore(serverConfig, canvasBridge);
68
115
  initServerRegistry(serverConfig);
69
116
  initOntologyResolver();
70
117
  },
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;GAMG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Y,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3F,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAChC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,cAAc,CAAC,CAChE;CACF,CAAC;AAEF,MAAM,SAAS,CAAC;IACd,KAAK;IACL,SAAS,EAAE;QACT,uBAAuB;QACvB,kBAAkB;QAClB,kBAAkB;QAClB,sBAAsB;QACtB,oBAAoB;KACrB;IACD,OAAO,EAAE,CAAC,aAAa,EAAE,iBAAiB,CAAC;IAC3C,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,kBAAkB,CACtB,kLAAkL,EAClL,EAAE,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,QAAQ,EAAE,CACrE,CAAC;QACJ,CAAC;QACD,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC5C,eAAe,CAAC,YAAY,CAAC,CAAC;QAC9B,sBAAsB,CAAC,YAAY,CAAC,CAAC;QACrC,wBAAwB,EAAE,CAAC;QAC3B,sBAAsB,CAAC,YAAY,CAAC,CAAC;QACrC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QACjC,oBAAoB,EAAE,CAAC;IACzB,CAAC;CACF,CAAC,CAAC"}
@@ -35,7 +35,7 @@ export const brapiEdaStudy = prompt('brapi_eda_study', {
35
35
  '3. Group variables by trait class and by scale data type — the breakdown drives which downstream checks make sense (numerical → outlier checks; categorical → distribution checks).',
36
36
  '',
37
37
  '## Step 3 — Observation coverage',
38
- `1. Call \`brapi_find_observations\` with \`studies: ["${args.studyDbId}"]${aliasArg}\` and a \`loadLimit\` large enough to materialize the full study in one shot if \`observationCount\` from Step 1 fits, otherwise spill to a dataset and read it back via \`brapi_manage_dataset\` (mode: \`load\`).`,
38
+ `1. Call \`brapi_find_observations\` with \`studies: ["${args.studyDbId}"]${aliasArg}\` and a \`loadLimit\` large enough to materialize the full study in one shot if \`observationCount\` from Step 1 fits. Otherwise, the call spills to a dataframe note the \`dataframe.tableName\` from the response, then describe + query it via \`brapi_dataframe_describe\` and \`brapi_dataframe_query\` (use SQL \`LIMIT/OFFSET\` to walk pages, projection to trim columns, aggregation for summaries).`,
39
39
  '2. From the response `distributions`, capture: observations per variable, observations per germplasm, observations per observation level (plot / plant / field), and observations per season.',
40
40
  '3. Compute coverage = `observationCount` ÷ (`observationUnitCount` × `variableCount`). Anything materially below 1.0 implies missing measurements.',
41
41
  '',
@@ -1 +1 @@
1
- {"version":3,"file":"brapi-eda-study.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/brapi-eda-study.prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,iBAAiB,EAAE;IACrD,WAAW,EACT,6JAA6J;IAC/J,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,6DAA6D,CAAC;QAC1E,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,KAAK,CAAC,kBAAkB,CAAC;aACzB,QAAQ,EAAE;aACV,QAAQ,CACP,oFAAoF,CACrF;KACJ,CAAC;IACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,GAAG;YACX,uEAAuE,IAAI,CAAC,SAAS,gOAAgO;YACrT,EAAE;YACF,oBAAoB;YACpB,kDAAkD,IAAI,CAAC,SAAS,IAAI,QAAQ,yJAAyJ;YACrO,yHAAyH;YACzH,EAAE;YACF,uBAAuB;YACvB,sDAAsD,IAAI,CAAC,SAAS,KAAK,QAAQ,mEAAmE;YACpJ,wIAAwI;YACxI,qLAAqL;YACrL,EAAE;YACF,kCAAkC;YAClC,yDAAyD,IAAI,CAAC,SAAS,KAAK,QAAQ,sNAAsN;YAC1S,+LAA+L;YAC/L,oJAAoJ;YACpJ,EAAE;YACF,0BAA0B;YAC1B,wLAAwL;YACxL,yGAAyG;YACzG,EAAE;YACF,iDAAiD;YACjD,+EAA+E;YAC/E,8EAA8E;YAC9E,6MAA6M;YAC7M,EAAE;YACF,yCAAyC;YACzC,uKAAuK,QAAQ,oCAAoC;YACnN,mEAAmE;YACnE,EAAE;YACF,WAAW;YACX,wDAAwD;YACxD,kGAAkG;YAClG,2EAA2E;YAC3E,iGAAiG;YACjG,4EAA4E;YAC5E,yFAAyF;YACzF,wEAAwE;YACxE,sJAAsJ;YACtJ,EAAE;YACF,6MAA6M;SAC9M,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;aAChC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"brapi-eda-study.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/brapi-eda-study.prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,iBAAiB,EAAE;IACrD,WAAW,EACT,6JAA6J;IAC/J,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,SAAS,EAAE,CAAC;aACT,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I,EAAE,MAAM,EAAE,IAAI,EAAE;aAChC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -41,9 +41,9 @@ export const brapiMetaAnalysis = prompt('brapi_meta_analysis', {
41
41
  '3. Record the resulting `observationVariableDbId[]` and the scale `dataType` and `scaleName` for each. Numeric scales can be averaged across studies; categorical scales need a mapping table before pooling.',
42
42
  '',
43
43
  '## Step 2 — Discover studies that measured the trait on the target germplasm',
44
- `1. Call \`brapi_find_observations\` with \`germplasm: ${idsLiteral}\` and \`variables: [<resolved variable DbIds from Step 1>]\`${aliasArg}, \`loadLimit: 200\`.`,
44
+ `1. Call \`brapi_find_observations\` with \`germplasm: ${idsLiteral}\` and \`variables: [<resolved variable DbIds from Step 1>]\`${aliasArg}.`,
45
45
  '2. If the response warns that an unanchored observation query stalled, do not retry the same germplasm-only shape. Use study anchors when available: re-call `brapi_find_observations` with both `studies: ["<studyDbId>"]` and the target `germplasm` / `variables` filters, one candidate study at a time.',
46
- '3. From `distributions.studyName`, capture the distinct studies returning observations. If `hasMore` is true and a `dataset` handle is returned, page through with `brapi_manage_dataset` (mode: `load`) to materialize the full set.',
46
+ '3. From `distributions.studyName`, capture the distinct studies returning observations. If `hasMore` is true and a `dataframe` handle is returned, work with the full set via `brapi_dataframe_query` — SQL `LIMIT/OFFSET` is the paging idiom; projection (`SELECT col1, col2`) and aggregation (`COUNT`, `GROUP BY`) summarize without materializing every row.',
47
47
  '4. For each study, call `brapi_get_study` to capture program, location, season, and trial context — these are the moderators in the meta-analysis.',
48
48
  '',
49
49
  '## Step 3 — Build the per-observation table',
@@ -97,7 +97,7 @@ export const brapiMetaAnalysis = prompt('brapi_meta_analysis', {
97
97
  '7. **Pedigree notes** — Step 7 if you ran it.',
98
98
  '8. **Caveats** — missing data rates, dropped observations, sample-size warnings, capability gaps from the server (e.g. ontology endpoint missing).',
99
99
  '',
100
- 'Reproducibility is non-negotiable: cite the dataset handle returned by every `find_*` call so a future run can reproduce the same upstream snapshot.',
100
+ 'Reproducibility is non-negotiable: cite the dataframe handle (or the full filter map) returned by every `find_*` call so a future run can reproduce the same upstream snapshot.',
101
101
  ].join('\n');
102
102
  return [
103
103
  {
@@ -1 +1 @@
1
- {"version":3,"file":"brapi-meta-analysis.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/brapi-meta-analysis.prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,qBAAqB,EAAE;IAC7D,WAAW,EACT,kKAAkK;IACpK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,cAAc,EAAE,CAAC;aACd,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,wLAAwL,CACzL;QACH,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,2JAA2J,CAC5J;QACH,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,KAAK,CAAC,kBAAkB,CAAC;aACzB,QAAQ,EAAE;aACV,QAAQ,CACP,yKAAyK,CAC1K;KACJ,CAAC;IACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc;aAC5B,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;aACtB,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjC,MAAM,UAAU,GAAG,IAA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F,sJAAsJ;SACvJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;aAChC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"brapi-meta-analysis.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/brapi-meta-analysis.prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,qBAAqB,EAAE;IAC7D,WAAW,EACT,kKAAkK;IACpK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,cAAc,EAAE,CAAC;aACd,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,wLAAwL,CACzL;QACH,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,2JAA2J,CAC5J;QACH,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,KAAK,CAAC,kBAAkB,CAAC;aACzB,QAAQ,EAAE;aACV,QAAQ,CACP,yKAAyK,CAC1K;KACJ,CAAC;IACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc;aAC5B,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;aACtB,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CA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,yDAAyD;YACzD,2FAA2F;YAC3F,+CAA+C;YAC/C,oJAAoJ;YACpJ,EAAE;YACF,iLAAiL;SAClL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;aAChC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1,14 +1,17 @@
1
1
  /**
2
2
  * @fileoverview `brapi_dataframe_describe` — list dataframes (or describe one)
3
- * with column schema, row count, and originating-dataset provenance.
4
- * Auto-registered dataset dataframes (`ds_<datasetId>`) carry full source
5
- * metadata (originating tool, baseUrl, query, expiry); user-derived dataframes
3
+ * with column schema, row count, and originating-source provenance.
4
+ * Auto-registered spillover dataframes (`df_<uuid>`) carry full provenance
5
+ * (originating tool, baseUrl, query, expiry); user-derived dataframes
6
6
  * created via `brapi_dataframe_query({ registerAs })` only show structural info.
7
7
  *
8
+ * Start here after a find_* tool spillover — the dataframe handle on the
9
+ * find result and `brapi_dataframe_describe` together orient you to schema +
10
+ * provenance before you write the first SQL query.
11
+ *
8
12
  * @module mcp-server/tools/definitions/brapi-dataframe-describe.tool
9
13
  */
10
14
  import { z } from '@cyanheads/mcp-ts-core';
11
- import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
12
15
  export declare const brapiDataframeDescribe: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
13
16
  dataframe: z.ZodOptional<z.ZodString>;
14
17
  }, z.core.$strip>, z.ZodObject<{
@@ -22,7 +25,6 @@ export declare const brapiDataframeDescribe: import("@cyanheads/mcp-ts-core").To
22
25
  }, z.core.$strip>>;
23
26
  approxSizeBytes: z.ZodOptional<z.ZodNumber>;
24
27
  provenance: z.ZodOptional<z.ZodObject<{
25
- datasetId: z.ZodString;
26
28
  source: z.ZodString;
27
29
  baseUrl: z.ZodString;
28
30
  query: z.ZodUnknown;
@@ -30,10 +32,5 @@ export declare const brapiDataframeDescribe: import("@cyanheads/mcp-ts-core").To
30
32
  expiresAt: z.ZodString;
31
33
  }, z.core.$strip>>;
32
34
  }, z.core.$strip>>;
33
- }, z.core.$strip>, readonly [{
34
- readonly reason: "dataframe_disabled";
35
- readonly code: JsonRpcErrorCode.ServiceUnavailable;
36
- readonly when: "Dataframe surface is not enabled on this deployment";
37
- readonly recovery: "Use brapi_manage_dataset (mode=list) to enumerate datasets directly — the dataframe surface is gated off here.";
38
- }]>;
35
+ }, z.core.$strip>, undefined>;
39
36
  //# sourceMappingURL=brapi-dataframe-describe.tool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"brapi-dataframe-describe.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-describe.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAgDjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCjC,CAAC"}
1
+ {"version":3,"file":"brapi-dataframe-describe.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-describe.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AA6CjD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;6BAgBjC,CAAC"}
@@ -1,14 +1,17 @@
1
1
  /**
2
2
  * @fileoverview `brapi_dataframe_describe` — list dataframes (or describe one)
3
- * with column schema, row count, and originating-dataset provenance.
4
- * Auto-registered dataset dataframes (`ds_<datasetId>`) carry full source
5
- * metadata (originating tool, baseUrl, query, expiry); user-derived dataframes
3
+ * with column schema, row count, and originating-source provenance.
4
+ * Auto-registered spillover dataframes (`df_<uuid>`) carry full provenance
5
+ * (originating tool, baseUrl, query, expiry); user-derived dataframes
6
6
  * created via `brapi_dataframe_query({ registerAs })` only show structural info.
7
7
  *
8
+ * Start here after a find_* tool spillover — the dataframe handle on the
9
+ * find result and `brapi_dataframe_describe` together orient you to schema +
10
+ * provenance before you write the first SQL query.
11
+ *
8
12
  * @module mcp-server/tools/definitions/brapi-dataframe-describe.tool
9
13
  */
10
14
  import { tool, z } from '@cyanheads/mcp-ts-core';
11
- import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
12
15
  import { getCanvasBridge } from '../../../services/canvas-bridge/index.js';
13
16
  const ColumnSchema = z.object({
14
17
  name: z.string().describe('Column name.'),
@@ -16,14 +19,13 @@ const ColumnSchema = z.object({
16
19
  nullable: z.boolean().optional().describe('True when NULL values are allowed.'),
17
20
  });
18
21
  const ProvenanceSchema = z.object({
19
- datasetId: z
22
+ source: z
20
23
  .string()
21
- .describe('Originating dataset ID — pass to brapi_manage_dataset to operate on the underlying rows.'),
22
- source: z.string().describe('Tool/operation that produced the dataset (e.g. find_observations).'),
23
- baseUrl: z.string().describe('BrAPI base URL the dataset was pulled from.'),
24
+ .describe('Tool/operation that produced the dataframe (e.g. find_observations).'),
25
+ baseUrl: z.string().describe('BrAPI base URL the rows were pulled from.'),
24
26
  query: z.unknown().describe('Original filter map / search body.'),
25
- createdAt: z.string().describe('ISO 8601 dataset creation time.'),
26
- expiresAt: z.string().describe('ISO 8601 expiry — when the dataframe will be evicted.'),
27
+ createdAt: z.string().describe('ISO 8601 dataframe creation time.'),
28
+ expiresAt: z.string().describe('ISO 8601 expiry — when the dataframe metadata will be evicted.'),
27
29
  });
28
30
  const DescribedTableSchema = z.object({
29
31
  name: z.string().describe('Dataframe name. Use this in SQL queries.'),
@@ -32,7 +34,7 @@ const DescribedTableSchema = z.object({
32
34
  .array(ColumnSchema.describe('Column declaration.'))
33
35
  .describe('Schema in declaration order.'),
34
36
  approxSizeBytes: z.number().int().nonnegative().optional().describe('Approximate size in bytes.'),
35
- provenance: ProvenanceSchema.optional().describe('Originating dataset provenance — present only for auto-registered dataframes (`ds_*`).'),
37
+ provenance: ProvenanceSchema.optional().describe('Originating-source provenance — present only for auto-registered dataframes (`df_*`).'),
36
38
  });
37
39
  const OutputSchema = z.object({
38
40
  tables: z
@@ -47,23 +49,12 @@ const InputSchema = z.object({
47
49
  .describe('When set, return only the named dataframe. Omit to list all dataframes.'),
48
50
  });
49
51
  export const brapiDataframeDescribe = tool('brapi_dataframe_describe', {
50
- description: 'List dataframes (or describe one) with columns, row counts, and originating-dataset provenance. Use this to discover what dataframes are available before writing a brapi_dataframe_query.',
52
+ description: 'Start here after a spillover. Lists dataframes (or describes one) with columns, row counts, and originating-source provenance. The schema and provenance answer "what tool produced this and what filters were used" before you write the first brapi_dataframe_query.',
51
53
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
52
- errors: [
53
- {
54
- reason: 'dataframe_disabled',
55
- code: JsonRpcErrorCode.ServiceUnavailable,
56
- when: 'Dataframe surface is not enabled on this deployment',
57
- recovery: 'Use brapi_manage_dataset (mode=list) to enumerate datasets directly — the dataframe surface is gated off here.',
58
- },
59
- ],
60
54
  input: InputSchema,
61
55
  output: OutputSchema,
62
56
  async handler(input, ctx) {
63
57
  const bridge = getCanvasBridge();
64
- if (!bridge.isEnabled()) {
65
- throw ctx.fail('dataframe_disabled', 'brapi_dataframe_describe is unavailable — dataframes are not enabled on this deployment.', { ...ctx.recoveryFor('dataframe_disabled') });
66
- }
67
58
  const describeOpts = {};
68
59
  if (input.dataframe !== undefined)
69
60
  describeOpts.tableName = input.dataframe;
@@ -77,7 +68,7 @@ function renderDescribe(tables) {
77
68
  lines.push(`# ${tables.length} dataframe(s)`);
78
69
  if (tables.length === 0) {
79
70
  lines.push('');
80
- lines.push('_No dataframes. Run a find_* tool that spills to a dataset, or use brapi_dataframe_query with `registerAs` to materialize one._');
71
+ lines.push('_No dataframes. Run a find_* tool whose result exceeds loadLimit, or use brapi_dataframe_query with `registerAs` to materialize one._');
81
72
  return lines.join('\n');
82
73
  }
83
74
  for (const table of tables) {
@@ -94,7 +85,6 @@ function renderDescribe(tables) {
94
85
  }
95
86
  if (table.provenance) {
96
87
  lines.push('- provenance:');
97
- lines.push(` - datasetId: \`${table.provenance.datasetId}\``);
98
88
  lines.push(` - source: ${table.provenance.source}`);
99
89
  lines.push(` - baseUrl: ${table.provenance.baseUrl}`);
100
90
  lines.push(` - createdAt: ${table.provenance.createdAt}`);
@@ -1 +1 @@
1
- {"version":3,"file":"brapi-dataframe-describe.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-describe.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IACvF,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;CAChF,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAAQ,CACP,0FAA0F,CAC3F;IACH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oEAAoE,CAAC;IACjG,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;IAC3E,KAAK,EAAE,CAAC,CAA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CAAC,CAAC;YACrD,KAAK,CAAC,IAAI,CAAC,gBAAgB,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;YACvD,KAAK,CAAC,IAAI,CAAC,kBAAkB,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;YAC3D,KAAK,CAAC,IAAI,CAAC,kBAAkB,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;YAC3D,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
1
+ {"version":3,"file":"brapi-dataframe-describe.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-describe.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IACvF,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;CAChF,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,CAAC,sEAAsE,CAAC;IACnF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,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AAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,23 +1,19 @@
1
1
  /**
2
2
  * @fileoverview `brapi_dataframe_drop` — release a single dataframe by name.
3
3
  * Idempotent (returns `dropped: false` for unknown names rather than failing).
4
- * Drops the dataframe and any provenance metadata stored alongside it. The
5
- * originating dataset is unaffected — use `brapi_manage_dataset mode=delete`
6
- * to drop both.
4
+ * Drops the dataframe and its provenance metadata.
5
+ *
6
+ * Gated opt-in via `BRAPI_CANVAS_DROP_ENABLED` — when the operator hasn't
7
+ * opted in, the tool is omitted from `tools/list` entirely and dataframes
8
+ * expire via TTL when left unmanaged.
7
9
  *
8
10
  * @module mcp-server/tools/definitions/brapi-dataframe-drop.tool
9
11
  */
10
12
  import { z } from '@cyanheads/mcp-ts-core';
11
- import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
12
13
  export declare const brapiDataframeDrop: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
13
14
  dataframe: z.ZodString;
14
15
  }, z.core.$strip>, z.ZodObject<{
15
16
  dataframe: z.ZodString;
16
17
  dropped: z.ZodBoolean;
17
- }, z.core.$strip>, readonly [{
18
- readonly reason: "dataframe_disabled";
19
- readonly code: JsonRpcErrorCode.ServiceUnavailable;
20
- readonly when: "Dataframe surface is not enabled on this deployment";
21
- readonly recovery: "Use brapi_manage_dataset (mode=delete) to drop the underlying dataset — the dataframe surface is gated off here.";
22
- }]>;
18
+ }, z.core.$strip>, undefined>;
23
19
  //# sourceMappingURL=brapi-dataframe-drop.tool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"brapi-dataframe-drop.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-drop.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAmBjE,eAAO,MAAM,kBAAkB;;;;;;;;;;GAqC7B,CAAC"}
1
+ {"version":3,"file":"brapi-dataframe-drop.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-drop.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAmBjD,eAAO,MAAM,kBAAkB;;;;;6BAqB7B,CAAC"}
@@ -1,14 +1,15 @@
1
1
  /**
2
2
  * @fileoverview `brapi_dataframe_drop` — release a single dataframe by name.
3
3
  * Idempotent (returns `dropped: false` for unknown names rather than failing).
4
- * Drops the dataframe and any provenance metadata stored alongside it. The
5
- * originating dataset is unaffected — use `brapi_manage_dataset mode=delete`
6
- * to drop both.
4
+ * Drops the dataframe and its provenance metadata.
5
+ *
6
+ * Gated opt-in via `BRAPI_CANVAS_DROP_ENABLED` — when the operator hasn't
7
+ * opted in, the tool is omitted from `tools/list` entirely and dataframes
8
+ * expire via TTL when left unmanaged.
7
9
  *
8
10
  * @module mcp-server/tools/definitions/brapi-dataframe-drop.tool
9
11
  */
10
12
  import { tool, z } from '@cyanheads/mcp-ts-core';
11
- import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
12
13
  import { getCanvasBridge } from '../../../services/canvas-bridge/index.js';
13
14
  const InputSchema = z.object({
14
15
  dataframe: z
@@ -23,23 +24,12 @@ const OutputSchema = z.object({
23
24
  .describe('True when the dataframe existed and was removed; false when it did not exist.'),
24
25
  });
25
26
  export const brapiDataframeDrop = tool('brapi_dataframe_drop', {
26
- description: 'Drop a dataframe by name. Idempotent — returns dropped:false rather than failing when the name is unknown. The underlying dataset is untouched (use brapi_manage_dataset mode=delete to drop both).',
27
+ description: 'Drop a dataframe by name. Idempotent — returns dropped:false rather than failing when the name is unknown. Dataframes also expire via TTL automatically; explicit drop is only needed when the operator wants to free workspace memory immediately.',
27
28
  annotations: { readOnlyHint: false, idempotentHint: true, openWorldHint: false },
28
- errors: [
29
- {
30
- reason: 'dataframe_disabled',
31
- code: JsonRpcErrorCode.ServiceUnavailable,
32
- when: 'Dataframe surface is not enabled on this deployment',
33
- recovery: 'Use brapi_manage_dataset (mode=delete) to drop the underlying dataset — the dataframe surface is gated off here.',
34
- },
35
- ],
36
29
  input: InputSchema,
37
30
  output: OutputSchema,
38
31
  async handler(input, ctx) {
39
32
  const bridge = getCanvasBridge();
40
- if (!bridge.isEnabled()) {
41
- throw ctx.fail('dataframe_disabled', 'brapi_dataframe_drop is unavailable — dataframes are not enabled on this deployment.', { ...ctx.recoveryFor('dataframe_disabled') });
42
- }
43
33
  const dropped = await bridge.drop(ctx, input.dataframe);
44
34
  return { dataframe: input.dataframe, dropped };
45
35
  },
@@ -1 +1 @@
1
- {"version":3,"file":"brapi-dataframe-drop.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-drop.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,+HAA+H,CAChI;CACJ,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iDAAiD,CAAC;IACjF,OAAO,EAAE,CAAC;SACP,OAAO,EAAE;SACT,QAAQ,CAAC,+EAA+E,CAAC;CAC7F,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,sBAAsB,EAAE;IAC7D,WAAW,EACT,qMAAqM;IACvM,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE;IAChF,MAAM,EAAE;QACN;YACE,MAAM,EAAE,oBAAoB;YAC5B,IAAI,EAAE,gBAAgB,CAAC,kBAAkB;YACzC,IAAI,EAAE,qDAAqD;YAC3D,QAAQ,EACN,kHAAkH;SACrH;KACO;IACV,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IAEpB,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG;QACtB,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;YACxB,MAAM,GAAG,CAAC,IAAI,CACZ,oBAAoB,EACpB,sFAAsF,EACtF,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,oBAAoB,CAAC,EAAE,CAC7C,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QACxD,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;IACjD,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;QAClB;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,MAAM,CAAC,OAAO;gBAClB,CAAC,CAAC,eAAe,MAAM,CAAC,SAAS,qBAAqB;gBACtD,CAAC,CAAC,eAAe,MAAM,CAAC,SAAS,gCAAgC;SACpE;KACF;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"brapi-dataframe-drop.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-drop.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,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,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @fileoverview `brapi_dataframe_export` — write a dataframe to disk in a
3
+ * researcher-friendly format (CSV, Parquet, JSON) and return the absolute
4
+ * path. Hands off the file to the human; the agent doesn't read it back.
5
+ *
6
+ * Stdio-only and gated behind `BRAPI_EXPORT_DIR` — the entry point bridges
7
+ * `BRAPI_EXPORT_DIR` → the framework's `CANVAS_EXPORT_PATH` so the canvas
8
+ * provider's path-traversal sandbox stays in charge of resolution. Under
9
+ * `MCP_TRANSPORT_TYPE=http` or with `BRAPI_EXPORT_DIR` unset, the tool is
10
+ * omitted from `tools/list` entirely (operators see the gate reason on
11
+ * `/.well-known/mcp.json`).
12
+ *
13
+ * Optional `columns` (thin projection) or `sql` (full SELECT) materialize a
14
+ * temporary canvas table first, export it, then drop it. The dataframe input
15
+ * always identifies the *source* dataframe — that's the name the paired-drop
16
+ * cleanup keys off of when `brapi_dataframe_drop` later removes it.
17
+ *
18
+ * @module mcp-server/tools/definitions/brapi-dataframe-export.tool
19
+ */
20
+ import { z } from '@cyanheads/mcp-ts-core';
21
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
22
+ export declare const brapiDataframeExport: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
23
+ dataframe: z.ZodString;
24
+ format: z.ZodEnum<{
25
+ csv: "csv";
26
+ parquet: "parquet";
27
+ json: "json";
28
+ }>;
29
+ filename: z.ZodOptional<z.ZodString>;
30
+ columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
31
+ sql: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strip>, z.ZodObject<{
33
+ dataframe: z.ZodString;
34
+ format: z.ZodEnum<{
35
+ csv: "csv";
36
+ parquet: "parquet";
37
+ json: "json";
38
+ }>;
39
+ path: z.ZodString;
40
+ filename: z.ZodString;
41
+ sizeBytes: z.ZodNumber;
42
+ rowCount: z.ZodNumber;
43
+ columns: z.ZodArray<z.ZodObject<{
44
+ name: z.ZodString;
45
+ type: z.ZodString;
46
+ }, z.core.$strip>>;
47
+ expiresAt: z.ZodString;
48
+ }, z.core.$strip>, readonly [{
49
+ readonly reason: "export_dir_unset";
50
+ readonly code: JsonRpcErrorCode.ConfigurationError;
51
+ readonly when: "BRAPI_EXPORT_DIR is not configured (defensive — the registration gate normally hides the tool when this happens)";
52
+ readonly recovery: "Set BRAPI_EXPORT_DIR on the server before retrying.";
53
+ }, {
54
+ readonly reason: "dataframe_not_found";
55
+ readonly code: JsonRpcErrorCode.NotFound;
56
+ readonly when: "No dataframe with this name exists on the canvas (expired, dropped, or typo)";
57
+ readonly recovery: "Call brapi_dataframe_describe to list available dataframes.";
58
+ }, {
59
+ readonly reason: "invalid_filename";
60
+ readonly code: JsonRpcErrorCode.ValidationError;
61
+ readonly when: "filename contains path separators or traversal segments";
62
+ readonly recovery: "Provide a filename without \"/\", \"\\\", or \"..\" — leave it unset to use the default.";
63
+ }, {
64
+ readonly reason: "mutually_exclusive_projection";
65
+ readonly code: JsonRpcErrorCode.ValidationError;
66
+ readonly when: "Both `columns` and `sql` were supplied";
67
+ readonly recovery: "Pass either `columns` for a thin projection or `sql` for filtering/aggregation, not both.";
68
+ }]>;
69
+ //# sourceMappingURL=brapi-dataframe-export.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brapi-dataframe-export.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-export.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAsB,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAoEjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkH/B,CAAC"}