@daghis/teamcity-mcp 1.3.3 → 1.3.5

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/dist/index.js CHANGED
@@ -1317,6 +1317,9 @@ var BuildConfigurationUpdateManager = class {
1317
1317
  }
1318
1318
  };
1319
1319
 
1320
+ // src/teamcity/utils/build-locator.ts
1321
+ var toBuildLocator = (buildId) => buildId.includes(":") ? buildId : `id:${buildId}`;
1322
+
1320
1323
  // src/teamcity/build-results-manager.ts
1321
1324
  var BuildResultsManager = class _BuildResultsManager {
1322
1325
  client;
@@ -1399,7 +1402,7 @@ var BuildResultsManager = class _BuildResultsManager {
1399
1402
  */
1400
1403
  async fetchBuildSummary(buildId) {
1401
1404
  const response = await this.client.modules.builds.getBuild(
1402
- this.toBuildLocator(buildId),
1405
+ toBuildLocator(buildId),
1403
1406
  _BuildResultsManager.fields
1404
1407
  );
1405
1408
  return response.data;
@@ -1455,7 +1458,7 @@ var BuildResultsManager = class _BuildResultsManager {
1455
1458
  async fetchArtifacts(buildId, options) {
1456
1459
  try {
1457
1460
  const response = await this.client.modules.builds.getFilesListOfBuild(
1458
- this.toBuildLocator(buildId)
1461
+ toBuildLocator(buildId)
1459
1462
  );
1460
1463
  const artifactListing = response.data;
1461
1464
  let artifacts = artifactListing.file ?? [];
@@ -1507,7 +1510,7 @@ var BuildResultsManager = class _BuildResultsManager {
1507
1510
  async fetchStatistics(buildId) {
1508
1511
  try {
1509
1512
  const response = await this.client.modules.builds.getBuildStatisticValues(
1510
- this.toBuildLocator(buildId)
1513
+ toBuildLocator(buildId)
1511
1514
  );
1512
1515
  const payload = response.data;
1513
1516
  const properties = payload.property ?? [];
@@ -1573,8 +1576,9 @@ var BuildResultsManager = class _BuildResultsManager {
1573
1576
  */
1574
1577
  async fetchDependencies(buildId) {
1575
1578
  try {
1576
- const response = await this.client.request(
1577
- (ctx) => ctx.axios.get(`${ctx.baseUrl}/app/rest/builds/id:${buildId}/snapshot-dependencies`)
1579
+ const response = await this.client.modules.builds.getAllBuilds(
1580
+ `snapshotDependency:(to:(id:${buildId}))`,
1581
+ "build(id,number,buildTypeId,status)"
1578
1582
  );
1579
1583
  const depsData = response.data;
1580
1584
  const builds = depsData.build ?? [];
@@ -1606,20 +1610,18 @@ var BuildResultsManager = class _BuildResultsManager {
1606
1610
  const baseUrl = this.client.getApiConfig().baseUrl;
1607
1611
  return baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
1608
1612
  }
1609
- toBuildLocator(buildId) {
1610
- return buildId.includes(":") ? buildId : `id:${buildId}`;
1611
- }
1612
1613
  async downloadArtifactContent(buildId, artifactPath) {
1613
1614
  const normalizedPath = artifactPath.split("/").map((segment) => encodeURIComponent(segment)).join("/");
1614
- const response = await this.client.request(
1615
- (ctx) => ctx.axios.get(
1616
- `${ctx.baseUrl}/app/rest/builds/id:${buildId}/artifacts/content/${normalizedPath}`,
1617
- {
1618
- responseType: "arraybuffer"
1619
- }
1620
- )
1615
+ const buildLocator = toBuildLocator(buildId);
1616
+ const response = await this.client.modules.builds.downloadFileOfBuild(
1617
+ `content/${normalizedPath}`,
1618
+ buildLocator,
1619
+ void 0,
1620
+ void 0,
1621
+ { responseType: "arraybuffer" }
1621
1622
  );
1622
- return response.data;
1623
+ const axiosResponse = response;
1624
+ return axiosResponse.data ?? new ArrayBuffer(0);
1623
1625
  }
1624
1626
  /**
1625
1627
  * Parse TeamCity date format
@@ -1692,6 +1694,7 @@ var BuildResultsManager = class _BuildResultsManager {
1692
1694
 
1693
1695
  // src/teamcity/client-adapter.ts
1694
1696
  var import_axios = __toESM(require("axios"));
1697
+ var FALLBACK_BASE_URL = "http://not-configured";
1695
1698
  var resolveModules = (api) => {
1696
1699
  const candidate = api.modules;
1697
1700
  if (candidate != null) {
@@ -1735,9 +1738,11 @@ var resolveModules = (api) => {
1735
1738
  };
1736
1739
  function createAdapterFromTeamCityAPI(api, options = {}) {
1737
1740
  const modules = resolveModules(api);
1738
- const baseUrl = api.getBaseUrl();
1739
- const httpInstance = api.http ?? import_axios.default.create({ baseURL: baseUrl });
1740
- const fallbackApiConfig = resolveApiClientConfigFromApi(api, httpInstance);
1741
+ const getBaseUrl = api.getBaseUrl;
1742
+ const inferredBaseUrl = typeof getBaseUrl === "function" ? getBaseUrl.call(api) : void 0;
1743
+ const fallbackBaseUrl = inferredBaseUrl ?? options.apiConfig?.baseUrl ?? api.http?.defaults?.baseURL ?? FALLBACK_BASE_URL;
1744
+ const httpInstance = api.http ?? import_axios.default.create({ baseURL: fallbackBaseUrl });
1745
+ const fallbackApiConfig = resolveApiClientConfigFromApi(api, httpInstance, fallbackBaseUrl);
1741
1746
  const resolvedApiConfig = {
1742
1747
  baseUrl: options.apiConfig?.baseUrl ?? fallbackApiConfig.baseUrl,
1743
1748
  token: options.apiConfig?.token ?? fallbackApiConfig.token,
@@ -1750,7 +1755,13 @@ function createAdapterFromTeamCityAPI(api, options = {}) {
1750
1755
  timeout: resolvedApiConfig.timeout
1751
1756
  }
1752
1757
  };
1753
- const request = async (fn) => fn({ axios: httpInstance, baseUrl, requestId: void 0 });
1758
+ if (fallbackBaseUrl === FALLBACK_BASE_URL && resolvedApiConfig.baseUrl === FALLBACK_BASE_URL) {
1759
+ warn("TeamCity adapter using fallback baseUrl placeholder", {
1760
+ reason: "missing_base_url",
1761
+ hasApiConfig: Boolean(options.apiConfig)
1762
+ });
1763
+ }
1764
+ const request = async (fn) => fn({ axios: httpInstance, baseUrl: resolvedApiConfig.baseUrl, requestId: void 0 });
1754
1765
  const buildApi = modules.builds;
1755
1766
  return {
1756
1767
  modules,
@@ -1759,7 +1770,7 @@ function createAdapterFromTeamCityAPI(api, options = {}) {
1759
1770
  getConfig: () => resolvedFullConfig,
1760
1771
  getApiConfig: () => resolvedApiConfig,
1761
1772
  getAxios: () => httpInstance,
1762
- testConnection: () => api.testConnection(),
1773
+ testConnection: () => typeof api.testConnection === "function" ? api.testConnection() : Promise.resolve(true),
1763
1774
  listProjects: (locator) => api.listProjects(locator),
1764
1775
  getProject: (projectId) => api.getProject(projectId),
1765
1776
  listBuilds: (locator) => api.listBuilds(locator),
@@ -1779,16 +1790,18 @@ function createAdapterFromTeamCityAPI(api, options = {}) {
1779
1790
  listVcsRoots: (projectId) => api.listVcsRoots(projectId),
1780
1791
  listAgents: () => api.listAgents(),
1781
1792
  listAgentPools: () => api.listAgentPools(),
1782
- baseUrl
1793
+ baseUrl: resolvedApiConfig.baseUrl
1783
1794
  };
1784
1795
  }
1785
1796
  var isAxiosHeadersRecord = (value) => typeof value === "object" && value !== null;
1786
- var resolveApiClientConfigFromApi = (api, http) => {
1797
+ var resolveApiClientConfigFromApi = (api, http, baseUrlFallback) => {
1787
1798
  const timeout = resolveTimeout(http);
1788
1799
  const authHeader = getAuthorizationHeader(http);
1789
1800
  const token = stripBearerPrefix(authHeader);
1801
+ const getBaseUrl = api.getBaseUrl;
1802
+ const resolvedBaseUrl = typeof getBaseUrl === "function" ? getBaseUrl.call(api) : http.defaults.baseURL ?? baseUrlFallback;
1790
1803
  return {
1791
- baseUrl: api.getBaseUrl(),
1804
+ baseUrl: typeof resolvedBaseUrl === "string" && resolvedBaseUrl.length > 0 ? resolvedBaseUrl : baseUrlFallback,
1792
1805
  token: token ?? "",
1793
1806
  timeout
1794
1807
  };
@@ -36231,7 +36244,7 @@ var TeamCityAPI = class _TeamCityAPI {
36231
36244
  return response.data;
36232
36245
  }
36233
36246
  async getBuild(buildId) {
36234
- const response = await this.builds.getBuild(this.toBuildLocator(buildId));
36247
+ const response = await this.builds.getBuild(toBuildLocator(buildId));
36235
36248
  return response.data;
36236
36249
  }
36237
36250
  async triggerBuild(buildTypeId, branchName, comment) {
@@ -36322,7 +36335,7 @@ var TeamCityAPI = class _TeamCityAPI {
36322
36335
  }
36323
36336
  async listBuildArtifacts(buildId, options) {
36324
36337
  return this.builds.getFilesListOfBuild(
36325
- this.toBuildLocator(buildId),
36338
+ toBuildLocator(buildId),
36326
36339
  options?.basePath,
36327
36340
  options?.locator,
36328
36341
  options?.fields,
@@ -36340,16 +36353,13 @@ var TeamCityAPI = class _TeamCityAPI {
36340
36353
  );
36341
36354
  }
36342
36355
  async getBuildStatistics(buildId, fields) {
36343
- return this.builds.getBuildStatisticValues(this.toBuildLocator(buildId), fields);
36356
+ return this.builds.getBuildStatisticValues(toBuildLocator(buildId), fields);
36344
36357
  }
36345
36358
  async listChangesForBuild(buildId, fields) {
36346
36359
  return this.changes.getAllChanges(`build:(id:${buildId})`, fields);
36347
36360
  }
36348
36361
  async listSnapshotDependencies(buildId) {
36349
- const response = await this.builds.getBuild(
36350
- this.toBuildLocator(buildId),
36351
- "snapshot-dependencies"
36352
- );
36362
+ const response = await this.builds.getBuild(toBuildLocator(buildId), "snapshot-dependencies");
36353
36363
  const dependencies = response.data["snapshot-dependencies"];
36354
36364
  if (dependencies == null) {
36355
36365
  return response;
@@ -36382,9 +36392,6 @@ var TeamCityAPI = class _TeamCityAPI {
36382
36392
  this.instance = void 0;
36383
36393
  this.instanceConfig = void 0;
36384
36394
  }
36385
- toBuildLocator(buildId) {
36386
- return buildId.includes(":") ? buildId : `id:${buildId}`;
36387
- }
36388
36395
  createApi(apiCtor) {
36389
36396
  return new apiCtor(this.config, this.baseUrl, this.axiosInstance);
36390
36397
  }
@@ -36470,7 +36477,7 @@ var DEV_TOOLS = [
36470
36477
  "list_projects",
36471
36478
  schema,
36472
36479
  async (typed) => {
36473
- const api = TeamCityAPI.getInstance();
36480
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36474
36481
  const baseParts = [];
36475
36482
  if (typed.locator) baseParts.push(typed.locator);
36476
36483
  if (typed.parentProjectId) baseParts.push(`parent:(id:${typed.parentProjectId})`);
@@ -36480,7 +36487,10 @@ var DEV_TOOLS = [
36480
36487
  if (typeof count === "number") parts.push(`count:${count}`);
36481
36488
  if (typeof start === "number") parts.push(`start:${start}`);
36482
36489
  const locator = parts.length > 0 ? parts.join(",") : void 0;
36483
- return api.projects.getAllProjects(locator, typed.fields);
36490
+ return adapter.modules.projects.getAllProjects(
36491
+ locator,
36492
+ typed.fields
36493
+ );
36484
36494
  };
36485
36495
  const fetcher = createPaginatedFetcher(
36486
36496
  baseFetch,
@@ -36520,8 +36530,8 @@ var DEV_TOOLS = [
36520
36530
  "get_project",
36521
36531
  schema,
36522
36532
  async (typed) => {
36523
- const api = TeamCityAPI.getInstance();
36524
- const project = await api.getProject(typed.projectId);
36533
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36534
+ const project = await adapter.getProject(typed.projectId);
36525
36535
  return json(project);
36526
36536
  },
36527
36537
  args
@@ -36569,7 +36579,7 @@ var DEV_TOOLS = [
36569
36579
  "list_builds",
36570
36580
  schema,
36571
36581
  async (typed) => {
36572
- const api = TeamCityAPI.getInstance();
36582
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36573
36583
  const baseParts = [];
36574
36584
  if (typed.locator) baseParts.push(typed.locator);
36575
36585
  if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
@@ -36581,7 +36591,7 @@ var DEV_TOOLS = [
36581
36591
  if (typeof count === "number") parts.push(`count:${count}`);
36582
36592
  if (typeof start === "number") parts.push(`start:${start}`);
36583
36593
  const locator = parts.length > 0 ? parts.join(",") : void 0;
36584
- return api.builds.getAllBuilds(locator, typed.fields);
36594
+ return adapter.modules.builds.getAllBuilds(locator, typed.fields);
36585
36595
  };
36586
36596
  const fetcher = createPaginatedFetcher(
36587
36597
  baseFetch,
@@ -36624,8 +36634,8 @@ var DEV_TOOLS = [
36624
36634
  "get_build",
36625
36635
  schema,
36626
36636
  async (typed) => {
36627
- const api = TeamCityAPI.getInstance();
36628
- const build = await api.getBuild(typed.buildId);
36637
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36638
+ const build = await adapter.getBuild(typed.buildId);
36629
36639
  return json(build);
36630
36640
  },
36631
36641
  args
@@ -36654,9 +36664,9 @@ var DEV_TOOLS = [
36654
36664
  "trigger_build",
36655
36665
  schema,
36656
36666
  async (typed) => {
36657
- const api = TeamCityAPI.getInstance();
36667
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36658
36668
  try {
36659
- const build = await api.triggerBuild(
36669
+ const build = await adapter.triggerBuild(
36660
36670
  typed.buildTypeId,
36661
36671
  typed.branchName,
36662
36672
  typed.comment
@@ -36672,9 +36682,13 @@ var DEV_TOOLS = [
36672
36682
  const branchPart = typed.branchName ? `<branchName>${typed.branchName}</branchName>` : "";
36673
36683
  const commentPart = typed.comment ? `<comment><text>${typed.comment.replace(/</g, "&lt;").replace(/>/g, "&gt;")}</text></comment>` : "";
36674
36684
  const xml = `<?xml version="1.0" encoding="UTF-8"?><build><buildType id="${typed.buildTypeId}"/>${branchPart}${commentPart}</build>`;
36675
- const response = await api.buildQueue.addBuildToQueue(false, xml, {
36676
- headers: { "Content-Type": "application/xml", Accept: "application/json" }
36677
- });
36685
+ const response = await adapter.modules.buildQueue.addBuildToQueue(
36686
+ false,
36687
+ xml,
36688
+ {
36689
+ headers: { "Content-Type": "application/xml", Accept: "application/json" }
36690
+ }
36691
+ );
36678
36692
  const build = response.data;
36679
36693
  return json({
36680
36694
  success: true,
@@ -36705,8 +36719,8 @@ var DEV_TOOLS = [
36705
36719
  "cancel_queued_build",
36706
36720
  schema,
36707
36721
  async (typed) => {
36708
- const api = TeamCityAPI.getInstance();
36709
- await api.buildQueue.deleteQueuedBuild(typed.buildId);
36722
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36723
+ await adapter.modules.buildQueue.deleteQueuedBuild(typed.buildId);
36710
36724
  return json({ success: true, action: "cancel_queued_build", buildId: typed.buildId });
36711
36725
  },
36712
36726
  args
@@ -36746,8 +36760,8 @@ var DEV_TOOLS = [
36746
36760
  "get_build_status",
36747
36761
  schema,
36748
36762
  async (typed) => {
36749
- const api = TeamCityAPI.getInstance();
36750
- const statusManager = new (await Promise.resolve().then(() => (init_build_status_manager(), build_status_manager_exports))).BuildStatusManager(createAdapterFromTeamCityAPI(api));
36763
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36764
+ const statusManager = new (await Promise.resolve().then(() => (init_build_status_manager(), build_status_manager_exports))).BuildStatusManager(adapter);
36751
36765
  const result = await statusManager.getBuildStatus({
36752
36766
  buildId: typed.buildId,
36753
36767
  includeTests: typed.includeTests,
@@ -36760,14 +36774,17 @@ var DEV_TOOLS = [
36760
36774
  }
36761
36775
  if (typed.includeQueueTotals) {
36762
36776
  try {
36763
- const countResp = await api.buildQueue.getAllQueuedBuilds(void 0, "count");
36777
+ const countResp = await adapter.modules.buildQueue.getAllQueuedBuilds(
36778
+ void 0,
36779
+ "count"
36780
+ );
36764
36781
  enrich.totalQueued = countResp.data.count;
36765
36782
  } catch {
36766
36783
  }
36767
36784
  }
36768
36785
  if (typed.includeQueueReason) {
36769
36786
  try {
36770
- const qb = await api.buildQueue.getQueuedBuild(typed.buildId);
36787
+ const qb = await adapter.modules.buildQueue.getQueuedBuild(typed.buildId);
36771
36788
  enrich.waitReason = qb.data.waitReason;
36772
36789
  } catch {
36773
36790
  }
@@ -36820,7 +36837,7 @@ var DEV_TOOLS = [
36820
36837
  "fetch_build_log",
36821
36838
  schema,
36822
36839
  async (typed) => {
36823
- const api = TeamCityAPI.getInstance();
36840
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36824
36841
  let effectiveBuildId;
36825
36842
  if (typed.buildId) {
36826
36843
  effectiveBuildId = typed.buildId;
@@ -36832,11 +36849,11 @@ var DEV_TOOLS = [
36832
36849
  baseLocatorParts.push(`number:${numberStr}`);
36833
36850
  baseLocatorParts.push("count:10");
36834
36851
  const locator = baseLocatorParts.join(",");
36835
- const resp = await api.listBuilds(locator);
36852
+ const resp = await adapter.listBuilds(locator);
36836
36853
  const builds = Array.isArray(resp.build) ? resp.build : [];
36837
36854
  if (builds.length === 0) {
36838
36855
  if (typed.buildTypeId) {
36839
- const recent = await api.listBuilds(
36856
+ const recent = await adapter.listBuilds(
36840
36857
  `buildType:(id:${typed.buildTypeId}),branch:default:any,count:100`
36841
36858
  );
36842
36859
  const items = Array.isArray(recent.build) ? recent.build : [];
@@ -36897,7 +36914,7 @@ var DEV_TOOLS = [
36897
36914
  const attemptFetch = async () => {
36898
36915
  if (typed.tail) {
36899
36916
  const count = typed.lineCount ?? typed.pageSize ?? 500;
36900
- const full = await api.getBuildLog(effectiveBuildId);
36917
+ const full = await adapter.getBuildLog(effectiveBuildId);
36901
36918
  const allLines = full.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
36902
36919
  if (allLines.length > 0 && allLines[allLines.length - 1] === "") allLines.pop();
36903
36920
  const total = allLines.length;
@@ -36919,7 +36936,7 @@ var DEV_TOOLS = [
36919
36936
  }
36920
36937
  const effectivePageSize = typed.lineCount ?? typed.pageSize ?? 500;
36921
36938
  const startLine = typeof typed.startLine === "number" ? typed.startLine : ((typed.page ?? 1) - 1) * effectivePageSize;
36922
- const chunk = await api.getBuildLogChunk(effectiveBuildId, {
36939
+ const chunk = await adapter.getBuildLogChunk(effectiveBuildId, {
36923
36940
  startLine,
36924
36941
  lineCount: effectivePageSize
36925
36942
  });
@@ -36991,7 +37008,7 @@ var DEV_TOOLS = [
36991
37008
  "list_build_configs",
36992
37009
  schema,
36993
37010
  async (typed) => {
36994
- const api = TeamCityAPI.getInstance();
37011
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36995
37012
  const baseParts = [];
36996
37013
  if (typed.locator) baseParts.push(typed.locator);
36997
37014
  if (typed.projectId) baseParts.push(`affectedProject:(id:${typed.projectId})`);
@@ -37001,7 +37018,10 @@ var DEV_TOOLS = [
37001
37018
  if (typeof count === "number") parts.push(`count:${count}`);
37002
37019
  if (typeof start === "number") parts.push(`start:${start}`);
37003
37020
  const locator = parts.length > 0 ? parts.join(",") : void 0;
37004
- return api.buildTypes.getAllBuildTypes(locator, typed.fields);
37021
+ return adapter.modules.buildTypes.getAllBuildTypes(
37022
+ locator,
37023
+ typed.fields
37024
+ );
37005
37025
  };
37006
37026
  const fetcher = createPaginatedFetcher(
37007
37027
  baseFetch,
@@ -37041,8 +37061,8 @@ var DEV_TOOLS = [
37041
37061
  "get_build_config",
37042
37062
  schema,
37043
37063
  async (typed) => {
37044
- const api = TeamCityAPI.getInstance();
37045
- const buildType = await api.getBuildType(typed.buildTypeId);
37064
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37065
+ const buildType = await adapter.getBuildType(typed.buildTypeId);
37046
37066
  return json(buildType);
37047
37067
  },
37048
37068
  args
@@ -37079,14 +37099,14 @@ var DEV_TOOLS = [
37079
37099
  "list_test_failures",
37080
37100
  schema,
37081
37101
  async (typed) => {
37082
- const api = TeamCityAPI.getInstance();
37102
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37083
37103
  const pageSize = typed.pageSize ?? 100;
37084
37104
  const baseFetch = async ({ count, start }) => {
37085
37105
  const parts = [`build:(id:${typed.buildId})`, "status:FAILURE"];
37086
37106
  if (typeof count === "number") parts.push(`count:${count}`);
37087
37107
  if (typeof start === "number") parts.push(`start:${start}`);
37088
37108
  const locator = parts.join(",");
37089
- return api.tests.getAllTestOccurrences(locator, typed.fields);
37109
+ return adapter.modules.tests.getAllTestOccurrences(locator, typed.fields);
37090
37110
  };
37091
37111
  const fetcher = createPaginatedFetcher(
37092
37112
  baseFetch,
@@ -37139,7 +37159,7 @@ var DEV_TOOLS = [
37139
37159
  "list_vcs_roots",
37140
37160
  schema,
37141
37161
  async (typed) => {
37142
- const api = TeamCityAPI.getInstance();
37162
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37143
37163
  const baseParts = [];
37144
37164
  if (typed.projectId) baseParts.push(`affectedProject:(id:${typed.projectId})`);
37145
37165
  const pageSize = typed.pageSize ?? 100;
@@ -37148,7 +37168,10 @@ var DEV_TOOLS = [
37148
37168
  if (typeof count === "number") parts.push(`count:${count}`);
37149
37169
  if (typeof start === "number") parts.push(`start:${start}`);
37150
37170
  const locator = parts.length > 0 ? parts.join(",") : void 0;
37151
- return api.vcsRoots.getAllVcsRoots(locator, typed.fields);
37171
+ return adapter.modules.vcsRoots.getAllVcsRoots(
37172
+ locator,
37173
+ typed.fields
37174
+ );
37152
37175
  };
37153
37176
  const fetcher = createPaginatedFetcher(
37154
37177
  baseFetch,
@@ -37188,10 +37211,10 @@ var DEV_TOOLS = [
37188
37211
  "get_vcs_root",
37189
37212
  schema,
37190
37213
  async (typed) => {
37191
- const api = TeamCityAPI.getInstance();
37192
- const listing = await api.vcsRoots.getAllVcsRoots(`id:${typed.id}`);
37214
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37215
+ const listing = await adapter.modules.vcsRoots.getAllVcsRoots(`id:${typed.id}`);
37193
37216
  const rootEntry = listing.data.vcsRoot?.[0];
37194
- const props = await api.vcsRoots.getAllVcsRootProperties(typed.id);
37217
+ const props = await adapter.modules.vcsRoots.getAllVcsRootProperties(typed.id);
37195
37218
  return json({
37196
37219
  id: rootEntry?.id ?? typed.id,
37197
37220
  name: rootEntry?.name,
@@ -37225,8 +37248,8 @@ var DEV_TOOLS = [
37225
37248
  "set_vcs_root_property",
37226
37249
  schema,
37227
37250
  async (typed) => {
37228
- const api = TeamCityAPI.getInstance();
37229
- await api.vcsRoots.setVcsRootProperty(typed.id, typed.name, typed.value, {
37251
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37252
+ await adapter.modules.vcsRoots.setVcsRootProperty(typed.id, typed.name, typed.value, {
37230
37253
  headers: { "Content-Type": "text/plain", Accept: "text/plain" }
37231
37254
  });
37232
37255
  return json({
@@ -37258,8 +37281,8 @@ var DEV_TOOLS = [
37258
37281
  "delete_vcs_root_property",
37259
37282
  schema,
37260
37283
  async (typed) => {
37261
- const api = TeamCityAPI.getInstance();
37262
- await api.vcsRoots.deleteVcsRootProperty(typed.id, typed.name);
37284
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37285
+ await adapter.modules.vcsRoots.deleteVcsRootProperty(typed.id, typed.name);
37263
37286
  return json({
37264
37287
  success: true,
37265
37288
  action: "delete_vcs_root_property",
@@ -37303,7 +37326,7 @@ var DEV_TOOLS = [
37303
37326
  "update_vcs_root_properties",
37304
37327
  schema,
37305
37328
  async (typed) => {
37306
- const api = TeamCityAPI.getInstance();
37329
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37307
37330
  const properties = [];
37308
37331
  if (typeof typed.url === "string") properties.push({ name: "url", value: typed.url });
37309
37332
  if (typeof typed.branch === "string")
@@ -37322,7 +37345,7 @@ var DEV_TOOLS = [
37322
37345
  updated: 0
37323
37346
  });
37324
37347
  }
37325
- await api.vcsRoots.setVcsRootProperties(
37348
+ await adapter.modules.vcsRoots.setVcsRootProperties(
37326
37349
  typed.id,
37327
37350
  void 0,
37328
37351
  { property: properties },
@@ -37372,7 +37395,7 @@ var DEV_TOOLS = [
37372
37395
  "list_queued_builds",
37373
37396
  schema,
37374
37397
  async (typed) => {
37375
- const api = TeamCityAPI.getInstance();
37398
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37376
37399
  const baseParts = [];
37377
37400
  if (typed.locator) baseParts.push(typed.locator);
37378
37401
  const pageSize = typed.pageSize ?? 100;
@@ -37381,7 +37404,10 @@ var DEV_TOOLS = [
37381
37404
  if (typeof count === "number") parts.push(`count:${count}`);
37382
37405
  if (typeof start === "number") parts.push(`start:${start}`);
37383
37406
  const locator = parts.length > 0 ? parts.join(",") : void 0;
37384
- return api.buildQueue.getAllQueuedBuilds(locator, typed.fields);
37407
+ return adapter.modules.buildQueue.getAllQueuedBuilds(
37408
+ locator,
37409
+ typed.fields
37410
+ );
37385
37411
  };
37386
37412
  const fetcher = createPaginatedFetcher(
37387
37413
  baseFetch,
@@ -37415,8 +37441,8 @@ var DEV_TOOLS = [
37415
37441
  "get_server_metrics",
37416
37442
  null,
37417
37443
  async () => {
37418
- const api = TeamCityAPI.getInstance();
37419
- const metrics = await api.server.getAllMetrics();
37444
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37445
+ const metrics = await adapter.modules.server.getAllMetrics();
37420
37446
  return json(metrics.data);
37421
37447
  },
37422
37448
  {}
@@ -37433,8 +37459,8 @@ var DEV_TOOLS = [
37433
37459
  "get_server_info",
37434
37460
  null,
37435
37461
  async () => {
37436
- const api = TeamCityAPI.getInstance();
37437
- const info2 = await api.server.getServerInfo();
37462
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37463
+ const info2 = await adapter.modules.server.getServerInfo();
37438
37464
  return json(info2.data);
37439
37465
  },
37440
37466
  {}
@@ -37459,19 +37485,19 @@ var DEV_TOOLS = [
37459
37485
  "list_server_health_items",
37460
37486
  schema,
37461
37487
  async (typed) => {
37462
- const api = TeamCityAPI.getInstance();
37488
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37463
37489
  const normalized = (() => {
37464
37490
  const raw = typeof typed.locator === "string" ? typed.locator.trim() : void 0;
37465
37491
  if (!raw || raw.length === 0) return void 0;
37466
37492
  return raw.replace(/category:\s*\((ERROR|WARNING|INFO)\)/g, "category:$1");
37467
37493
  })();
37468
37494
  try {
37469
- const response = await api.health.getHealthItems(normalized);
37495
+ const response = await adapter.modules.health.getHealthItems(normalized);
37470
37496
  return json(response.data);
37471
37497
  } catch (err) {
37472
37498
  const isHttp400 = err?.statusCode === 400 || err?.code === "VALIDATION_ERROR";
37473
37499
  if (!isHttp400) throw err;
37474
- const all = await api.health.getHealthItems();
37500
+ const all = await adapter.modules.health.getHealthItems();
37475
37501
  const rawItems = all.data?.healthItem ?? [];
37476
37502
  const filter = (item) => {
37477
37503
  if (!normalized) return true;
@@ -37520,8 +37546,8 @@ var DEV_TOOLS = [
37520
37546
  "get_server_health_item",
37521
37547
  schema,
37522
37548
  async (typed) => {
37523
- const api = TeamCityAPI.getInstance();
37524
- const response = await api.health.getSingleHealthItem(typed.locator);
37549
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37550
+ const response = await adapter.modules.health.getSingleHealthItem(typed.locator);
37525
37551
  return json(response.data);
37526
37552
  },
37527
37553
  args
@@ -37548,8 +37574,8 @@ var DEV_TOOLS = [
37548
37574
  "check_availability_guard",
37549
37575
  schema,
37550
37576
  async (typed) => {
37551
- const api = TeamCityAPI.getInstance();
37552
- const resp = await api.health.getHealthItems();
37577
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37578
+ const resp = await adapter.modules.health.getHealthItems();
37553
37579
  const items = resp.data?.healthItem ?? [];
37554
37580
  const critical = items.filter((i) => i.severity === "ERROR");
37555
37581
  const warnings = items.filter((i) => i.severity === "WARNING");
@@ -37575,8 +37601,8 @@ var DEV_TOOLS = [
37575
37601
  "get_compatible_build_types_for_agent",
37576
37602
  schema,
37577
37603
  async (typed) => {
37578
- const api = TeamCityAPI.getInstance();
37579
- const resp = await api.agents.getCompatibleBuildTypes(typed.agentId);
37604
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37605
+ const resp = await adapter.modules.agents.getCompatibleBuildTypes(typed.agentId);
37580
37606
  return json(resp.data);
37581
37607
  },
37582
37608
  args
@@ -37597,8 +37623,8 @@ var DEV_TOOLS = [
37597
37623
  "get_incompatible_build_types_for_agent",
37598
37624
  schema,
37599
37625
  async (typed) => {
37600
- const api = TeamCityAPI.getInstance();
37601
- const resp = await api.agents.getIncompatibleBuildTypes(typed.agentId);
37626
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37627
+ const resp = await adapter.modules.agents.getIncompatibleBuildTypes(typed.agentId);
37602
37628
  return json(resp.data);
37603
37629
  },
37604
37630
  args
@@ -37619,8 +37645,8 @@ var DEV_TOOLS = [
37619
37645
  "get_agent_enabled_info",
37620
37646
  schema,
37621
37647
  async (typed) => {
37622
- const api = TeamCityAPI.getInstance();
37623
- const resp = await api.agents.getEnabledInfo(typed.agentId);
37648
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37649
+ const resp = await adapter.modules.agents.getEnabledInfo(typed.agentId);
37624
37650
  return json(resp.data);
37625
37651
  },
37626
37652
  args
@@ -37650,11 +37676,11 @@ var DEV_TOOLS = [
37650
37676
  "get_compatible_agents_for_build_type",
37651
37677
  schema,
37652
37678
  async (typed) => {
37653
- const api = TeamCityAPI.getInstance();
37679
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37654
37680
  const filters = [`compatible:(buildType:${typed.buildTypeId})`];
37655
37681
  if (!typed.includeDisabled) filters.push("enabled:true");
37656
37682
  const locator = filters.join(",");
37657
- const resp = await api.agents.getAllAgents(locator);
37683
+ const resp = await adapter.modules.agents.getAllAgents(locator);
37658
37684
  return json(resp.data);
37659
37685
  },
37660
37686
  args
@@ -37684,11 +37710,11 @@ var DEV_TOOLS = [
37684
37710
  "count_compatible_agents_for_build_type",
37685
37711
  schema,
37686
37712
  async (typed) => {
37687
- const api = TeamCityAPI.getInstance();
37713
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37688
37714
  const parts = [`compatible:(buildType:${typed.buildTypeId})`];
37689
37715
  if (!typed.includeDisabled) parts.push("enabled:true");
37690
37716
  const locator = parts.join(",");
37691
- const resp = await api.agents.getAllAgents(locator, "count");
37717
+ const resp = await adapter.modules.agents.getAllAgents(locator, "count");
37692
37718
  const count = resp.data.count ?? 0;
37693
37719
  return json({ count });
37694
37720
  },
@@ -37719,14 +37745,14 @@ var DEV_TOOLS = [
37719
37745
  "get_compatible_agents_for_queued_build",
37720
37746
  schema,
37721
37747
  async (typed) => {
37722
- const api = TeamCityAPI.getInstance();
37723
- const build = await api.getBuild(typed.buildId);
37748
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37749
+ const build = await adapter.getBuild(typed.buildId);
37724
37750
  const buildTypeId = build.buildTypeId;
37725
37751
  if (!buildTypeId) return json({ items: [], count: 0, note: "Build type ID not found" });
37726
37752
  const parts = [`compatible:(buildType:${buildTypeId})`];
37727
37753
  if (!typed.includeDisabled) parts.push("enabled:true");
37728
37754
  const locator = parts.join(",");
37729
- const resp = await api.agents.getAllAgents(locator);
37755
+ const resp = await adapter.modules.agents.getAllAgents(locator);
37730
37756
  return json(resp.data);
37731
37757
  },
37732
37758
  args
@@ -37738,7 +37764,8 @@ var DEV_TOOLS = [
37738
37764
  description: "Check connectivity to TeamCity server and basic readiness",
37739
37765
  inputSchema: { type: "object", properties: {} },
37740
37766
  handler: async (_args) => {
37741
- const ok = await TeamCityAPI.getInstance().testConnection();
37767
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37768
+ const ok = await adapter.testConnection();
37742
37769
  return json({ ok });
37743
37770
  }
37744
37771
  },
@@ -37771,7 +37798,7 @@ var DEV_TOOLS = [
37771
37798
  "list_agents",
37772
37799
  schema,
37773
37800
  async (typed) => {
37774
- const api = TeamCityAPI.getInstance();
37801
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37775
37802
  const pageSize = typed.pageSize ?? 100;
37776
37803
  const baseFetch = async ({ count, start }) => {
37777
37804
  const parts = [];
@@ -37779,7 +37806,7 @@ var DEV_TOOLS = [
37779
37806
  if (typeof count === "number") parts.push(`count:${count}`);
37780
37807
  if (typeof start === "number") parts.push(`start:${start}`);
37781
37808
  const locator = parts.length > 0 ? parts.join(",") : void 0;
37782
- return api.agents.getAllAgents(locator, typed.fields);
37809
+ return adapter.modules.agents.getAllAgents(locator, typed.fields);
37783
37810
  };
37784
37811
  const fetcher = createPaginatedFetcher(
37785
37812
  baseFetch,
@@ -37829,14 +37856,17 @@ var DEV_TOOLS = [
37829
37856
  "list_agent_pools",
37830
37857
  schema,
37831
37858
  async (typed) => {
37832
- const api = TeamCityAPI.getInstance();
37859
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37833
37860
  const pageSize = typed.pageSize ?? 100;
37834
37861
  const baseFetch = async ({ count, start }) => {
37835
37862
  const parts = [];
37836
37863
  if (typeof count === "number") parts.push(`count:${count}`);
37837
37864
  if (typeof start === "number") parts.push(`start:${start}`);
37838
37865
  const locator = parts.length > 0 ? parts.join(",") : void 0;
37839
- return api.agentPools.getAllAgentPools(locator, typed.fields);
37866
+ return adapter.modules.agentPools.getAllAgentPools(
37867
+ locator,
37868
+ typed.fields
37869
+ );
37840
37870
  };
37841
37871
  const fetcher = createPaginatedFetcher(
37842
37872
  baseFetch,
@@ -37898,8 +37928,8 @@ var DEV_TOOLS = [
37898
37928
  "get_build_results",
37899
37929
  schema,
37900
37930
  async (typed) => {
37901
- const api = TeamCityAPI.getInstance();
37902
- const manager = new BuildResultsManager(createAdapterFromTeamCityAPI(api));
37931
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37932
+ const manager = new BuildResultsManager(adapter);
37903
37933
  const result = await manager.getBuildResults(typed.buildId, {
37904
37934
  includeArtifacts: typed.includeArtifacts,
37905
37935
  includeStatistics: typed.includeStatistics,
@@ -37934,10 +37964,10 @@ var DEV_TOOLS = [
37934
37964
  "get_test_details",
37935
37965
  schema,
37936
37966
  async (typed) => {
37937
- const api = TeamCityAPI.getInstance();
37967
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37938
37968
  let locator = `build:(id:${typed.buildId})`;
37939
37969
  if (typed.testNameId) locator += `,test:(id:${typed.testNameId})`;
37940
- const response = await api.tests.getAllTestOccurrences(locator);
37970
+ const response = await adapter.modules.tests.getAllTestOccurrences(locator);
37941
37971
  return json(response.data);
37942
37972
  },
37943
37973
  args
@@ -37960,10 +37990,10 @@ var DEV_TOOLS = [
37960
37990
  "analyze_build_problems",
37961
37991
  schema,
37962
37992
  async (typed) => {
37963
- const api = TeamCityAPI.getInstance();
37964
- const build = await api.getBuild(typed.buildId);
37965
- const problems = await api.builds.getBuildProblems(`id:${typed.buildId}`);
37966
- const failures = await api.listTestFailures(typed.buildId);
37993
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37994
+ const build = await adapter.getBuild(typed.buildId);
37995
+ const problems = await adapter.modules.builds.getBuildProblems(`id:${typed.buildId}`);
37996
+ const failures = await adapter.listTestFailures(typed.buildId);
37967
37997
  return json({
37968
37998
  buildStatus: build.status,
37969
37999
  statusText: build.statusText,
@@ -38008,7 +38038,7 @@ var DEV_TOOLS = [
38008
38038
  "list_changes",
38009
38039
  schema,
38010
38040
  async (typed) => {
38011
- const api = TeamCityAPI.getInstance();
38041
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38012
38042
  const baseParts = [];
38013
38043
  if (typed.locator) baseParts.push(typed.locator);
38014
38044
  if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
@@ -38019,7 +38049,10 @@ var DEV_TOOLS = [
38019
38049
  if (typeof count === "number") parts.push(`count:${count}`);
38020
38050
  if (typeof start === "number") parts.push(`start:${start}`);
38021
38051
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38022
- return api.changes.getAllChanges(locator, typed.fields);
38052
+ return adapter.modules.changes.getAllChanges(
38053
+ locator,
38054
+ typed.fields
38055
+ );
38023
38056
  };
38024
38057
  const fetcher = createPaginatedFetcher(
38025
38058
  baseFetch,
@@ -38075,7 +38108,7 @@ var DEV_TOOLS = [
38075
38108
  "list_problems",
38076
38109
  schema,
38077
38110
  async (typed) => {
38078
- const api = TeamCityAPI.getInstance();
38111
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38079
38112
  const baseParts = [];
38080
38113
  if (typed.locator) baseParts.push(typed.locator);
38081
38114
  if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
@@ -38086,7 +38119,10 @@ var DEV_TOOLS = [
38086
38119
  if (typeof count === "number") parts.push(`count:${count}`);
38087
38120
  if (typeof start === "number") parts.push(`start:${start}`);
38088
38121
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38089
- return api.problems.getAllBuildProblems(locator, typed.fields);
38122
+ return adapter.modules.problems.getAllBuildProblems(
38123
+ locator,
38124
+ typed.fields
38125
+ );
38090
38126
  };
38091
38127
  const fetcher = createPaginatedFetcher(
38092
38128
  baseFetch,
@@ -38148,7 +38184,7 @@ var DEV_TOOLS = [
38148
38184
  "list_problem_occurrences",
38149
38185
  schema,
38150
38186
  async (typed) => {
38151
- const api = TeamCityAPI.getInstance();
38187
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38152
38188
  const baseParts = [];
38153
38189
  if (typed.locator) baseParts.push(typed.locator);
38154
38190
  if (typed.buildId) baseParts.push(`build:(id:${typed.buildId})`);
@@ -38159,7 +38195,7 @@ var DEV_TOOLS = [
38159
38195
  if (typeof count === "number") parts.push(`count:${count}`);
38160
38196
  if (typeof start === "number") parts.push(`start:${start}`);
38161
38197
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38162
- return api.problemOccurrences.getAllBuildProblemOccurrences(
38198
+ return adapter.modules.problemOccurrences.getAllBuildProblemOccurrences(
38163
38199
  locator,
38164
38200
  typed.fields
38165
38201
  );
@@ -38229,7 +38265,7 @@ var DEV_TOOLS = [
38229
38265
  "list_investigations",
38230
38266
  schema,
38231
38267
  async (typed) => {
38232
- const api = TeamCityAPI.getInstance();
38268
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38233
38269
  const baseParts = [];
38234
38270
  if (typed.locator) baseParts.push(typed.locator);
38235
38271
  if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
@@ -38242,7 +38278,7 @@ var DEV_TOOLS = [
38242
38278
  if (typeof count === "number") parts.push(`count:${count}`);
38243
38279
  if (typeof start === "number") parts.push(`start:${start}`);
38244
38280
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38245
- return api.investigations.getAllInvestigations(
38281
+ return adapter.modules.investigations.getAllInvestigations(
38246
38282
  locator,
38247
38283
  typed.fields
38248
38284
  );
@@ -38306,7 +38342,7 @@ var DEV_TOOLS = [
38306
38342
  "list_muted_tests",
38307
38343
  schema,
38308
38344
  async (typed) => {
38309
- const api = TeamCityAPI.getInstance();
38345
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38310
38346
  const baseParts = [];
38311
38347
  if (typed.locator) baseParts.push(typed.locator);
38312
38348
  if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
@@ -38318,7 +38354,10 @@ var DEV_TOOLS = [
38318
38354
  if (typeof count === "number") parts.push(`count:${count}`);
38319
38355
  if (typeof start === "number") parts.push(`start:${start}`);
38320
38356
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38321
- return api.mutes.getAllMutedTests(locator, typed.fields);
38357
+ return adapter.modules.mutes.getAllMutedTests(
38358
+ locator,
38359
+ typed.fields
38360
+ );
38322
38361
  };
38323
38362
  const fetcher = createPaginatedFetcher(
38324
38363
  baseFetch,
@@ -38368,8 +38407,8 @@ var DEV_TOOLS = [
38368
38407
  "get_versioned_settings_status",
38369
38408
  schema,
38370
38409
  async (typed) => {
38371
- const api = TeamCityAPI.getInstance();
38372
- const response = await api.versionedSettings.getVersionedSettingsStatus(
38410
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38411
+ const response = await adapter.modules.versionedSettings.getVersionedSettingsStatus(
38373
38412
  typed.locator,
38374
38413
  typed.fields
38375
38414
  );
@@ -38409,7 +38448,7 @@ var DEV_TOOLS = [
38409
38448
  "list_users",
38410
38449
  schema,
38411
38450
  async (typed) => {
38412
- const api = TeamCityAPI.getInstance();
38451
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38413
38452
  const baseParts = [];
38414
38453
  if (typed.locator) baseParts.push(typed.locator);
38415
38454
  if (typed.groupId) baseParts.push(`group:(id:${typed.groupId})`);
@@ -38419,7 +38458,7 @@ var DEV_TOOLS = [
38419
38458
  if (typeof count === "number") parts.push(`count:${count}`);
38420
38459
  if (typeof start === "number") parts.push(`start:${start}`);
38421
38460
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38422
- return api.users.getAllUsers(locator, typed.fields);
38461
+ return adapter.modules.users.getAllUsers(locator, typed.fields);
38423
38462
  };
38424
38463
  const fetcher = createPaginatedFetcher(
38425
38464
  baseFetch,
@@ -38461,8 +38500,8 @@ var DEV_TOOLS = [
38461
38500
  "list_roles",
38462
38501
  schema,
38463
38502
  async (typed) => {
38464
- const api = TeamCityAPI.getInstance();
38465
- const response = await api.roles.getRoles(typed.fields);
38503
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38504
+ const response = await adapter.modules.roles.getRoles(typed.fields);
38466
38505
  const roles = response.data?.role ?? [];
38467
38506
  return json({ items: roles, count: roles.length });
38468
38507
  },
@@ -38492,9 +38531,9 @@ var DEV_TOOLS = [
38492
38531
  "list_branches",
38493
38532
  schema,
38494
38533
  async (typed) => {
38495
- const api = TeamCityAPI.getInstance();
38534
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38496
38535
  const locator = typed.buildTypeId ? `buildType:(id:${typed.buildTypeId})` : `project:(id:${typed.projectId})`;
38497
- const builds = await api.listBuilds(`${locator},count:100}`);
38536
+ const builds = await adapter.listBuilds(`${locator},count:100}`);
38498
38537
  const items = Array.isArray(builds.build) ? builds.build : [];
38499
38538
  const branchNames = items.map((b) => b.branchName).filter((n) => typeof n === "string" && n.length > 0);
38500
38539
  const branches = new Set(branchNames);
@@ -38520,8 +38559,8 @@ var DEV_TOOLS = [
38520
38559
  "list_parameters",
38521
38560
  schema,
38522
38561
  async (typed) => {
38523
- const api = TeamCityAPI.getInstance();
38524
- const buildType = await api.getBuildType(typed.buildTypeId);
38562
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38563
+ const buildType = await adapter.getBuildType(typed.buildTypeId);
38525
38564
  return json({
38526
38565
  parameters: buildType.parameters?.property ?? [],
38527
38566
  count: buildType.parameters?.property?.length ?? 0
@@ -38546,10 +38585,10 @@ var DEV_TOOLS = [
38546
38585
  "list_project_hierarchy",
38547
38586
  schema,
38548
38587
  async (typed) => {
38549
- const api = TeamCityAPI.getInstance();
38588
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38550
38589
  const rootId = typed.rootProjectId ?? "_Root";
38551
38590
  async function buildHierarchy(projectId, depth = 0) {
38552
- const response = await api.projects.getProject(projectId);
38591
+ const response = await adapter.modules.projects.getProject(projectId);
38553
38592
  const project = response.data;
38554
38593
  const children = [];
38555
38594
  const maybeChildren = project.projects?.project ?? [];
@@ -38605,14 +38644,14 @@ var FULL_MODE_TOOLS = [
38605
38644
  "create_project",
38606
38645
  schema,
38607
38646
  async (typedArgs) => {
38608
- const api = TeamCityAPI.getInstance();
38647
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38609
38648
  const project = {
38610
38649
  name: typedArgs.name,
38611
38650
  id: typedArgs.id,
38612
38651
  parentProject: { id: typedArgs.parentProjectId ?? "_Root" },
38613
38652
  description: typedArgs.description
38614
38653
  };
38615
- const response = await api.projects.addProject(project, {
38654
+ const response = await adapter.modules.projects.addProject(project, {
38616
38655
  headers: { "Content-Type": "application/json", Accept: "application/json" }
38617
38656
  });
38618
38657
  return json({ success: true, action: "create_project", id: response.data.id });
@@ -38634,8 +38673,8 @@ var FULL_MODE_TOOLS = [
38634
38673
  },
38635
38674
  handler: async (args) => {
38636
38675
  const typedArgs = args;
38637
- const api = TeamCityAPI.getInstance();
38638
- await api.projects.deleteProject(typedArgs.projectId);
38676
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38677
+ await adapter.modules.projects.deleteProject(typedArgs.projectId);
38639
38678
  return json({ success: true, action: "delete_project", id: typedArgs.projectId });
38640
38679
  },
38641
38680
  mode: "full"
@@ -38664,7 +38703,7 @@ var FULL_MODE_TOOLS = [
38664
38703
  "update_project_settings",
38665
38704
  schema,
38666
38705
  async (typedArgs) => {
38667
- const api = TeamCityAPI.getInstance();
38706
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38668
38707
  debug("update_project_settings invoked", {
38669
38708
  projectId: typedArgs.projectId,
38670
38709
  // Only log which fields are present to reduce noise
@@ -38680,7 +38719,11 @@ var FULL_MODE_TOOLS = [
38680
38719
  field: "name",
38681
38720
  valuePreview: typedArgs.name
38682
38721
  });
38683
- await api.projects.setProjectField(typedArgs.projectId, "name", typedArgs.name);
38722
+ await adapter.modules.projects.setProjectField(
38723
+ typedArgs.projectId,
38724
+ "name",
38725
+ typedArgs.name
38726
+ );
38684
38727
  }
38685
38728
  if (typedArgs.description !== void 0) {
38686
38729
  debug("Setting project field", {
@@ -38688,7 +38731,7 @@ var FULL_MODE_TOOLS = [
38688
38731
  field: "description",
38689
38732
  valuePreview: typedArgs.description
38690
38733
  });
38691
- await api.projects.setProjectField(
38734
+ await adapter.modules.projects.setProjectField(
38692
38735
  typedArgs.projectId,
38693
38736
  "description",
38694
38737
  typedArgs.description
@@ -38700,7 +38743,7 @@ var FULL_MODE_TOOLS = [
38700
38743
  field: "archived",
38701
38744
  valuePreview: String(typedArgs.archived)
38702
38745
  });
38703
- await api.projects.setProjectField(
38746
+ await adapter.modules.projects.setProjectField(
38704
38747
  typedArgs.projectId,
38705
38748
  "archived",
38706
38749
  String(typedArgs.archived)
@@ -38741,14 +38784,14 @@ var FULL_MODE_TOOLS = [
38741
38784
  },
38742
38785
  handler: async (args) => {
38743
38786
  const typedArgs = args;
38744
- const api = TeamCityAPI.getInstance();
38787
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38745
38788
  const buildType = {
38746
38789
  name: typedArgs.name,
38747
38790
  id: typedArgs.id,
38748
38791
  project: { id: typedArgs.projectId },
38749
38792
  description: typedArgs.description
38750
38793
  };
38751
- const response = await api.buildTypes.createBuildType(void 0, buildType, {
38794
+ const response = await adapter.modules.buildTypes.createBuildType(void 0, buildType, {
38752
38795
  headers: { "Content-Type": "application/json", Accept: "application/json" }
38753
38796
  });
38754
38797
  return json({ success: true, action: "create_build_config", id: response.data.id });
@@ -38770,15 +38813,15 @@ var FULL_MODE_TOOLS = [
38770
38813
  },
38771
38814
  handler: async (args) => {
38772
38815
  const typedArgs = args;
38773
- const api = TeamCityAPI.getInstance();
38774
- const source = await api.getBuildType(typedArgs.sourceBuildTypeId);
38816
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38817
+ const source = await adapter.getBuildType(typedArgs.sourceBuildTypeId);
38775
38818
  const buildType = {
38776
38819
  ...source,
38777
38820
  name: typedArgs.name,
38778
38821
  id: typedArgs.id,
38779
38822
  project: { id: typedArgs.projectId ?? source.project?.id ?? "_Root" }
38780
38823
  };
38781
- const response = await api.buildTypes.createBuildType(void 0, buildType);
38824
+ const response = await adapter.modules.buildTypes.createBuildType(void 0, buildType);
38782
38825
  return json({ success: true, action: "clone_build_config", id: response.data.id });
38783
38826
  },
38784
38827
  mode: "full"
@@ -38799,9 +38842,8 @@ var FULL_MODE_TOOLS = [
38799
38842
  },
38800
38843
  handler: async (args) => {
38801
38844
  const typedArgs = args;
38802
- const api = TeamCityAPI.getInstance();
38845
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38803
38846
  try {
38804
- const adapter = createAdapterFromTeamCityAPI(api);
38805
38847
  const manager = new BuildConfigurationUpdateManager(adapter);
38806
38848
  const current = await manager.retrieveConfiguration(typedArgs.buildTypeId);
38807
38849
  if (current) {
@@ -38816,17 +38858,21 @@ var FULL_MODE_TOOLS = [
38816
38858
  }
38817
38859
  } else {
38818
38860
  if (typedArgs.name != null && typedArgs.name !== "") {
38819
- await api.buildTypes.setBuildTypeField(typedArgs.buildTypeId, "name", typedArgs.name);
38861
+ await adapter.modules.buildTypes.setBuildTypeField(
38862
+ typedArgs.buildTypeId,
38863
+ "name",
38864
+ typedArgs.name
38865
+ );
38820
38866
  }
38821
38867
  if (typedArgs.description !== void 0) {
38822
- await api.buildTypes.setBuildTypeField(
38868
+ await adapter.modules.buildTypes.setBuildTypeField(
38823
38869
  typedArgs.buildTypeId,
38824
38870
  "description",
38825
38871
  typedArgs.description
38826
38872
  );
38827
38873
  }
38828
38874
  if (typedArgs.artifactRules !== void 0) {
38829
- await api.buildTypes.setBuildTypeField(
38875
+ await adapter.modules.buildTypes.setBuildTypeField(
38830
38876
  typedArgs.buildTypeId,
38831
38877
  "settings/artifactRules",
38832
38878
  typedArgs.artifactRules
@@ -38835,17 +38881,21 @@ var FULL_MODE_TOOLS = [
38835
38881
  }
38836
38882
  } catch {
38837
38883
  if (typedArgs.name != null && typedArgs.name !== "") {
38838
- await api.buildTypes.setBuildTypeField(typedArgs.buildTypeId, "name", typedArgs.name);
38884
+ await adapter.modules.buildTypes.setBuildTypeField(
38885
+ typedArgs.buildTypeId,
38886
+ "name",
38887
+ typedArgs.name
38888
+ );
38839
38889
  }
38840
38890
  if (typedArgs.description !== void 0) {
38841
- await api.buildTypes.setBuildTypeField(
38891
+ await adapter.modules.buildTypes.setBuildTypeField(
38842
38892
  typedArgs.buildTypeId,
38843
38893
  "description",
38844
38894
  typedArgs.description
38845
38895
  );
38846
38896
  }
38847
38897
  if (typedArgs.artifactRules !== void 0) {
38848
- await api.buildTypes.setBuildTypeField(
38898
+ await adapter.modules.buildTypes.setBuildTypeField(
38849
38899
  typedArgs.buildTypeId,
38850
38900
  "settings/artifactRules",
38851
38901
  typedArgs.artifactRules
@@ -38853,7 +38903,7 @@ var FULL_MODE_TOOLS = [
38853
38903
  }
38854
38904
  }
38855
38905
  if (typedArgs.paused !== void 0) {
38856
- await api.buildTypes.setBuildTypeField(
38906
+ await adapter.modules.buildTypes.setBuildTypeField(
38857
38907
  typedArgs.buildTypeId,
38858
38908
  "paused",
38859
38909
  String(typedArgs.paused)
@@ -38886,14 +38936,19 @@ var FULL_MODE_TOOLS = [
38886
38936
  "add_vcs_root_to_build",
38887
38937
  schema,
38888
38938
  async (typed) => {
38889
- const api = TeamCityAPI.getInstance();
38939
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38890
38940
  const body = {
38891
38941
  "vcs-root": { id: typed.vcsRootId },
38892
38942
  "checkout-rules": typed.checkoutRules
38893
38943
  };
38894
- await api.buildTypes.addVcsRootToBuildType(typed.buildTypeId, void 0, body, {
38895
- headers: { "Content-Type": "application/json", Accept: "application/json" }
38896
- });
38944
+ await adapter.modules.buildTypes.addVcsRootToBuildType(
38945
+ typed.buildTypeId,
38946
+ void 0,
38947
+ body,
38948
+ {
38949
+ headers: { "Content-Type": "application/json", Accept: "application/json" }
38950
+ }
38951
+ );
38897
38952
  return json({
38898
38953
  success: true,
38899
38954
  action: "add_vcs_root_to_build",
@@ -38921,12 +38976,12 @@ var FULL_MODE_TOOLS = [
38921
38976
  },
38922
38977
  handler: async (args) => {
38923
38978
  const typedArgs = args;
38924
- const api = TeamCityAPI.getInstance();
38979
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38925
38980
  const parameter = {
38926
38981
  name: typedArgs.name,
38927
38982
  value: typedArgs.value
38928
38983
  };
38929
- await api.buildTypes.createBuildParameterOfBuildType(
38984
+ await adapter.modules.buildTypes.createBuildParameterOfBuildType(
38930
38985
  typedArgs.buildTypeId,
38931
38986
  void 0,
38932
38987
  parameter,
@@ -38955,8 +39010,8 @@ var FULL_MODE_TOOLS = [
38955
39010
  },
38956
39011
  handler: async (args) => {
38957
39012
  const typedArgs = args;
38958
- const api = TeamCityAPI.getInstance();
38959
- await api.buildTypes.updateBuildParameterOfBuildType(
39013
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39014
+ await adapter.modules.buildTypes.updateBuildParameterOfBuildType(
38960
39015
  typedArgs.name,
38961
39016
  typedArgs.buildTypeId,
38962
39017
  void 0,
@@ -38988,8 +39043,11 @@ var FULL_MODE_TOOLS = [
38988
39043
  },
38989
39044
  handler: async (args) => {
38990
39045
  const typedArgs = args;
38991
- const api = TeamCityAPI.getInstance();
38992
- await api.buildTypes.deleteBuildParameterOfBuildType_2(typedArgs.name, typedArgs.buildTypeId);
39046
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39047
+ await adapter.modules.buildTypes.deleteBuildParameterOfBuildType_2(
39048
+ typedArgs.name,
39049
+ typedArgs.buildTypeId
39050
+ );
38993
39051
  return json({
38994
39052
  success: true,
38995
39053
  action: "delete_parameter",
@@ -39017,7 +39075,7 @@ var FULL_MODE_TOOLS = [
39017
39075
  },
39018
39076
  handler: async (args) => {
39019
39077
  const typedArgs = args;
39020
- const api = TeamCityAPI.getInstance();
39078
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39021
39079
  const vcsRoot = {
39022
39080
  name: typedArgs.name,
39023
39081
  id: typedArgs.id,
@@ -39030,7 +39088,7 @@ var FULL_MODE_TOOLS = [
39030
39088
  ]
39031
39089
  }
39032
39090
  };
39033
- const response = await api.vcsRoots.addVcsRoot(void 0, vcsRoot, {
39091
+ const response = await adapter.modules.vcsRoots.addVcsRoot(void 0, vcsRoot, {
39034
39092
  headers: { "Content-Type": "application/json", Accept: "application/json" }
39035
39093
  });
39036
39094
  return json({ success: true, action: "create_vcs_root", id: response.data.id });
@@ -39051,8 +39109,8 @@ var FULL_MODE_TOOLS = [
39051
39109
  },
39052
39110
  handler: async (args) => {
39053
39111
  const typedArgs = args;
39054
- const api = TeamCityAPI.getInstance();
39055
- await api.agents.setAuthorizedInfo(
39112
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39113
+ await adapter.modules.agents.setAuthorizedInfo(
39056
39114
  typedArgs.agentId,
39057
39115
  void 0,
39058
39116
  { status: Boolean(typedArgs.authorize) },
@@ -39080,8 +39138,8 @@ var FULL_MODE_TOOLS = [
39080
39138
  },
39081
39139
  handler: async (args) => {
39082
39140
  const typedArgs = args;
39083
- const api = TeamCityAPI.getInstance();
39084
- await api.agents.setAgentPool(typedArgs.agentId, void 0, {
39141
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39142
+ await adapter.modules.agents.setAgentPool(typedArgs.agentId, void 0, {
39085
39143
  id: parseInt(typedArgs.poolId)
39086
39144
  });
39087
39145
  return json({
@@ -39115,7 +39173,7 @@ var FULL_MODE_TOOLS = [
39115
39173
  },
39116
39174
  handler: async (args) => {
39117
39175
  const typedArgs = args;
39118
- const api = TeamCityAPI.getInstance();
39176
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39119
39177
  switch (typedArgs.action) {
39120
39178
  case "add": {
39121
39179
  const stepProps = Object.fromEntries(
@@ -39131,9 +39189,14 @@ var FULL_MODE_TOOLS = [
39131
39189
  property: Object.entries(stepProps).map(([k, v]) => ({ name: k, value: v }))
39132
39190
  }
39133
39191
  };
39134
- await api.buildTypes.addBuildStepToBuildType(typedArgs.buildTypeId, void 0, step, {
39135
- headers: { "Content-Type": "application/json", Accept: "application/json" }
39136
- });
39192
+ await adapter.modules.buildTypes.addBuildStepToBuildType(
39193
+ typedArgs.buildTypeId,
39194
+ void 0,
39195
+ step,
39196
+ {
39197
+ headers: { "Content-Type": "application/json", Accept: "application/json" }
39198
+ }
39199
+ );
39137
39200
  return json({
39138
39201
  success: true,
39139
39202
  action: "add_build_step",
@@ -39148,16 +39211,39 @@ var FULL_MODE_TOOLS = [
39148
39211
  error: "Step ID is required for update action"
39149
39212
  });
39150
39213
  }
39151
- const props = Object.entries(typedArgs.properties ?? {});
39152
- for (const [k, v] of props) {
39153
- await api.buildTypes.setBuildStepParameter(
39154
- typedArgs.buildTypeId,
39155
- typedArgs.stepId,
39156
- k,
39157
- String(v),
39158
- { headers: { "Content-Type": "text/plain", Accept: "application/json" } }
39159
- );
39214
+ const updatePayload = {};
39215
+ if (typedArgs.name != null) {
39216
+ updatePayload["name"] = typedArgs.name;
39217
+ }
39218
+ if (typedArgs.type != null) {
39219
+ updatePayload["type"] = typedArgs.type;
39220
+ }
39221
+ const rawProps = typedArgs.properties ?? {};
39222
+ const stepProps = Object.fromEntries(
39223
+ Object.entries(rawProps).map(([k, v]) => [k, String(v)])
39224
+ );
39225
+ if (stepProps["script.content"]) {
39226
+ stepProps["use.custom.script"] = stepProps["use.custom.script"] ?? "true";
39227
+ stepProps["script.type"] = stepProps["script.type"] ?? "customScript";
39228
+ }
39229
+ if (Object.keys(stepProps).length > 0) {
39230
+ updatePayload["properties"] = {
39231
+ property: Object.entries(stepProps).map(([name, value]) => ({ name, value }))
39232
+ };
39160
39233
  }
39234
+ if (Object.keys(updatePayload).length === 0) {
39235
+ return json({
39236
+ success: false,
39237
+ action: "update_build_step",
39238
+ error: "No update fields provided"
39239
+ });
39240
+ }
39241
+ await adapter.modules.buildTypes.replaceBuildStep(
39242
+ typedArgs.buildTypeId,
39243
+ typedArgs.stepId,
39244
+ void 0,
39245
+ updatePayload
39246
+ );
39161
39247
  return json({
39162
39248
  success: true,
39163
39249
  action: "update_build_step",
@@ -39173,7 +39259,7 @@ var FULL_MODE_TOOLS = [
39173
39259
  error: "Step ID is required for delete action"
39174
39260
  });
39175
39261
  }
39176
- await api.buildTypes.deleteBuildStep(typedArgs.buildTypeId, typedArgs.stepId);
39262
+ await adapter.modules.buildTypes.deleteBuildStep(typedArgs.buildTypeId, typedArgs.stepId);
39177
39263
  return json({
39178
39264
  success: true,
39179
39265
  action: "delete_build_step",
@@ -39203,7 +39289,7 @@ var FULL_MODE_TOOLS = [
39203
39289
  },
39204
39290
  handler: async (args) => {
39205
39291
  const typedArgs = args;
39206
- const api = TeamCityAPI.getInstance();
39292
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39207
39293
  switch (typedArgs.action) {
39208
39294
  case "add": {
39209
39295
  const trigger = {
@@ -39215,9 +39301,14 @@ var FULL_MODE_TOOLS = [
39215
39301
  }))
39216
39302
  }
39217
39303
  };
39218
- await api.buildTypes.addTriggerToBuildType(typedArgs.buildTypeId, void 0, trigger, {
39219
- headers: { "Content-Type": "application/json", Accept: "application/json" }
39220
- });
39304
+ await adapter.modules.buildTypes.addTriggerToBuildType(
39305
+ typedArgs.buildTypeId,
39306
+ void 0,
39307
+ trigger,
39308
+ {
39309
+ headers: { "Content-Type": "application/json", Accept: "application/json" }
39310
+ }
39311
+ );
39221
39312
  return json({
39222
39313
  success: true,
39223
39314
  action: "add_build_trigger",
@@ -39232,7 +39323,10 @@ var FULL_MODE_TOOLS = [
39232
39323
  error: "Trigger ID is required for delete action"
39233
39324
  });
39234
39325
  }
39235
- await api.buildTypes.deleteTrigger(typedArgs.buildTypeId, typedArgs.triggerId);
39326
+ await adapter.modules.buildTypes.deleteTrigger(
39327
+ typedArgs.buildTypeId,
39328
+ typedArgs.triggerId
39329
+ );
39236
39330
  return json({
39237
39331
  success: true,
39238
39332
  action: "delete_build_trigger",
@@ -39272,21 +39366,21 @@ var FULL_MODE_TOOLS = [
39272
39366
  "set_build_configs_paused",
39273
39367
  schema,
39274
39368
  async (typed) => {
39275
- const api = TeamCityAPI.getInstance();
39369
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39276
39370
  let updated = 0;
39277
39371
  for (const id of typed.buildTypeIds) {
39278
- await api.buildTypes.setBuildTypeField(id, "paused", String(typed.paused));
39372
+ await adapter.modules.buildTypes.setBuildTypeField(id, "paused", String(typed.paused));
39279
39373
  updated += 1;
39280
39374
  }
39281
39375
  let canceled = 0;
39282
39376
  if (typed.cancelQueued) {
39283
- const queue = await api.buildQueue.getAllQueuedBuilds();
39377
+ const queue = await adapter.modules.buildQueue.getAllQueuedBuilds();
39284
39378
  const builds = queue.data?.build ?? [];
39285
39379
  const ids = new Set(typed.buildTypeIds);
39286
39380
  const toCancel = builds.filter((b) => b.buildTypeId && ids.has(b.buildTypeId));
39287
39381
  for (const b of toCancel) {
39288
39382
  if (b.id == null) continue;
39289
- await api.buildQueue.deleteQueuedBuild(String(b.id));
39383
+ await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
39290
39384
  canceled += 1;
39291
39385
  }
39292
39386
  }
@@ -39352,7 +39446,7 @@ var FULL_MODE_TOOLS = [
39352
39446
  "mute_tests",
39353
39447
  schema,
39354
39448
  async (typed) => {
39355
- const api = TeamCityAPI.getInstance();
39449
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39356
39450
  let scope;
39357
39451
  if (typed.buildTypeId) {
39358
39452
  scope = { buildType: { id: typed.buildTypeId } };
@@ -39375,7 +39469,7 @@ var FULL_MODE_TOOLS = [
39375
39469
  }
39376
39470
  ]
39377
39471
  };
39378
- const response = await api.mutes.muteMultipleTests(typed.fields, payload, {
39472
+ const response = await adapter.modules.mutes.muteMultipleTests(typed.fields, payload, {
39379
39473
  headers: {
39380
39474
  "Content-Type": "application/json",
39381
39475
  Accept: "application/json"
@@ -39410,8 +39504,8 @@ var FULL_MODE_TOOLS = [
39410
39504
  "move_queued_build_to_top",
39411
39505
  schema,
39412
39506
  async (typed) => {
39413
- const api = TeamCityAPI.getInstance();
39414
- await api.buildQueue.setQueuedBuildsOrder(void 0, {
39507
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39508
+ await adapter.modules.buildQueue.setQueuedBuildsOrder(void 0, {
39415
39509
  build: [{ id: parseInt(typed.buildId) }]
39416
39510
  });
39417
39511
  return json({
@@ -39439,8 +39533,8 @@ var FULL_MODE_TOOLS = [
39439
39533
  "reorder_queued_builds",
39440
39534
  schema,
39441
39535
  async (typed) => {
39442
- const api = TeamCityAPI.getInstance();
39443
- await api.buildQueue.setQueuedBuildsOrder(void 0, {
39536
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39537
+ await adapter.modules.buildQueue.setQueuedBuildsOrder(void 0, {
39444
39538
  build: typed.buildIds.map((id) => ({ id: parseInt(id) }))
39445
39539
  });
39446
39540
  return json({
@@ -39468,14 +39562,14 @@ var FULL_MODE_TOOLS = [
39468
39562
  "cancel_queued_builds_for_build_type",
39469
39563
  schema,
39470
39564
  async (typed) => {
39471
- const api = TeamCityAPI.getInstance();
39472
- const queue = await api.buildQueue.getAllQueuedBuilds();
39565
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39566
+ const queue = await adapter.modules.buildQueue.getAllQueuedBuilds();
39473
39567
  const builds = queue.data?.build ?? [];
39474
39568
  const toCancel = builds.filter((b) => b.buildTypeId === typed.buildTypeId);
39475
39569
  let canceled = 0;
39476
39570
  for (const b of toCancel) {
39477
39571
  if (b.id == null) continue;
39478
- await api.buildQueue.deleteQueuedBuild(String(b.id));
39572
+ await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
39479
39573
  canceled += 1;
39480
39574
  }
39481
39575
  return json({
@@ -39504,13 +39598,13 @@ var FULL_MODE_TOOLS = [
39504
39598
  "cancel_queued_builds_by_locator",
39505
39599
  schema,
39506
39600
  async (typed) => {
39507
- const api = TeamCityAPI.getInstance();
39508
- const queue = await api.buildQueue.getAllQueuedBuilds(typed.locator);
39601
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39602
+ const queue = await adapter.modules.buildQueue.getAllQueuedBuilds(typed.locator);
39509
39603
  const builds = queue.data?.build ?? [];
39510
39604
  let canceled = 0;
39511
39605
  for (const b of builds) {
39512
39606
  if (b.id == null) continue;
39513
- await api.buildQueue.deleteQueuedBuild(String(b.id));
39607
+ await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
39514
39608
  canceled += 1;
39515
39609
  }
39516
39610
  return json({
@@ -39553,8 +39647,10 @@ var FULL_MODE_TOOLS = [
39553
39647
  "pause_queue_for_pool",
39554
39648
  schema,
39555
39649
  async (typed) => {
39556
- const api = TeamCityAPI.getInstance();
39557
- const agentsResp = await api.agents.getAllAgents(`agentPool:(id:${typed.poolId})`);
39650
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39651
+ const agentsResp = await adapter.modules.agents.getAllAgents(
39652
+ `agentPool:(id:${typed.poolId})`
39653
+ );
39558
39654
  const agents = agentsResp.data?.agent ?? [];
39559
39655
  const body = {
39560
39656
  status: false
@@ -39565,21 +39661,21 @@ var FULL_MODE_TOOLS = [
39565
39661
  for (const a of agents) {
39566
39662
  const id = a.id;
39567
39663
  if (!id) continue;
39568
- await api.agents.setEnabledInfo(id, void 0, body, {
39664
+ await adapter.modules.agents.setEnabledInfo(id, void 0, body, {
39569
39665
  headers: { "Content-Type": "application/json", Accept: "application/json" }
39570
39666
  });
39571
39667
  disabled += 1;
39572
39668
  }
39573
39669
  let canceled = 0;
39574
39670
  if (typed.cancelQueuedForBuildTypeId) {
39575
- const queue = await api.buildQueue.getAllQueuedBuilds();
39671
+ const queue = await adapter.modules.buildQueue.getAllQueuedBuilds();
39576
39672
  const builds = queue.data?.build ?? [];
39577
39673
  const toCancel = builds.filter(
39578
39674
  (b) => b.buildTypeId === typed.cancelQueuedForBuildTypeId
39579
39675
  );
39580
39676
  for (const b of toCancel) {
39581
39677
  if (b.id == null) continue;
39582
- await api.buildQueue.deleteQueuedBuild(String(b.id));
39678
+ await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
39583
39679
  canceled += 1;
39584
39680
  }
39585
39681
  }
@@ -39610,14 +39706,16 @@ var FULL_MODE_TOOLS = [
39610
39706
  "resume_queue_for_pool",
39611
39707
  schema,
39612
39708
  async (typed) => {
39613
- const api = TeamCityAPI.getInstance();
39614
- const agentsResp = await api.agents.getAllAgents(`agentPool:(id:${typed.poolId})`);
39709
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39710
+ const agentsResp = await adapter.modules.agents.getAllAgents(
39711
+ `agentPool:(id:${typed.poolId})`
39712
+ );
39615
39713
  const agents = agentsResp.data?.agent ?? [];
39616
39714
  let enabled = 0;
39617
39715
  for (const a of agents) {
39618
39716
  const id = a.id;
39619
39717
  if (!id) continue;
39620
- await api.agents.setEnabledInfo(
39718
+ await adapter.modules.agents.setEnabledInfo(
39621
39719
  id,
39622
39720
  void 0,
39623
39721
  { status: true },
@@ -39665,11 +39763,11 @@ var FULL_MODE_TOOLS = [
39665
39763
  "set_agent_enabled",
39666
39764
  schema,
39667
39765
  async (typed) => {
39668
- const api = TeamCityAPI.getInstance();
39766
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39669
39767
  const body = { status: typed.enabled };
39670
39768
  if (typed.comment) body.comment = { text: typed.comment };
39671
39769
  if (typed.until) body.statusSwitchTime = typed.until;
39672
- const resp = await api.agents.setEnabledInfo(typed.agentId, void 0, body, {
39770
+ const resp = await adapter.modules.agents.setEnabledInfo(typed.agentId, void 0, body, {
39673
39771
  headers: { "Content-Type": "application/json", Accept: "application/json" }
39674
39772
  });
39675
39773
  return json({
@@ -39724,13 +39822,13 @@ var FULL_MODE_TOOLS = [
39724
39822
  "bulk_set_agents_enabled",
39725
39823
  schema,
39726
39824
  async (typed) => {
39727
- const api = TeamCityAPI.getInstance();
39825
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39728
39826
  const filters = [];
39729
39827
  if (typed.poolId) filters.push(`agentPool:(id:${typed.poolId})`);
39730
39828
  if (typed.locator) filters.push(typed.locator);
39731
39829
  if (typed.includeDisabled === false) filters.push("enabled:true");
39732
39830
  const locator = filters.join(",");
39733
- const list = await api.agents.getAllAgents(locator);
39831
+ const list = await adapter.modules.agents.getAllAgents(locator);
39734
39832
  const agents = list.data?.agent ?? [];
39735
39833
  const body = { status: typed.enabled };
39736
39834
  if (typed.comment) body.comment = { text: typed.comment };
@@ -39740,7 +39838,7 @@ var FULL_MODE_TOOLS = [
39740
39838
  const id = String(a.id ?? "");
39741
39839
  if (!id) continue;
39742
39840
  try {
39743
- await api.agents.setEnabledInfo(id, void 0, body, {
39841
+ await adapter.modules.agents.setEnabledInfo(id, void 0, body, {
39744
39842
  headers: {
39745
39843
  "Content-Type": "application/json",
39746
39844
  Accept: "application/json"