@zltquant/zlt-mcp 0.7.2 → 0.7.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zltquant/zlt-mcp",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "智量通 ZLT Quant MCP server(Windows x64;量化策略创建与本地回测)",
5
5
  "bin": {
6
6
  "zlt-mcp": "./zlt-mcp-proxy.bundle.cjs"
@@ -10824,9 +10824,12 @@ same MCP connection through mcp-wait. Progress can remain unchanged while data i
10824
10824
  prepared; read stderr and do not restart from a progress warning. If isTerminal=true,
10825
10825
  finalize that run without waiting again. Interrupted waits identify the runId,
10826
10826
  codePath, and attemptFence for inspection; never restart automatically.`;
10827
- var REFERENCING_TOOLS = /* @__PURE__ */ new Set(["mcp-get-cache-diff", "mcp-get-cloud-data-list"]);
10828
10827
  var REFERENCE_SOURCE_TOOL = "mcp-download-data";
10829
- var REFERENCE_PROPERTY = "exchange_id";
10828
+ var REFERENCED_PROPERTIES_BY_TOOL = /* @__PURE__ */ new Map([
10829
+ ["mcp-get-cache-diff", ["exchange_id"]],
10830
+ ["mcp-get-cloud-data-list", ["exchange_id"]],
10831
+ ["mcp-get-data-range", ["exchange_id", "data_type"]]
10832
+ ]);
10830
10833
  function record(value) {
10831
10834
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
10832
10835
  }
@@ -10942,17 +10945,22 @@ function buildArgumentExample(tool) {
10942
10945
  }
10943
10946
  function relatedParameterHelp(tool, tools) {
10944
10947
  const name = typeof tool.name === "string" ? tool.name : "";
10945
- if (!REFERENCING_TOOLS.has(name)) return void 0;
10946
- const referenced = schemaProperty(tool, REFERENCE_PROPERTY);
10947
- if (typeof referenced?.description !== "string" || !referenced.description.includes(REFERENCE_SOURCE_TOOL)) return void 0;
10948
+ const properties = REFERENCED_PROPERTIES_BY_TOOL.get(name);
10949
+ if (!properties) return void 0;
10948
10950
  const source = tools.find((candidate) => candidate.name === REFERENCE_SOURCE_TOOL);
10949
- const sourceProperty = source && schemaProperty(source, REFERENCE_PROPERTY);
10950
- if (typeof sourceProperty?.description !== "string" || sourceProperty.description.length === 0) return void 0;
10951
- return [{
10952
- sourceTool: REFERENCE_SOURCE_TOOL,
10953
- property: REFERENCE_PROPERTY,
10954
- description: sourceProperty.description
10955
- }];
10951
+ if (!source) return void 0;
10952
+ const related = [];
10953
+ for (const property of properties) {
10954
+ const referenced = schemaProperty(tool, property);
10955
+ const sourceProperty = schemaProperty(source, property);
10956
+ if (typeof referenced?.description !== "string" || !referenced.description.includes(REFERENCE_SOURCE_TOOL) || typeof sourceProperty?.description !== "string" || sourceProperty.description.length === 0) return void 0;
10957
+ related.push({
10958
+ sourceTool: REFERENCE_SOURCE_TOOL,
10959
+ property,
10960
+ description: sourceProperty.description
10961
+ });
10962
+ }
10963
+ return related;
10956
10964
  }
10957
10965
  function buildCliUsage(tool, tools) {
10958
10966
  const name = typeof tool.name === "string" ? tool.name : "";
@@ -24952,6 +24960,17 @@ var MARKET_CODE_TO_NAME = {
24952
24960
  sj: "\u4E0A\u91D1\u6240(sj)",
24953
24961
  bs: "\u6E24\u5546(bs)"
24954
24962
  };
24963
+ var LEGACY_MARKET_ID_TO_CODE = {
24964
+ 29544: "sh",
24965
+ 29562: "sz",
24966
+ 31338: "zj",
24967
+ 31347: "zs",
24968
+ 25715: "ds",
24969
+ 29553: "sq",
24970
+ 26481: "gq",
24971
+ 29546: "sj",
24972
+ 25203: "bs"
24973
+ };
24955
24974
  var DC_SDK_CONFIG_SEGMENTS = ["python", "Lib", "site-packages", "zltsdk", "moudles", "dc_sdk.json"];
24956
24975
  var DCM_CONFIG_SEGMENTS = ["zltHost", "moudles", "dcm.json"];
24957
24976
  var dataRootsCache = /* @__PURE__ */ new Map();
@@ -24992,6 +25011,36 @@ function resolveDataRoots(clientRootDir) {
24992
25011
  return status;
24993
25012
  }
24994
25013
  var HQ_DATA_FAMILIES = /* @__PURE__ */ new Set(["dk", "mk", "tk"]);
25014
+ function requestedSeriesKey(series) {
25015
+ return JSON.stringify([series.exchangeId, series.dataType]);
25016
+ }
25017
+ function seriesIdentity(value) {
25018
+ if (!isRecord4(value)) return void 0;
25019
+ const exchangeRaw = value.exchange_id ?? value.exchangeid ?? value.exchange;
25020
+ const legacyExchange = finiteDataRangeNumber(exchangeRaw);
25021
+ const exchangeId = LEGACY_MARKET_ID_TO_CODE[legacyExchange] ?? String(exchangeRaw ?? "").trim().toLowerCase();
25022
+ let dataType = String(value.data_type ?? value.datatype ?? "").trim().toLowerCase();
25023
+ if (/^(dk|mk|tk)$/.test(dataType)) {
25024
+ const securityType = finiteDataRangeNumber(value.securitytype ?? value.sectype);
25025
+ if (securityType > 0 && securityType % 16 === 0) dataType += (securityType / 16).toString(16);
25026
+ }
25027
+ if (!dataType) return void 0;
25028
+ return { exchangeId, dataType };
25029
+ }
25030
+ function requestedSeriesFromParams(value) {
25031
+ if (!Array.isArray(value)) return [];
25032
+ const seen = /* @__PURE__ */ new Set();
25033
+ const series = [];
25034
+ for (const item of value) {
25035
+ const identity = seriesIdentity(item);
25036
+ if (!identity) continue;
25037
+ const key = requestedSeriesKey(identity);
25038
+ if (seen.has(key)) continue;
25039
+ seen.add(key);
25040
+ series.push(identity);
25041
+ }
25042
+ return series;
25043
+ }
24995
25044
  function hqSeriesFromResults(resultItems) {
24996
25045
  const series = [];
24997
25046
  for (const item of resultItems) {
@@ -25006,17 +25055,25 @@ function hqSeriesFromResults(resultItems) {
25006
25055
  }
25007
25056
  function engineHasAnyHqSeries(engineRoot, series) {
25008
25057
  if (!engineRoot || series.length === 0) return void 0;
25009
- for (const { exchangeId, dataType } of series) {
25010
- const dir = path19.join(engineRoot, "hqdata", "his", exchangeId, dataType);
25011
- try {
25012
- if (fs20.existsSync(dir) && fs20.readdirSync(dir).length > 0) return true;
25013
- } catch {
25014
- return void 0;
25015
- }
25058
+ for (const requested of series) {
25059
+ const present = engineHasHqSeries(engineRoot, requested);
25060
+ if (present === true) return true;
25061
+ if (present === void 0) return void 0;
25016
25062
  }
25017
25063
  return false;
25018
25064
  }
25019
- function formatDataRangeResult(rawResult, dataRoots) {
25065
+ function engineHasHqSeries(engineRoot, series) {
25066
+ if (!engineRoot || !series.exchangeId || !HQ_DATA_FAMILIES.has(splitDataTypeToken(series.dataType).family)) {
25067
+ return void 0;
25068
+ }
25069
+ const dir = path19.join(engineRoot, "hqdata", "his", series.exchangeId, series.dataType);
25070
+ try {
25071
+ return fs20.readdirSync(dir).length > 0;
25072
+ } catch (error2) {
25073
+ return isRecord4(error2) && error2.code === "ENOENT" ? false : void 0;
25074
+ }
25075
+ }
25076
+ function formatDataRangeResult(rawResult, dataRoots, requestedParams) {
25020
25077
  if (!isRecord4(rawResult)) return rawResult;
25021
25078
  const nestedStatus = isRecord4(rawResult.Data) ? rawResult.Data.coverageStatus : void 0;
25022
25079
  if (isDataRangeCoverageStatus(nestedStatus) || isDataRangeCoverageStatus(rawResult.coverageStatus)) {
@@ -25027,8 +25084,27 @@ function formatDataRangeResult(rawResult, dataRoots) {
25027
25084
  const resultItems = Array.isArray(data) ? data : isRecord4(data) && Array.isArray(data.results) ? data.results : [];
25028
25085
  const seriesOrder = [];
25029
25086
  const seriesByKey = /* @__PURE__ */ new Map();
25087
+ const returnedSeriesOrder = [];
25088
+ const returnedSeriesByKey = /* @__PURE__ */ new Map();
25030
25089
  for (const item of resultItems) {
25031
25090
  if (!isRecord4(item)) continue;
25091
+ const identity = seriesIdentity(item);
25092
+ let returnedEvidence;
25093
+ if (identity) {
25094
+ const identityKey = requestedSeriesKey(identity);
25095
+ returnedEvidence = returnedSeriesByKey.get(identityKey);
25096
+ if (!returnedEvidence) {
25097
+ returnedEvidence = {
25098
+ ...identity,
25099
+ hasIntervals: false,
25100
+ explicitMissing: hasExplicitMissingMarker(item)
25101
+ };
25102
+ returnedSeriesByKey.set(identityKey, returnedEvidence);
25103
+ returnedSeriesOrder.push(identityKey);
25104
+ } else if (hasExplicitMissingMarker(item)) {
25105
+ returnedEvidence.explicitMissing = true;
25106
+ }
25107
+ }
25032
25108
  const exchangeRaw = item.exchange_id ?? item.exchangeid ?? item.exchange;
25033
25109
  const datatypeRaw = item.data_type ?? item.datatype;
25034
25110
  const sectypeRaw = item.securitytype ?? item.sectype;
@@ -25051,6 +25127,7 @@ function formatDataRangeResult(rawResult, dataRoots) {
25051
25127
  const endDate = compactDataRangeDate(time3.end);
25052
25128
  if (!startDate || !endDate) continue;
25053
25129
  series.intervals.push([startDate, endDate]);
25130
+ if (returnedEvidence) returnedEvidence.hasIntervals = true;
25054
25131
  }
25055
25132
  }
25056
25133
  const ranges = [];
@@ -25062,8 +25139,58 @@ function formatDataRangeResult(rawResult, dataRoots) {
25062
25139
  }
25063
25140
  }
25064
25141
  const errNo = Number(rawResult.ErrNo);
25065
- if (Number.isFinite(errNo) && errNo !== 0) {
25066
- return withDataRangeInterpretation(rawResult, "unknown", true, "upstream-error", [], "report-error");
25142
+ const upstreamFailed = Number.isFinite(errNo) && errNo !== 0;
25143
+ const rootSplit = Boolean(dataRoots?.resolved && !dataRoots.agree);
25144
+ const explicitGlobalMissing = hasExplicitMissingMarker(data);
25145
+ const requestedSeries = requestedSeriesFromParams(requestedParams);
25146
+ const coverageOrder = [...requestedSeries.map(requestedSeriesKey)];
25147
+ const coverageByKey = new Map(requestedSeries.map((series) => [requestedSeriesKey(series), series]));
25148
+ for (const key of returnedSeriesOrder) {
25149
+ if (coverageByKey.has(key)) continue;
25150
+ const returned = returnedSeriesByKey.get(key);
25151
+ if (!returned) continue;
25152
+ coverageByKey.set(key, returned);
25153
+ coverageOrder.push(key);
25154
+ }
25155
+ const seriesCoverage = coverageOrder.map((key) => {
25156
+ const series = coverageByKey.get(key);
25157
+ const returned = returnedSeriesByKey.get(key);
25158
+ const identity = {
25159
+ ...series.exchangeId ? { exchange_id: series.exchangeId } : {},
25160
+ data_type: series.dataType
25161
+ };
25162
+ if (upstreamFailed) {
25163
+ return { ...identity, coverageStatus: "unknown", blocksBacktest: true, reasonCode: "upstream-error", nextAction: "report-error" };
25164
+ }
25165
+ if (rootSplit) {
25166
+ return { ...identity, coverageStatus: "unknown", blocksBacktest: true, reasonCode: "data-root-split", nextAction: "resolve-data-root-split" };
25167
+ }
25168
+ if (!returned) {
25169
+ if (explicitGlobalMissing) {
25170
+ return { ...identity, coverageStatus: "unknown", blocksBacktest: true, reasonCode: "explicit-missing", nextAction: "report-missing-data" };
25171
+ }
25172
+ return { ...identity, coverageStatus: "unknown", blocksBacktest: false, reasonCode: "upstream-omitted", nextAction: "recheck-coverage" };
25173
+ }
25174
+ if (returned.explicitMissing) {
25175
+ return { ...identity, coverageStatus: "missing", blocksBacktest: true, reasonCode: "explicit-missing", nextAction: "report-missing-data" };
25176
+ }
25177
+ if (explicitGlobalMissing) {
25178
+ return { ...identity, coverageStatus: "unknown", blocksBacktest: true, reasonCode: "explicit-missing", nextAction: "report-missing-data" };
25179
+ }
25180
+ if (returned.hasIntervals) {
25181
+ return { ...identity, coverageStatus: "available", blocksBacktest: false, reasonCode: "explicit-ranges", nextAction: "run-backtest" };
25182
+ }
25183
+ const family = splitDataTypeToken(series.dataType).family;
25184
+ if (dataRoots?.resolved && dataRoots.agree && HQ_DATA_FAMILIES.has(family)) {
25185
+ const present = engineHasHqSeries(dataRoots.engineRoot, series);
25186
+ if (present === false) {
25187
+ return { ...identity, coverageStatus: "missing", blocksBacktest: true, reasonCode: "no-local-files", nextAction: "download-and-recheck" };
25188
+ }
25189
+ }
25190
+ return { ...identity, coverageStatus: "unknown", blocksBacktest: false, reasonCode: "no-local-coverage", nextAction: "run-backtest" };
25191
+ });
25192
+ if (upstreamFailed) {
25193
+ return withDataRangeInterpretation(rawResult, "unknown", true, "upstream-error", [], "report-error", seriesCoverage);
25067
25194
  }
25068
25195
  if (dataRoots?.resolved && !dataRoots.agree) {
25069
25196
  return withDataRangeInterpretation(
@@ -25072,15 +25199,44 @@ function formatDataRangeResult(rawResult, dataRoots) {
25072
25199
  true,
25073
25200
  "data-root-split",
25074
25201
  ranges,
25075
- `\u6570\u636E\u6839\u4E0D\u4E00\u81F4\uFF1A\u4E0B\u8F7D\u5668\u5199\u5165 ${dataRoots.downloadRoot}\uFF0C\u800C\u7B56\u7565\u5F15\u64CE\u8BFB\u53D6 ${dataRoots.engineRoot}\u3002\u672C\u5730\u6587\u4EF6\u5373\u4F7F\u5B58\u5728\uFF0C\u56DE\u6D4B\u4E5F\u8BFB\u4E0D\u5230\uFF0C\u4F1A\u62A5\u300C\u672C\u5730\u6570\u636E\u4E0D\u8DB3\u300D\u3002\u4E0D\u8981\u636E\u6B64\u5F00\u59CB\u56DE\u6D4B\uFF1B\u8BF7\u5411\u7528\u6237\u62A5\u544A\u8FD9\u4E24\u4E2A\u8DEF\u5F84\uFF0C\u5E76\u8BF4\u660E\u9700\u8981\u4FEE\u590D\u6295\u7814\u6A21\u5757\u7684\u6570\u636E\u6839\u914D\u7F6E\uFF08dc_sdk.json \u7684 mdf.path \u4E0E dcm.json \u7684 download_home\uFF09\u3002`
25202
+ `\u6570\u636E\u6839\u4E0D\u4E00\u81F4\uFF1A\u4E0B\u8F7D\u5668\u5199\u5165 ${dataRoots.downloadRoot}\uFF0C\u800C\u7B56\u7565\u5F15\u64CE\u8BFB\u53D6 ${dataRoots.engineRoot}\u3002\u672C\u5730\u6587\u4EF6\u5373\u4F7F\u5B58\u5728\uFF0C\u56DE\u6D4B\u4E5F\u8BFB\u4E0D\u5230\uFF0C\u4F1A\u62A5\u300C\u672C\u5730\u6570\u636E\u4E0D\u8DB3\u300D\u3002\u4E0D\u8981\u636E\u6B64\u5F00\u59CB\u56DE\u6D4B\uFF1B\u8BF7\u5411\u7528\u6237\u62A5\u544A\u8FD9\u4E24\u4E2A\u8DEF\u5F84\uFF0C\u5E76\u8BF4\u660E\u9700\u8981\u4FEE\u590D\u6295\u7814\u6A21\u5757\u7684\u6570\u636E\u6839\u914D\u7F6E\uFF08dc_sdk.json \u7684 mdf.path \u4E0E dcm.json \u7684 download_home\uFF09\u3002`,
25203
+ seriesCoverage
25204
+ );
25205
+ }
25206
+ if (explicitGlobalMissing) {
25207
+ return withDataRangeInterpretation(rawResult, "missing", true, "explicit-missing", ranges, "report-missing-data", seriesCoverage);
25208
+ }
25209
+ const missingSeries = seriesCoverage.filter((series) => series.coverageStatus === "missing");
25210
+ if (missingSeries.length > 0) {
25211
+ const wanted = missingSeries.map((series) => `${series.exchange_id ? `${series.exchange_id}/` : ""}${series.data_type}`).join("\u3001");
25212
+ const { Data: _rawData, ...envelope } = rawResult;
25213
+ const source = ranges.length > 0 ? envelope : rawResult;
25214
+ return withDataRangeInterpretation(
25215
+ source,
25216
+ "missing",
25217
+ true,
25218
+ missingSeries.every((series) => series.reasonCode === "no-local-files") ? "no-local-files" : "series-missing",
25219
+ ranges,
25220
+ `\u672C\u5730\u7F3A\u5C11 ${wanted}\u3002\u5148\u7528 mcp-download-data \u4E0B\u8F7D\uFF0C\u518D\u7528 mcp-wait kind=download \u7B49\u5F85\u7EC8\u6001\uFF0C\u7136\u540E\u91CD\u65B0\u67E5\u8BE2\u8986\u76D6\u3002`,
25221
+ seriesCoverage
25076
25222
  );
25077
25223
  }
25078
- if (hasExplicitMissingMarker(data)) {
25079
- return withDataRangeInterpretation(rawResult, "missing", true, "explicit-missing", ranges, "report-missing-data");
25224
+ const incompleteSeries = seriesCoverage.some((series) => series.coverageStatus === "unknown");
25225
+ if (ranges.length > 0 && incompleteSeries) {
25226
+ const { Data: _rawData, ...withoutRawData } = rawResult;
25227
+ return withDataRangeInterpretation(
25228
+ withoutRawData,
25229
+ "unknown",
25230
+ false,
25231
+ "incomplete-series-coverage",
25232
+ ranges,
25233
+ "recheck-coverage",
25234
+ seriesCoverage
25235
+ );
25080
25236
  }
25081
25237
  if (ranges.length > 0) {
25082
25238
  const { Data: _rawData, ...withoutRawData } = rawResult;
25083
- return withDataRangeInterpretation(withoutRawData, "available", false, "explicit-ranges", ranges, "run-backtest");
25239
+ return withDataRangeInterpretation(withoutRawData, "available", false, "explicit-ranges", ranges, "run-backtest", seriesCoverage);
25084
25240
  }
25085
25241
  const reasonCode = isEmptyRecord(data) || hasResultCollection && resultItems.length === 0 ? "empty-summary" : hasResultCollection && resultItems.length > 0 ? "no-local-coverage" : "unrecognized-shape";
25086
25242
  if (reasonCode === "no-local-coverage" && dataRoots?.resolved) {
@@ -25093,11 +25249,13 @@ function formatDataRangeResult(rawResult, dataRoots) {
25093
25249
  true,
25094
25250
  "no-local-files",
25095
25251
  [],
25096
- `\u7B56\u7565\u5F15\u64CE\u7684\u6570\u636E\u6839 ${dataRoots.engineRoot} \u4E0B\u6CA1\u6709 ${wanted} \u7684\u4EFB\u4F55\u6587\u4EF6\uFF0C\u672C\u5730\u786E\u5B9E\u6CA1\u6709\u8FD9\u6279\u884C\u60C5\u3002\u5148\u7528 mcp-download-data \u4E0B\u8F7D\uFF0C\u7528 mcp-get-download-progress \u8F6E\u8BE2\u5230\u7EC8\u6001\uFF0C\u518D\u91CD\u65B0\u67E5\u8986\u76D6\uFF1B\u4E0D\u8981\u76F4\u63A5\u5F00\u59CB\u56DE\u6D4B\u3002`
25252
+ `\u7B56\u7565\u5F15\u64CE\u7684\u6570\u636E\u6839 ${dataRoots.engineRoot} \u4E0B\u6CA1\u6709 ${wanted} \u7684\u4EFB\u4F55\u6587\u4EF6\uFF0C\u672C\u5730\u786E\u5B9E\u6CA1\u6709\u8FD9\u6279\u884C\u60C5\u3002\u5148\u7528 mcp-download-data \u4E0B\u8F7D\uFF0C\u518D\u7528 mcp-wait kind=download \u7B49\u5F85\u7EC8\u6001\uFF0C\u7136\u540E\u91CD\u65B0\u67E5\u8986\u76D6\uFF1B\u4E0D\u8981\u76F4\u63A5\u5F00\u59CB\u56DE\u6D4B\u3002`,
25253
+ seriesCoverage
25097
25254
  );
25098
25255
  }
25099
25256
  }
25100
- return withDataRangeInterpretation(rawResult, "unknown", false, reasonCode, [], "run-backtest");
25257
+ const finalReasonCode = requestedSeries.length > 0 && seriesCoverage.some((series) => series.reasonCode === "upstream-omitted") ? "incomplete-series-coverage" : reasonCode;
25258
+ return withDataRangeInterpretation(rawResult, "unknown", false, finalReasonCode, [], "run-backtest", seriesCoverage);
25101
25259
  }
25102
25260
  function unionDataRangeIntervals(intervals) {
25103
25261
  const sorted = [...intervals].sort((a, b) => a[0] === b[0] ? a[1].localeCompare(b[1]) : a[0].localeCompare(b[0]));
@@ -25112,9 +25270,9 @@ function unionDataRangeIntervals(intervals) {
25112
25270
  }
25113
25271
  return merged;
25114
25272
  }
25115
- function withDataRangeInterpretation(rawResult, coverageStatus, blocksBacktest, reasonCode, ranges, nextAction) {
25273
+ function withDataRangeInterpretation(rawResult, coverageStatus, blocksBacktest, reasonCode, ranges, nextAction, seriesCoverage) {
25116
25274
  const { Data: upstreamData, ...envelope } = rawResult;
25117
- const data = { coverageStatus, blocksBacktest, reasonCode, nextAction, ranges };
25275
+ const data = { coverageStatus, blocksBacktest, reasonCode, nextAction, ranges, seriesCoverage };
25118
25276
  if (isRecord4(upstreamData)) {
25119
25277
  for (const [key, value] of Object.entries(upstreamData)) {
25120
25278
  if (!(key in data)) data[key] = value;
@@ -25417,7 +25575,7 @@ function compactDataRangeDate(value) {
25417
25575
 
25418
25576
  // src/tool-response.ts
25419
25577
  var identityRepairHint = (data) => data;
25420
- function handleIpcResponse(response, tool, repairHint = identityRepairHint, dataRoots) {
25578
+ function handleIpcResponse(response, tool, repairHint = identityRepairHint, dataRoots, requestedDataRanges) {
25421
25579
  const parsed = parseIpcRawResponse(response);
25422
25580
  if (!parsed.isSuccess) {
25423
25581
  return {
@@ -25426,18 +25584,18 @@ function handleIpcResponse(response, tool, repairHint = identityRepairHint, data
25426
25584
  };
25427
25585
  }
25428
25586
  const data = repairHint(parsed.data);
25429
- const text2 = typeof data === "string" ? applyResponseTransform(data, tool, dataRoots) : applyResponseTransform(JSON.stringify(data), tool, dataRoots);
25587
+ const text2 = typeof data === "string" ? applyResponseTransform(data, tool, dataRoots, requestedDataRanges) : applyResponseTransform(JSON.stringify(data), tool, dataRoots, requestedDataRanges);
25430
25588
  return {
25431
25589
  content: [{ type: "text", text: text2 }],
25432
25590
  isError: isIpcBusinessError(data) || void 0
25433
25591
  };
25434
25592
  }
25435
- function applyResponseTransform(text2, tool, dataRoots) {
25593
+ function applyResponseTransform(text2, tool, dataRoots, requestedDataRanges) {
25436
25594
  if (!tool?.responseTransform || !text2) return text2;
25437
25595
  try {
25438
25596
  const parsed = JSON.parse(text2);
25439
25597
  if (tool.responseTransform === "dataRange") {
25440
- return JSON.stringify(formatDataRangeResult(parsed, dataRoots));
25598
+ return JSON.stringify(formatDataRangeResult(parsed, dataRoots, requestedDataRanges));
25441
25599
  }
25442
25600
  if (tool.responseTransform === "downloadProgress") {
25443
25601
  return JSON.stringify(formatDownloadProgressResult(parsed));
@@ -28596,7 +28754,7 @@ async function startMcpServer() {
28596
28754
  }
28597
28755
  try {
28598
28756
  const response = await ipcClient.invoke(ipcUri, params, body, timeout);
28599
- const result = shapeToolResult(tool, toolArgs, handleIpcResponse(response, tool, withRuntimeRepairHint, dataRoots), session);
28757
+ const result = shapeToolResult(tool, toolArgs, handleIpcResponse(response, tool, withRuntimeRepairHint, dataRoots, toolArgs.params), session);
28600
28758
  if (name === "mcp-download-data") recordActiveDownload(result);
28601
28759
  return result;
28602
28760
  } catch (err) {
@@ -28604,7 +28762,7 @@ async function startMcpServer() {
28604
28762
  if (reconnectedClient) {
28605
28763
  try {
28606
28764
  const response = await reconnectedClient.invoke(ipcUri, params, body, timeout);
28607
- const result = shapeToolResult(tool, toolArgs, handleIpcResponse(response, tool, withRuntimeRepairHint, dataRoots), session);
28765
+ const result = shapeToolResult(tool, toolArgs, handleIpcResponse(response, tool, withRuntimeRepairHint, dataRoots, toolArgs.params), session);
28608
28766
  if (name === "mcp-download-data") recordActiveDownload(result);
28609
28767
  return result;
28610
28768
  } catch (retryErr) {