@daghis/teamcity-mcp 1.3.3 → 1.3.4

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
@@ -1692,6 +1692,7 @@ var BuildResultsManager = class _BuildResultsManager {
1692
1692
 
1693
1693
  // src/teamcity/client-adapter.ts
1694
1694
  var import_axios = __toESM(require("axios"));
1695
+ var FALLBACK_BASE_URL = "http://not-configured";
1695
1696
  var resolveModules = (api) => {
1696
1697
  const candidate = api.modules;
1697
1698
  if (candidate != null) {
@@ -1735,9 +1736,11 @@ var resolveModules = (api) => {
1735
1736
  };
1736
1737
  function createAdapterFromTeamCityAPI(api, options = {}) {
1737
1738
  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);
1739
+ const getBaseUrl = api.getBaseUrl;
1740
+ const inferredBaseUrl = typeof getBaseUrl === "function" ? getBaseUrl.call(api) : void 0;
1741
+ const fallbackBaseUrl = inferredBaseUrl ?? options.apiConfig?.baseUrl ?? api.http?.defaults?.baseURL ?? FALLBACK_BASE_URL;
1742
+ const httpInstance = api.http ?? import_axios.default.create({ baseURL: fallbackBaseUrl });
1743
+ const fallbackApiConfig = resolveApiClientConfigFromApi(api, httpInstance, fallbackBaseUrl);
1741
1744
  const resolvedApiConfig = {
1742
1745
  baseUrl: options.apiConfig?.baseUrl ?? fallbackApiConfig.baseUrl,
1743
1746
  token: options.apiConfig?.token ?? fallbackApiConfig.token,
@@ -1750,7 +1753,13 @@ function createAdapterFromTeamCityAPI(api, options = {}) {
1750
1753
  timeout: resolvedApiConfig.timeout
1751
1754
  }
1752
1755
  };
1753
- const request = async (fn) => fn({ axios: httpInstance, baseUrl, requestId: void 0 });
1756
+ if (fallbackBaseUrl === FALLBACK_BASE_URL && resolvedApiConfig.baseUrl === FALLBACK_BASE_URL) {
1757
+ warn("TeamCity adapter using fallback baseUrl placeholder", {
1758
+ reason: "missing_base_url",
1759
+ hasApiConfig: Boolean(options.apiConfig)
1760
+ });
1761
+ }
1762
+ const request = async (fn) => fn({ axios: httpInstance, baseUrl: resolvedApiConfig.baseUrl, requestId: void 0 });
1754
1763
  const buildApi = modules.builds;
1755
1764
  return {
1756
1765
  modules,
@@ -1759,7 +1768,7 @@ function createAdapterFromTeamCityAPI(api, options = {}) {
1759
1768
  getConfig: () => resolvedFullConfig,
1760
1769
  getApiConfig: () => resolvedApiConfig,
1761
1770
  getAxios: () => httpInstance,
1762
- testConnection: () => api.testConnection(),
1771
+ testConnection: () => typeof api.testConnection === "function" ? api.testConnection() : Promise.resolve(true),
1763
1772
  listProjects: (locator) => api.listProjects(locator),
1764
1773
  getProject: (projectId) => api.getProject(projectId),
1765
1774
  listBuilds: (locator) => api.listBuilds(locator),
@@ -1779,16 +1788,18 @@ function createAdapterFromTeamCityAPI(api, options = {}) {
1779
1788
  listVcsRoots: (projectId) => api.listVcsRoots(projectId),
1780
1789
  listAgents: () => api.listAgents(),
1781
1790
  listAgentPools: () => api.listAgentPools(),
1782
- baseUrl
1791
+ baseUrl: resolvedApiConfig.baseUrl
1783
1792
  };
1784
1793
  }
1785
1794
  var isAxiosHeadersRecord = (value) => typeof value === "object" && value !== null;
1786
- var resolveApiClientConfigFromApi = (api, http) => {
1795
+ var resolveApiClientConfigFromApi = (api, http, baseUrlFallback) => {
1787
1796
  const timeout = resolveTimeout(http);
1788
1797
  const authHeader = getAuthorizationHeader(http);
1789
1798
  const token = stripBearerPrefix(authHeader);
1799
+ const getBaseUrl = api.getBaseUrl;
1800
+ const resolvedBaseUrl = typeof getBaseUrl === "function" ? getBaseUrl.call(api) : http.defaults.baseURL ?? baseUrlFallback;
1790
1801
  return {
1791
- baseUrl: api.getBaseUrl(),
1802
+ baseUrl: typeof resolvedBaseUrl === "string" && resolvedBaseUrl.length > 0 ? resolvedBaseUrl : baseUrlFallback,
1792
1803
  token: token ?? "",
1793
1804
  timeout
1794
1805
  };
@@ -36470,7 +36481,7 @@ var DEV_TOOLS = [
36470
36481
  "list_projects",
36471
36482
  schema,
36472
36483
  async (typed) => {
36473
- const api = TeamCityAPI.getInstance();
36484
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36474
36485
  const baseParts = [];
36475
36486
  if (typed.locator) baseParts.push(typed.locator);
36476
36487
  if (typed.parentProjectId) baseParts.push(`parent:(id:${typed.parentProjectId})`);
@@ -36480,7 +36491,10 @@ var DEV_TOOLS = [
36480
36491
  if (typeof count === "number") parts.push(`count:${count}`);
36481
36492
  if (typeof start === "number") parts.push(`start:${start}`);
36482
36493
  const locator = parts.length > 0 ? parts.join(",") : void 0;
36483
- return api.projects.getAllProjects(locator, typed.fields);
36494
+ return adapter.modules.projects.getAllProjects(
36495
+ locator,
36496
+ typed.fields
36497
+ );
36484
36498
  };
36485
36499
  const fetcher = createPaginatedFetcher(
36486
36500
  baseFetch,
@@ -36520,8 +36534,8 @@ var DEV_TOOLS = [
36520
36534
  "get_project",
36521
36535
  schema,
36522
36536
  async (typed) => {
36523
- const api = TeamCityAPI.getInstance();
36524
- const project = await api.getProject(typed.projectId);
36537
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36538
+ const project = await adapter.getProject(typed.projectId);
36525
36539
  return json(project);
36526
36540
  },
36527
36541
  args
@@ -36569,7 +36583,7 @@ var DEV_TOOLS = [
36569
36583
  "list_builds",
36570
36584
  schema,
36571
36585
  async (typed) => {
36572
- const api = TeamCityAPI.getInstance();
36586
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36573
36587
  const baseParts = [];
36574
36588
  if (typed.locator) baseParts.push(typed.locator);
36575
36589
  if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
@@ -36581,7 +36595,7 @@ var DEV_TOOLS = [
36581
36595
  if (typeof count === "number") parts.push(`count:${count}`);
36582
36596
  if (typeof start === "number") parts.push(`start:${start}`);
36583
36597
  const locator = parts.length > 0 ? parts.join(",") : void 0;
36584
- return api.builds.getAllBuilds(locator, typed.fields);
36598
+ return adapter.modules.builds.getAllBuilds(locator, typed.fields);
36585
36599
  };
36586
36600
  const fetcher = createPaginatedFetcher(
36587
36601
  baseFetch,
@@ -36624,8 +36638,8 @@ var DEV_TOOLS = [
36624
36638
  "get_build",
36625
36639
  schema,
36626
36640
  async (typed) => {
36627
- const api = TeamCityAPI.getInstance();
36628
- const build = await api.getBuild(typed.buildId);
36641
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36642
+ const build = await adapter.getBuild(typed.buildId);
36629
36643
  return json(build);
36630
36644
  },
36631
36645
  args
@@ -36654,9 +36668,9 @@ var DEV_TOOLS = [
36654
36668
  "trigger_build",
36655
36669
  schema,
36656
36670
  async (typed) => {
36657
- const api = TeamCityAPI.getInstance();
36671
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36658
36672
  try {
36659
- const build = await api.triggerBuild(
36673
+ const build = await adapter.triggerBuild(
36660
36674
  typed.buildTypeId,
36661
36675
  typed.branchName,
36662
36676
  typed.comment
@@ -36672,9 +36686,13 @@ var DEV_TOOLS = [
36672
36686
  const branchPart = typed.branchName ? `<branchName>${typed.branchName}</branchName>` : "";
36673
36687
  const commentPart = typed.comment ? `<comment><text>${typed.comment.replace(/</g, "&lt;").replace(/>/g, "&gt;")}</text></comment>` : "";
36674
36688
  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
- });
36689
+ const response = await adapter.modules.buildQueue.addBuildToQueue(
36690
+ false,
36691
+ xml,
36692
+ {
36693
+ headers: { "Content-Type": "application/xml", Accept: "application/json" }
36694
+ }
36695
+ );
36678
36696
  const build = response.data;
36679
36697
  return json({
36680
36698
  success: true,
@@ -36705,8 +36723,8 @@ var DEV_TOOLS = [
36705
36723
  "cancel_queued_build",
36706
36724
  schema,
36707
36725
  async (typed) => {
36708
- const api = TeamCityAPI.getInstance();
36709
- await api.buildQueue.deleteQueuedBuild(typed.buildId);
36726
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36727
+ await adapter.modules.buildQueue.deleteQueuedBuild(typed.buildId);
36710
36728
  return json({ success: true, action: "cancel_queued_build", buildId: typed.buildId });
36711
36729
  },
36712
36730
  args
@@ -36746,8 +36764,8 @@ var DEV_TOOLS = [
36746
36764
  "get_build_status",
36747
36765
  schema,
36748
36766
  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));
36767
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36768
+ const statusManager = new (await Promise.resolve().then(() => (init_build_status_manager(), build_status_manager_exports))).BuildStatusManager(adapter);
36751
36769
  const result = await statusManager.getBuildStatus({
36752
36770
  buildId: typed.buildId,
36753
36771
  includeTests: typed.includeTests,
@@ -36760,14 +36778,17 @@ var DEV_TOOLS = [
36760
36778
  }
36761
36779
  if (typed.includeQueueTotals) {
36762
36780
  try {
36763
- const countResp = await api.buildQueue.getAllQueuedBuilds(void 0, "count");
36781
+ const countResp = await adapter.modules.buildQueue.getAllQueuedBuilds(
36782
+ void 0,
36783
+ "count"
36784
+ );
36764
36785
  enrich.totalQueued = countResp.data.count;
36765
36786
  } catch {
36766
36787
  }
36767
36788
  }
36768
36789
  if (typed.includeQueueReason) {
36769
36790
  try {
36770
- const qb = await api.buildQueue.getQueuedBuild(typed.buildId);
36791
+ const qb = await adapter.modules.buildQueue.getQueuedBuild(typed.buildId);
36771
36792
  enrich.waitReason = qb.data.waitReason;
36772
36793
  } catch {
36773
36794
  }
@@ -36820,7 +36841,7 @@ var DEV_TOOLS = [
36820
36841
  "fetch_build_log",
36821
36842
  schema,
36822
36843
  async (typed) => {
36823
- const api = TeamCityAPI.getInstance();
36844
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36824
36845
  let effectiveBuildId;
36825
36846
  if (typed.buildId) {
36826
36847
  effectiveBuildId = typed.buildId;
@@ -36832,11 +36853,11 @@ var DEV_TOOLS = [
36832
36853
  baseLocatorParts.push(`number:${numberStr}`);
36833
36854
  baseLocatorParts.push("count:10");
36834
36855
  const locator = baseLocatorParts.join(",");
36835
- const resp = await api.listBuilds(locator);
36856
+ const resp = await adapter.listBuilds(locator);
36836
36857
  const builds = Array.isArray(resp.build) ? resp.build : [];
36837
36858
  if (builds.length === 0) {
36838
36859
  if (typed.buildTypeId) {
36839
- const recent = await api.listBuilds(
36860
+ const recent = await adapter.listBuilds(
36840
36861
  `buildType:(id:${typed.buildTypeId}),branch:default:any,count:100`
36841
36862
  );
36842
36863
  const items = Array.isArray(recent.build) ? recent.build : [];
@@ -36897,7 +36918,7 @@ var DEV_TOOLS = [
36897
36918
  const attemptFetch = async () => {
36898
36919
  if (typed.tail) {
36899
36920
  const count = typed.lineCount ?? typed.pageSize ?? 500;
36900
- const full = await api.getBuildLog(effectiveBuildId);
36921
+ const full = await adapter.getBuildLog(effectiveBuildId);
36901
36922
  const allLines = full.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
36902
36923
  if (allLines.length > 0 && allLines[allLines.length - 1] === "") allLines.pop();
36903
36924
  const total = allLines.length;
@@ -36919,7 +36940,7 @@ var DEV_TOOLS = [
36919
36940
  }
36920
36941
  const effectivePageSize = typed.lineCount ?? typed.pageSize ?? 500;
36921
36942
  const startLine = typeof typed.startLine === "number" ? typed.startLine : ((typed.page ?? 1) - 1) * effectivePageSize;
36922
- const chunk = await api.getBuildLogChunk(effectiveBuildId, {
36943
+ const chunk = await adapter.getBuildLogChunk(effectiveBuildId, {
36923
36944
  startLine,
36924
36945
  lineCount: effectivePageSize
36925
36946
  });
@@ -36991,7 +37012,7 @@ var DEV_TOOLS = [
36991
37012
  "list_build_configs",
36992
37013
  schema,
36993
37014
  async (typed) => {
36994
- const api = TeamCityAPI.getInstance();
37015
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
36995
37016
  const baseParts = [];
36996
37017
  if (typed.locator) baseParts.push(typed.locator);
36997
37018
  if (typed.projectId) baseParts.push(`affectedProject:(id:${typed.projectId})`);
@@ -37001,7 +37022,10 @@ var DEV_TOOLS = [
37001
37022
  if (typeof count === "number") parts.push(`count:${count}`);
37002
37023
  if (typeof start === "number") parts.push(`start:${start}`);
37003
37024
  const locator = parts.length > 0 ? parts.join(",") : void 0;
37004
- return api.buildTypes.getAllBuildTypes(locator, typed.fields);
37025
+ return adapter.modules.buildTypes.getAllBuildTypes(
37026
+ locator,
37027
+ typed.fields
37028
+ );
37005
37029
  };
37006
37030
  const fetcher = createPaginatedFetcher(
37007
37031
  baseFetch,
@@ -37041,8 +37065,8 @@ var DEV_TOOLS = [
37041
37065
  "get_build_config",
37042
37066
  schema,
37043
37067
  async (typed) => {
37044
- const api = TeamCityAPI.getInstance();
37045
- const buildType = await api.getBuildType(typed.buildTypeId);
37068
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37069
+ const buildType = await adapter.getBuildType(typed.buildTypeId);
37046
37070
  return json(buildType);
37047
37071
  },
37048
37072
  args
@@ -37079,14 +37103,14 @@ var DEV_TOOLS = [
37079
37103
  "list_test_failures",
37080
37104
  schema,
37081
37105
  async (typed) => {
37082
- const api = TeamCityAPI.getInstance();
37106
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37083
37107
  const pageSize = typed.pageSize ?? 100;
37084
37108
  const baseFetch = async ({ count, start }) => {
37085
37109
  const parts = [`build:(id:${typed.buildId})`, "status:FAILURE"];
37086
37110
  if (typeof count === "number") parts.push(`count:${count}`);
37087
37111
  if (typeof start === "number") parts.push(`start:${start}`);
37088
37112
  const locator = parts.join(",");
37089
- return api.tests.getAllTestOccurrences(locator, typed.fields);
37113
+ return adapter.modules.tests.getAllTestOccurrences(locator, typed.fields);
37090
37114
  };
37091
37115
  const fetcher = createPaginatedFetcher(
37092
37116
  baseFetch,
@@ -37139,7 +37163,7 @@ var DEV_TOOLS = [
37139
37163
  "list_vcs_roots",
37140
37164
  schema,
37141
37165
  async (typed) => {
37142
- const api = TeamCityAPI.getInstance();
37166
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37143
37167
  const baseParts = [];
37144
37168
  if (typed.projectId) baseParts.push(`affectedProject:(id:${typed.projectId})`);
37145
37169
  const pageSize = typed.pageSize ?? 100;
@@ -37148,7 +37172,10 @@ var DEV_TOOLS = [
37148
37172
  if (typeof count === "number") parts.push(`count:${count}`);
37149
37173
  if (typeof start === "number") parts.push(`start:${start}`);
37150
37174
  const locator = parts.length > 0 ? parts.join(",") : void 0;
37151
- return api.vcsRoots.getAllVcsRoots(locator, typed.fields);
37175
+ return adapter.modules.vcsRoots.getAllVcsRoots(
37176
+ locator,
37177
+ typed.fields
37178
+ );
37152
37179
  };
37153
37180
  const fetcher = createPaginatedFetcher(
37154
37181
  baseFetch,
@@ -37188,10 +37215,10 @@ var DEV_TOOLS = [
37188
37215
  "get_vcs_root",
37189
37216
  schema,
37190
37217
  async (typed) => {
37191
- const api = TeamCityAPI.getInstance();
37192
- const listing = await api.vcsRoots.getAllVcsRoots(`id:${typed.id}`);
37218
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37219
+ const listing = await adapter.modules.vcsRoots.getAllVcsRoots(`id:${typed.id}`);
37193
37220
  const rootEntry = listing.data.vcsRoot?.[0];
37194
- const props = await api.vcsRoots.getAllVcsRootProperties(typed.id);
37221
+ const props = await adapter.modules.vcsRoots.getAllVcsRootProperties(typed.id);
37195
37222
  return json({
37196
37223
  id: rootEntry?.id ?? typed.id,
37197
37224
  name: rootEntry?.name,
@@ -37225,8 +37252,8 @@ var DEV_TOOLS = [
37225
37252
  "set_vcs_root_property",
37226
37253
  schema,
37227
37254
  async (typed) => {
37228
- const api = TeamCityAPI.getInstance();
37229
- await api.vcsRoots.setVcsRootProperty(typed.id, typed.name, typed.value, {
37255
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37256
+ await adapter.modules.vcsRoots.setVcsRootProperty(typed.id, typed.name, typed.value, {
37230
37257
  headers: { "Content-Type": "text/plain", Accept: "text/plain" }
37231
37258
  });
37232
37259
  return json({
@@ -37258,8 +37285,8 @@ var DEV_TOOLS = [
37258
37285
  "delete_vcs_root_property",
37259
37286
  schema,
37260
37287
  async (typed) => {
37261
- const api = TeamCityAPI.getInstance();
37262
- await api.vcsRoots.deleteVcsRootProperty(typed.id, typed.name);
37288
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37289
+ await adapter.modules.vcsRoots.deleteVcsRootProperty(typed.id, typed.name);
37263
37290
  return json({
37264
37291
  success: true,
37265
37292
  action: "delete_vcs_root_property",
@@ -37303,7 +37330,7 @@ var DEV_TOOLS = [
37303
37330
  "update_vcs_root_properties",
37304
37331
  schema,
37305
37332
  async (typed) => {
37306
- const api = TeamCityAPI.getInstance();
37333
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37307
37334
  const properties = [];
37308
37335
  if (typeof typed.url === "string") properties.push({ name: "url", value: typed.url });
37309
37336
  if (typeof typed.branch === "string")
@@ -37322,7 +37349,7 @@ var DEV_TOOLS = [
37322
37349
  updated: 0
37323
37350
  });
37324
37351
  }
37325
- await api.vcsRoots.setVcsRootProperties(
37352
+ await adapter.modules.vcsRoots.setVcsRootProperties(
37326
37353
  typed.id,
37327
37354
  void 0,
37328
37355
  { property: properties },
@@ -37372,7 +37399,7 @@ var DEV_TOOLS = [
37372
37399
  "list_queued_builds",
37373
37400
  schema,
37374
37401
  async (typed) => {
37375
- const api = TeamCityAPI.getInstance();
37402
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37376
37403
  const baseParts = [];
37377
37404
  if (typed.locator) baseParts.push(typed.locator);
37378
37405
  const pageSize = typed.pageSize ?? 100;
@@ -37381,7 +37408,10 @@ var DEV_TOOLS = [
37381
37408
  if (typeof count === "number") parts.push(`count:${count}`);
37382
37409
  if (typeof start === "number") parts.push(`start:${start}`);
37383
37410
  const locator = parts.length > 0 ? parts.join(",") : void 0;
37384
- return api.buildQueue.getAllQueuedBuilds(locator, typed.fields);
37411
+ return adapter.modules.buildQueue.getAllQueuedBuilds(
37412
+ locator,
37413
+ typed.fields
37414
+ );
37385
37415
  };
37386
37416
  const fetcher = createPaginatedFetcher(
37387
37417
  baseFetch,
@@ -37415,8 +37445,8 @@ var DEV_TOOLS = [
37415
37445
  "get_server_metrics",
37416
37446
  null,
37417
37447
  async () => {
37418
- const api = TeamCityAPI.getInstance();
37419
- const metrics = await api.server.getAllMetrics();
37448
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37449
+ const metrics = await adapter.modules.server.getAllMetrics();
37420
37450
  return json(metrics.data);
37421
37451
  },
37422
37452
  {}
@@ -37433,8 +37463,8 @@ var DEV_TOOLS = [
37433
37463
  "get_server_info",
37434
37464
  null,
37435
37465
  async () => {
37436
- const api = TeamCityAPI.getInstance();
37437
- const info2 = await api.server.getServerInfo();
37466
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37467
+ const info2 = await adapter.modules.server.getServerInfo();
37438
37468
  return json(info2.data);
37439
37469
  },
37440
37470
  {}
@@ -37459,19 +37489,19 @@ var DEV_TOOLS = [
37459
37489
  "list_server_health_items",
37460
37490
  schema,
37461
37491
  async (typed) => {
37462
- const api = TeamCityAPI.getInstance();
37492
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37463
37493
  const normalized = (() => {
37464
37494
  const raw = typeof typed.locator === "string" ? typed.locator.trim() : void 0;
37465
37495
  if (!raw || raw.length === 0) return void 0;
37466
37496
  return raw.replace(/category:\s*\((ERROR|WARNING|INFO)\)/g, "category:$1");
37467
37497
  })();
37468
37498
  try {
37469
- const response = await api.health.getHealthItems(normalized);
37499
+ const response = await adapter.modules.health.getHealthItems(normalized);
37470
37500
  return json(response.data);
37471
37501
  } catch (err) {
37472
37502
  const isHttp400 = err?.statusCode === 400 || err?.code === "VALIDATION_ERROR";
37473
37503
  if (!isHttp400) throw err;
37474
- const all = await api.health.getHealthItems();
37504
+ const all = await adapter.modules.health.getHealthItems();
37475
37505
  const rawItems = all.data?.healthItem ?? [];
37476
37506
  const filter = (item) => {
37477
37507
  if (!normalized) return true;
@@ -37520,8 +37550,8 @@ var DEV_TOOLS = [
37520
37550
  "get_server_health_item",
37521
37551
  schema,
37522
37552
  async (typed) => {
37523
- const api = TeamCityAPI.getInstance();
37524
- const response = await api.health.getSingleHealthItem(typed.locator);
37553
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37554
+ const response = await adapter.modules.health.getSingleHealthItem(typed.locator);
37525
37555
  return json(response.data);
37526
37556
  },
37527
37557
  args
@@ -37548,8 +37578,8 @@ var DEV_TOOLS = [
37548
37578
  "check_availability_guard",
37549
37579
  schema,
37550
37580
  async (typed) => {
37551
- const api = TeamCityAPI.getInstance();
37552
- const resp = await api.health.getHealthItems();
37581
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37582
+ const resp = await adapter.modules.health.getHealthItems();
37553
37583
  const items = resp.data?.healthItem ?? [];
37554
37584
  const critical = items.filter((i) => i.severity === "ERROR");
37555
37585
  const warnings = items.filter((i) => i.severity === "WARNING");
@@ -37575,8 +37605,8 @@ var DEV_TOOLS = [
37575
37605
  "get_compatible_build_types_for_agent",
37576
37606
  schema,
37577
37607
  async (typed) => {
37578
- const api = TeamCityAPI.getInstance();
37579
- const resp = await api.agents.getCompatibleBuildTypes(typed.agentId);
37608
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37609
+ const resp = await adapter.modules.agents.getCompatibleBuildTypes(typed.agentId);
37580
37610
  return json(resp.data);
37581
37611
  },
37582
37612
  args
@@ -37597,8 +37627,8 @@ var DEV_TOOLS = [
37597
37627
  "get_incompatible_build_types_for_agent",
37598
37628
  schema,
37599
37629
  async (typed) => {
37600
- const api = TeamCityAPI.getInstance();
37601
- const resp = await api.agents.getIncompatibleBuildTypes(typed.agentId);
37630
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37631
+ const resp = await adapter.modules.agents.getIncompatibleBuildTypes(typed.agentId);
37602
37632
  return json(resp.data);
37603
37633
  },
37604
37634
  args
@@ -37619,8 +37649,8 @@ var DEV_TOOLS = [
37619
37649
  "get_agent_enabled_info",
37620
37650
  schema,
37621
37651
  async (typed) => {
37622
- const api = TeamCityAPI.getInstance();
37623
- const resp = await api.agents.getEnabledInfo(typed.agentId);
37652
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37653
+ const resp = await adapter.modules.agents.getEnabledInfo(typed.agentId);
37624
37654
  return json(resp.data);
37625
37655
  },
37626
37656
  args
@@ -37650,11 +37680,11 @@ var DEV_TOOLS = [
37650
37680
  "get_compatible_agents_for_build_type",
37651
37681
  schema,
37652
37682
  async (typed) => {
37653
- const api = TeamCityAPI.getInstance();
37683
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37654
37684
  const filters = [`compatible:(buildType:${typed.buildTypeId})`];
37655
37685
  if (!typed.includeDisabled) filters.push("enabled:true");
37656
37686
  const locator = filters.join(",");
37657
- const resp = await api.agents.getAllAgents(locator);
37687
+ const resp = await adapter.modules.agents.getAllAgents(locator);
37658
37688
  return json(resp.data);
37659
37689
  },
37660
37690
  args
@@ -37684,11 +37714,11 @@ var DEV_TOOLS = [
37684
37714
  "count_compatible_agents_for_build_type",
37685
37715
  schema,
37686
37716
  async (typed) => {
37687
- const api = TeamCityAPI.getInstance();
37717
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37688
37718
  const parts = [`compatible:(buildType:${typed.buildTypeId})`];
37689
37719
  if (!typed.includeDisabled) parts.push("enabled:true");
37690
37720
  const locator = parts.join(",");
37691
- const resp = await api.agents.getAllAgents(locator, "count");
37721
+ const resp = await adapter.modules.agents.getAllAgents(locator, "count");
37692
37722
  const count = resp.data.count ?? 0;
37693
37723
  return json({ count });
37694
37724
  },
@@ -37719,14 +37749,14 @@ var DEV_TOOLS = [
37719
37749
  "get_compatible_agents_for_queued_build",
37720
37750
  schema,
37721
37751
  async (typed) => {
37722
- const api = TeamCityAPI.getInstance();
37723
- const build = await api.getBuild(typed.buildId);
37752
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37753
+ const build = await adapter.getBuild(typed.buildId);
37724
37754
  const buildTypeId = build.buildTypeId;
37725
37755
  if (!buildTypeId) return json({ items: [], count: 0, note: "Build type ID not found" });
37726
37756
  const parts = [`compatible:(buildType:${buildTypeId})`];
37727
37757
  if (!typed.includeDisabled) parts.push("enabled:true");
37728
37758
  const locator = parts.join(",");
37729
- const resp = await api.agents.getAllAgents(locator);
37759
+ const resp = await adapter.modules.agents.getAllAgents(locator);
37730
37760
  return json(resp.data);
37731
37761
  },
37732
37762
  args
@@ -37738,7 +37768,8 @@ var DEV_TOOLS = [
37738
37768
  description: "Check connectivity to TeamCity server and basic readiness",
37739
37769
  inputSchema: { type: "object", properties: {} },
37740
37770
  handler: async (_args) => {
37741
- const ok = await TeamCityAPI.getInstance().testConnection();
37771
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37772
+ const ok = await adapter.testConnection();
37742
37773
  return json({ ok });
37743
37774
  }
37744
37775
  },
@@ -37771,7 +37802,7 @@ var DEV_TOOLS = [
37771
37802
  "list_agents",
37772
37803
  schema,
37773
37804
  async (typed) => {
37774
- const api = TeamCityAPI.getInstance();
37805
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37775
37806
  const pageSize = typed.pageSize ?? 100;
37776
37807
  const baseFetch = async ({ count, start }) => {
37777
37808
  const parts = [];
@@ -37779,7 +37810,7 @@ var DEV_TOOLS = [
37779
37810
  if (typeof count === "number") parts.push(`count:${count}`);
37780
37811
  if (typeof start === "number") parts.push(`start:${start}`);
37781
37812
  const locator = parts.length > 0 ? parts.join(",") : void 0;
37782
- return api.agents.getAllAgents(locator, typed.fields);
37813
+ return adapter.modules.agents.getAllAgents(locator, typed.fields);
37783
37814
  };
37784
37815
  const fetcher = createPaginatedFetcher(
37785
37816
  baseFetch,
@@ -37829,14 +37860,17 @@ var DEV_TOOLS = [
37829
37860
  "list_agent_pools",
37830
37861
  schema,
37831
37862
  async (typed) => {
37832
- const api = TeamCityAPI.getInstance();
37863
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37833
37864
  const pageSize = typed.pageSize ?? 100;
37834
37865
  const baseFetch = async ({ count, start }) => {
37835
37866
  const parts = [];
37836
37867
  if (typeof count === "number") parts.push(`count:${count}`);
37837
37868
  if (typeof start === "number") parts.push(`start:${start}`);
37838
37869
  const locator = parts.length > 0 ? parts.join(",") : void 0;
37839
- return api.agentPools.getAllAgentPools(locator, typed.fields);
37870
+ return adapter.modules.agentPools.getAllAgentPools(
37871
+ locator,
37872
+ typed.fields
37873
+ );
37840
37874
  };
37841
37875
  const fetcher = createPaginatedFetcher(
37842
37876
  baseFetch,
@@ -37898,8 +37932,8 @@ var DEV_TOOLS = [
37898
37932
  "get_build_results",
37899
37933
  schema,
37900
37934
  async (typed) => {
37901
- const api = TeamCityAPI.getInstance();
37902
- const manager = new BuildResultsManager(createAdapterFromTeamCityAPI(api));
37935
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37936
+ const manager = new BuildResultsManager(adapter);
37903
37937
  const result = await manager.getBuildResults(typed.buildId, {
37904
37938
  includeArtifacts: typed.includeArtifacts,
37905
37939
  includeStatistics: typed.includeStatistics,
@@ -37934,10 +37968,10 @@ var DEV_TOOLS = [
37934
37968
  "get_test_details",
37935
37969
  schema,
37936
37970
  async (typed) => {
37937
- const api = TeamCityAPI.getInstance();
37971
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37938
37972
  let locator = `build:(id:${typed.buildId})`;
37939
37973
  if (typed.testNameId) locator += `,test:(id:${typed.testNameId})`;
37940
- const response = await api.tests.getAllTestOccurrences(locator);
37974
+ const response = await adapter.modules.tests.getAllTestOccurrences(locator);
37941
37975
  return json(response.data);
37942
37976
  },
37943
37977
  args
@@ -37960,10 +37994,10 @@ var DEV_TOOLS = [
37960
37994
  "analyze_build_problems",
37961
37995
  schema,
37962
37996
  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);
37997
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
37998
+ const build = await adapter.getBuild(typed.buildId);
37999
+ const problems = await adapter.modules.builds.getBuildProblems(`id:${typed.buildId}`);
38000
+ const failures = await adapter.listTestFailures(typed.buildId);
37967
38001
  return json({
37968
38002
  buildStatus: build.status,
37969
38003
  statusText: build.statusText,
@@ -38008,7 +38042,7 @@ var DEV_TOOLS = [
38008
38042
  "list_changes",
38009
38043
  schema,
38010
38044
  async (typed) => {
38011
- const api = TeamCityAPI.getInstance();
38045
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38012
38046
  const baseParts = [];
38013
38047
  if (typed.locator) baseParts.push(typed.locator);
38014
38048
  if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
@@ -38019,7 +38053,10 @@ var DEV_TOOLS = [
38019
38053
  if (typeof count === "number") parts.push(`count:${count}`);
38020
38054
  if (typeof start === "number") parts.push(`start:${start}`);
38021
38055
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38022
- return api.changes.getAllChanges(locator, typed.fields);
38056
+ return adapter.modules.changes.getAllChanges(
38057
+ locator,
38058
+ typed.fields
38059
+ );
38023
38060
  };
38024
38061
  const fetcher = createPaginatedFetcher(
38025
38062
  baseFetch,
@@ -38075,7 +38112,7 @@ var DEV_TOOLS = [
38075
38112
  "list_problems",
38076
38113
  schema,
38077
38114
  async (typed) => {
38078
- const api = TeamCityAPI.getInstance();
38115
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38079
38116
  const baseParts = [];
38080
38117
  if (typed.locator) baseParts.push(typed.locator);
38081
38118
  if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
@@ -38086,7 +38123,10 @@ var DEV_TOOLS = [
38086
38123
  if (typeof count === "number") parts.push(`count:${count}`);
38087
38124
  if (typeof start === "number") parts.push(`start:${start}`);
38088
38125
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38089
- return api.problems.getAllBuildProblems(locator, typed.fields);
38126
+ return adapter.modules.problems.getAllBuildProblems(
38127
+ locator,
38128
+ typed.fields
38129
+ );
38090
38130
  };
38091
38131
  const fetcher = createPaginatedFetcher(
38092
38132
  baseFetch,
@@ -38148,7 +38188,7 @@ var DEV_TOOLS = [
38148
38188
  "list_problem_occurrences",
38149
38189
  schema,
38150
38190
  async (typed) => {
38151
- const api = TeamCityAPI.getInstance();
38191
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38152
38192
  const baseParts = [];
38153
38193
  if (typed.locator) baseParts.push(typed.locator);
38154
38194
  if (typed.buildId) baseParts.push(`build:(id:${typed.buildId})`);
@@ -38159,7 +38199,7 @@ var DEV_TOOLS = [
38159
38199
  if (typeof count === "number") parts.push(`count:${count}`);
38160
38200
  if (typeof start === "number") parts.push(`start:${start}`);
38161
38201
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38162
- return api.problemOccurrences.getAllBuildProblemOccurrences(
38202
+ return adapter.modules.problemOccurrences.getAllBuildProblemOccurrences(
38163
38203
  locator,
38164
38204
  typed.fields
38165
38205
  );
@@ -38229,7 +38269,7 @@ var DEV_TOOLS = [
38229
38269
  "list_investigations",
38230
38270
  schema,
38231
38271
  async (typed) => {
38232
- const api = TeamCityAPI.getInstance();
38272
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38233
38273
  const baseParts = [];
38234
38274
  if (typed.locator) baseParts.push(typed.locator);
38235
38275
  if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
@@ -38242,7 +38282,7 @@ var DEV_TOOLS = [
38242
38282
  if (typeof count === "number") parts.push(`count:${count}`);
38243
38283
  if (typeof start === "number") parts.push(`start:${start}`);
38244
38284
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38245
- return api.investigations.getAllInvestigations(
38285
+ return adapter.modules.investigations.getAllInvestigations(
38246
38286
  locator,
38247
38287
  typed.fields
38248
38288
  );
@@ -38306,7 +38346,7 @@ var DEV_TOOLS = [
38306
38346
  "list_muted_tests",
38307
38347
  schema,
38308
38348
  async (typed) => {
38309
- const api = TeamCityAPI.getInstance();
38349
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38310
38350
  const baseParts = [];
38311
38351
  if (typed.locator) baseParts.push(typed.locator);
38312
38352
  if (typed.projectId) baseParts.push(`project:(id:${typed.projectId})`);
@@ -38318,7 +38358,10 @@ var DEV_TOOLS = [
38318
38358
  if (typeof count === "number") parts.push(`count:${count}`);
38319
38359
  if (typeof start === "number") parts.push(`start:${start}`);
38320
38360
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38321
- return api.mutes.getAllMutedTests(locator, typed.fields);
38361
+ return adapter.modules.mutes.getAllMutedTests(
38362
+ locator,
38363
+ typed.fields
38364
+ );
38322
38365
  };
38323
38366
  const fetcher = createPaginatedFetcher(
38324
38367
  baseFetch,
@@ -38368,8 +38411,8 @@ var DEV_TOOLS = [
38368
38411
  "get_versioned_settings_status",
38369
38412
  schema,
38370
38413
  async (typed) => {
38371
- const api = TeamCityAPI.getInstance();
38372
- const response = await api.versionedSettings.getVersionedSettingsStatus(
38414
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38415
+ const response = await adapter.modules.versionedSettings.getVersionedSettingsStatus(
38373
38416
  typed.locator,
38374
38417
  typed.fields
38375
38418
  );
@@ -38409,7 +38452,7 @@ var DEV_TOOLS = [
38409
38452
  "list_users",
38410
38453
  schema,
38411
38454
  async (typed) => {
38412
- const api = TeamCityAPI.getInstance();
38455
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38413
38456
  const baseParts = [];
38414
38457
  if (typed.locator) baseParts.push(typed.locator);
38415
38458
  if (typed.groupId) baseParts.push(`group:(id:${typed.groupId})`);
@@ -38419,7 +38462,7 @@ var DEV_TOOLS = [
38419
38462
  if (typeof count === "number") parts.push(`count:${count}`);
38420
38463
  if (typeof start === "number") parts.push(`start:${start}`);
38421
38464
  const locator = parts.length > 0 ? parts.join(",") : void 0;
38422
- return api.users.getAllUsers(locator, typed.fields);
38465
+ return adapter.modules.users.getAllUsers(locator, typed.fields);
38423
38466
  };
38424
38467
  const fetcher = createPaginatedFetcher(
38425
38468
  baseFetch,
@@ -38461,8 +38504,8 @@ var DEV_TOOLS = [
38461
38504
  "list_roles",
38462
38505
  schema,
38463
38506
  async (typed) => {
38464
- const api = TeamCityAPI.getInstance();
38465
- const response = await api.roles.getRoles(typed.fields);
38507
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38508
+ const response = await adapter.modules.roles.getRoles(typed.fields);
38466
38509
  const roles = response.data?.role ?? [];
38467
38510
  return json({ items: roles, count: roles.length });
38468
38511
  },
@@ -38492,9 +38535,9 @@ var DEV_TOOLS = [
38492
38535
  "list_branches",
38493
38536
  schema,
38494
38537
  async (typed) => {
38495
- const api = TeamCityAPI.getInstance();
38538
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38496
38539
  const locator = typed.buildTypeId ? `buildType:(id:${typed.buildTypeId})` : `project:(id:${typed.projectId})`;
38497
- const builds = await api.listBuilds(`${locator},count:100}`);
38540
+ const builds = await adapter.listBuilds(`${locator},count:100}`);
38498
38541
  const items = Array.isArray(builds.build) ? builds.build : [];
38499
38542
  const branchNames = items.map((b) => b.branchName).filter((n) => typeof n === "string" && n.length > 0);
38500
38543
  const branches = new Set(branchNames);
@@ -38520,8 +38563,8 @@ var DEV_TOOLS = [
38520
38563
  "list_parameters",
38521
38564
  schema,
38522
38565
  async (typed) => {
38523
- const api = TeamCityAPI.getInstance();
38524
- const buildType = await api.getBuildType(typed.buildTypeId);
38566
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38567
+ const buildType = await adapter.getBuildType(typed.buildTypeId);
38525
38568
  return json({
38526
38569
  parameters: buildType.parameters?.property ?? [],
38527
38570
  count: buildType.parameters?.property?.length ?? 0
@@ -38546,10 +38589,10 @@ var DEV_TOOLS = [
38546
38589
  "list_project_hierarchy",
38547
38590
  schema,
38548
38591
  async (typed) => {
38549
- const api = TeamCityAPI.getInstance();
38592
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38550
38593
  const rootId = typed.rootProjectId ?? "_Root";
38551
38594
  async function buildHierarchy(projectId, depth = 0) {
38552
- const response = await api.projects.getProject(projectId);
38595
+ const response = await adapter.modules.projects.getProject(projectId);
38553
38596
  const project = response.data;
38554
38597
  const children = [];
38555
38598
  const maybeChildren = project.projects?.project ?? [];
@@ -38605,14 +38648,14 @@ var FULL_MODE_TOOLS = [
38605
38648
  "create_project",
38606
38649
  schema,
38607
38650
  async (typedArgs) => {
38608
- const api = TeamCityAPI.getInstance();
38651
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38609
38652
  const project = {
38610
38653
  name: typedArgs.name,
38611
38654
  id: typedArgs.id,
38612
38655
  parentProject: { id: typedArgs.parentProjectId ?? "_Root" },
38613
38656
  description: typedArgs.description
38614
38657
  };
38615
- const response = await api.projects.addProject(project, {
38658
+ const response = await adapter.modules.projects.addProject(project, {
38616
38659
  headers: { "Content-Type": "application/json", Accept: "application/json" }
38617
38660
  });
38618
38661
  return json({ success: true, action: "create_project", id: response.data.id });
@@ -38634,8 +38677,8 @@ var FULL_MODE_TOOLS = [
38634
38677
  },
38635
38678
  handler: async (args) => {
38636
38679
  const typedArgs = args;
38637
- const api = TeamCityAPI.getInstance();
38638
- await api.projects.deleteProject(typedArgs.projectId);
38680
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38681
+ await adapter.modules.projects.deleteProject(typedArgs.projectId);
38639
38682
  return json({ success: true, action: "delete_project", id: typedArgs.projectId });
38640
38683
  },
38641
38684
  mode: "full"
@@ -38664,7 +38707,7 @@ var FULL_MODE_TOOLS = [
38664
38707
  "update_project_settings",
38665
38708
  schema,
38666
38709
  async (typedArgs) => {
38667
- const api = TeamCityAPI.getInstance();
38710
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38668
38711
  debug("update_project_settings invoked", {
38669
38712
  projectId: typedArgs.projectId,
38670
38713
  // Only log which fields are present to reduce noise
@@ -38680,7 +38723,11 @@ var FULL_MODE_TOOLS = [
38680
38723
  field: "name",
38681
38724
  valuePreview: typedArgs.name
38682
38725
  });
38683
- await api.projects.setProjectField(typedArgs.projectId, "name", typedArgs.name);
38726
+ await adapter.modules.projects.setProjectField(
38727
+ typedArgs.projectId,
38728
+ "name",
38729
+ typedArgs.name
38730
+ );
38684
38731
  }
38685
38732
  if (typedArgs.description !== void 0) {
38686
38733
  debug("Setting project field", {
@@ -38688,7 +38735,7 @@ var FULL_MODE_TOOLS = [
38688
38735
  field: "description",
38689
38736
  valuePreview: typedArgs.description
38690
38737
  });
38691
- await api.projects.setProjectField(
38738
+ await adapter.modules.projects.setProjectField(
38692
38739
  typedArgs.projectId,
38693
38740
  "description",
38694
38741
  typedArgs.description
@@ -38700,7 +38747,7 @@ var FULL_MODE_TOOLS = [
38700
38747
  field: "archived",
38701
38748
  valuePreview: String(typedArgs.archived)
38702
38749
  });
38703
- await api.projects.setProjectField(
38750
+ await adapter.modules.projects.setProjectField(
38704
38751
  typedArgs.projectId,
38705
38752
  "archived",
38706
38753
  String(typedArgs.archived)
@@ -38741,14 +38788,14 @@ var FULL_MODE_TOOLS = [
38741
38788
  },
38742
38789
  handler: async (args) => {
38743
38790
  const typedArgs = args;
38744
- const api = TeamCityAPI.getInstance();
38791
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38745
38792
  const buildType = {
38746
38793
  name: typedArgs.name,
38747
38794
  id: typedArgs.id,
38748
38795
  project: { id: typedArgs.projectId },
38749
38796
  description: typedArgs.description
38750
38797
  };
38751
- const response = await api.buildTypes.createBuildType(void 0, buildType, {
38798
+ const response = await adapter.modules.buildTypes.createBuildType(void 0, buildType, {
38752
38799
  headers: { "Content-Type": "application/json", Accept: "application/json" }
38753
38800
  });
38754
38801
  return json({ success: true, action: "create_build_config", id: response.data.id });
@@ -38770,15 +38817,15 @@ var FULL_MODE_TOOLS = [
38770
38817
  },
38771
38818
  handler: async (args) => {
38772
38819
  const typedArgs = args;
38773
- const api = TeamCityAPI.getInstance();
38774
- const source = await api.getBuildType(typedArgs.sourceBuildTypeId);
38820
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38821
+ const source = await adapter.getBuildType(typedArgs.sourceBuildTypeId);
38775
38822
  const buildType = {
38776
38823
  ...source,
38777
38824
  name: typedArgs.name,
38778
38825
  id: typedArgs.id,
38779
38826
  project: { id: typedArgs.projectId ?? source.project?.id ?? "_Root" }
38780
38827
  };
38781
- const response = await api.buildTypes.createBuildType(void 0, buildType);
38828
+ const response = await adapter.modules.buildTypes.createBuildType(void 0, buildType);
38782
38829
  return json({ success: true, action: "clone_build_config", id: response.data.id });
38783
38830
  },
38784
38831
  mode: "full"
@@ -38799,9 +38846,8 @@ var FULL_MODE_TOOLS = [
38799
38846
  },
38800
38847
  handler: async (args) => {
38801
38848
  const typedArgs = args;
38802
- const api = TeamCityAPI.getInstance();
38849
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38803
38850
  try {
38804
- const adapter = createAdapterFromTeamCityAPI(api);
38805
38851
  const manager = new BuildConfigurationUpdateManager(adapter);
38806
38852
  const current = await manager.retrieveConfiguration(typedArgs.buildTypeId);
38807
38853
  if (current) {
@@ -38816,17 +38862,21 @@ var FULL_MODE_TOOLS = [
38816
38862
  }
38817
38863
  } else {
38818
38864
  if (typedArgs.name != null && typedArgs.name !== "") {
38819
- await api.buildTypes.setBuildTypeField(typedArgs.buildTypeId, "name", typedArgs.name);
38865
+ await adapter.modules.buildTypes.setBuildTypeField(
38866
+ typedArgs.buildTypeId,
38867
+ "name",
38868
+ typedArgs.name
38869
+ );
38820
38870
  }
38821
38871
  if (typedArgs.description !== void 0) {
38822
- await api.buildTypes.setBuildTypeField(
38872
+ await adapter.modules.buildTypes.setBuildTypeField(
38823
38873
  typedArgs.buildTypeId,
38824
38874
  "description",
38825
38875
  typedArgs.description
38826
38876
  );
38827
38877
  }
38828
38878
  if (typedArgs.artifactRules !== void 0) {
38829
- await api.buildTypes.setBuildTypeField(
38879
+ await adapter.modules.buildTypes.setBuildTypeField(
38830
38880
  typedArgs.buildTypeId,
38831
38881
  "settings/artifactRules",
38832
38882
  typedArgs.artifactRules
@@ -38835,17 +38885,21 @@ var FULL_MODE_TOOLS = [
38835
38885
  }
38836
38886
  } catch {
38837
38887
  if (typedArgs.name != null && typedArgs.name !== "") {
38838
- await api.buildTypes.setBuildTypeField(typedArgs.buildTypeId, "name", typedArgs.name);
38888
+ await adapter.modules.buildTypes.setBuildTypeField(
38889
+ typedArgs.buildTypeId,
38890
+ "name",
38891
+ typedArgs.name
38892
+ );
38839
38893
  }
38840
38894
  if (typedArgs.description !== void 0) {
38841
- await api.buildTypes.setBuildTypeField(
38895
+ await adapter.modules.buildTypes.setBuildTypeField(
38842
38896
  typedArgs.buildTypeId,
38843
38897
  "description",
38844
38898
  typedArgs.description
38845
38899
  );
38846
38900
  }
38847
38901
  if (typedArgs.artifactRules !== void 0) {
38848
- await api.buildTypes.setBuildTypeField(
38902
+ await adapter.modules.buildTypes.setBuildTypeField(
38849
38903
  typedArgs.buildTypeId,
38850
38904
  "settings/artifactRules",
38851
38905
  typedArgs.artifactRules
@@ -38853,7 +38907,7 @@ var FULL_MODE_TOOLS = [
38853
38907
  }
38854
38908
  }
38855
38909
  if (typedArgs.paused !== void 0) {
38856
- await api.buildTypes.setBuildTypeField(
38910
+ await adapter.modules.buildTypes.setBuildTypeField(
38857
38911
  typedArgs.buildTypeId,
38858
38912
  "paused",
38859
38913
  String(typedArgs.paused)
@@ -38886,14 +38940,19 @@ var FULL_MODE_TOOLS = [
38886
38940
  "add_vcs_root_to_build",
38887
38941
  schema,
38888
38942
  async (typed) => {
38889
- const api = TeamCityAPI.getInstance();
38943
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38890
38944
  const body = {
38891
38945
  "vcs-root": { id: typed.vcsRootId },
38892
38946
  "checkout-rules": typed.checkoutRules
38893
38947
  };
38894
- await api.buildTypes.addVcsRootToBuildType(typed.buildTypeId, void 0, body, {
38895
- headers: { "Content-Type": "application/json", Accept: "application/json" }
38896
- });
38948
+ await adapter.modules.buildTypes.addVcsRootToBuildType(
38949
+ typed.buildTypeId,
38950
+ void 0,
38951
+ body,
38952
+ {
38953
+ headers: { "Content-Type": "application/json", Accept: "application/json" }
38954
+ }
38955
+ );
38897
38956
  return json({
38898
38957
  success: true,
38899
38958
  action: "add_vcs_root_to_build",
@@ -38921,12 +38980,12 @@ var FULL_MODE_TOOLS = [
38921
38980
  },
38922
38981
  handler: async (args) => {
38923
38982
  const typedArgs = args;
38924
- const api = TeamCityAPI.getInstance();
38983
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
38925
38984
  const parameter = {
38926
38985
  name: typedArgs.name,
38927
38986
  value: typedArgs.value
38928
38987
  };
38929
- await api.buildTypes.createBuildParameterOfBuildType(
38988
+ await adapter.modules.buildTypes.createBuildParameterOfBuildType(
38930
38989
  typedArgs.buildTypeId,
38931
38990
  void 0,
38932
38991
  parameter,
@@ -38955,8 +39014,8 @@ var FULL_MODE_TOOLS = [
38955
39014
  },
38956
39015
  handler: async (args) => {
38957
39016
  const typedArgs = args;
38958
- const api = TeamCityAPI.getInstance();
38959
- await api.buildTypes.updateBuildParameterOfBuildType(
39017
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39018
+ await adapter.modules.buildTypes.updateBuildParameterOfBuildType(
38960
39019
  typedArgs.name,
38961
39020
  typedArgs.buildTypeId,
38962
39021
  void 0,
@@ -38988,8 +39047,11 @@ var FULL_MODE_TOOLS = [
38988
39047
  },
38989
39048
  handler: async (args) => {
38990
39049
  const typedArgs = args;
38991
- const api = TeamCityAPI.getInstance();
38992
- await api.buildTypes.deleteBuildParameterOfBuildType_2(typedArgs.name, typedArgs.buildTypeId);
39050
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39051
+ await adapter.modules.buildTypes.deleteBuildParameterOfBuildType_2(
39052
+ typedArgs.name,
39053
+ typedArgs.buildTypeId
39054
+ );
38993
39055
  return json({
38994
39056
  success: true,
38995
39057
  action: "delete_parameter",
@@ -39017,7 +39079,7 @@ var FULL_MODE_TOOLS = [
39017
39079
  },
39018
39080
  handler: async (args) => {
39019
39081
  const typedArgs = args;
39020
- const api = TeamCityAPI.getInstance();
39082
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39021
39083
  const vcsRoot = {
39022
39084
  name: typedArgs.name,
39023
39085
  id: typedArgs.id,
@@ -39030,7 +39092,7 @@ var FULL_MODE_TOOLS = [
39030
39092
  ]
39031
39093
  }
39032
39094
  };
39033
- const response = await api.vcsRoots.addVcsRoot(void 0, vcsRoot, {
39095
+ const response = await adapter.modules.vcsRoots.addVcsRoot(void 0, vcsRoot, {
39034
39096
  headers: { "Content-Type": "application/json", Accept: "application/json" }
39035
39097
  });
39036
39098
  return json({ success: true, action: "create_vcs_root", id: response.data.id });
@@ -39051,8 +39113,8 @@ var FULL_MODE_TOOLS = [
39051
39113
  },
39052
39114
  handler: async (args) => {
39053
39115
  const typedArgs = args;
39054
- const api = TeamCityAPI.getInstance();
39055
- await api.agents.setAuthorizedInfo(
39116
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39117
+ await adapter.modules.agents.setAuthorizedInfo(
39056
39118
  typedArgs.agentId,
39057
39119
  void 0,
39058
39120
  { status: Boolean(typedArgs.authorize) },
@@ -39080,8 +39142,8 @@ var FULL_MODE_TOOLS = [
39080
39142
  },
39081
39143
  handler: async (args) => {
39082
39144
  const typedArgs = args;
39083
- const api = TeamCityAPI.getInstance();
39084
- await api.agents.setAgentPool(typedArgs.agentId, void 0, {
39145
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39146
+ await adapter.modules.agents.setAgentPool(typedArgs.agentId, void 0, {
39085
39147
  id: parseInt(typedArgs.poolId)
39086
39148
  });
39087
39149
  return json({
@@ -39115,7 +39177,7 @@ var FULL_MODE_TOOLS = [
39115
39177
  },
39116
39178
  handler: async (args) => {
39117
39179
  const typedArgs = args;
39118
- const api = TeamCityAPI.getInstance();
39180
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39119
39181
  switch (typedArgs.action) {
39120
39182
  case "add": {
39121
39183
  const stepProps = Object.fromEntries(
@@ -39131,9 +39193,14 @@ var FULL_MODE_TOOLS = [
39131
39193
  property: Object.entries(stepProps).map(([k, v]) => ({ name: k, value: v }))
39132
39194
  }
39133
39195
  };
39134
- await api.buildTypes.addBuildStepToBuildType(typedArgs.buildTypeId, void 0, step, {
39135
- headers: { "Content-Type": "application/json", Accept: "application/json" }
39136
- });
39196
+ await adapter.modules.buildTypes.addBuildStepToBuildType(
39197
+ typedArgs.buildTypeId,
39198
+ void 0,
39199
+ step,
39200
+ {
39201
+ headers: { "Content-Type": "application/json", Accept: "application/json" }
39202
+ }
39203
+ );
39137
39204
  return json({
39138
39205
  success: true,
39139
39206
  action: "add_build_step",
@@ -39150,7 +39217,7 @@ var FULL_MODE_TOOLS = [
39150
39217
  }
39151
39218
  const props = Object.entries(typedArgs.properties ?? {});
39152
39219
  for (const [k, v] of props) {
39153
- await api.buildTypes.setBuildStepParameter(
39220
+ await adapter.modules.buildTypes.setBuildStepParameter(
39154
39221
  typedArgs.buildTypeId,
39155
39222
  typedArgs.stepId,
39156
39223
  k,
@@ -39173,7 +39240,7 @@ var FULL_MODE_TOOLS = [
39173
39240
  error: "Step ID is required for delete action"
39174
39241
  });
39175
39242
  }
39176
- await api.buildTypes.deleteBuildStep(typedArgs.buildTypeId, typedArgs.stepId);
39243
+ await adapter.modules.buildTypes.deleteBuildStep(typedArgs.buildTypeId, typedArgs.stepId);
39177
39244
  return json({
39178
39245
  success: true,
39179
39246
  action: "delete_build_step",
@@ -39203,7 +39270,7 @@ var FULL_MODE_TOOLS = [
39203
39270
  },
39204
39271
  handler: async (args) => {
39205
39272
  const typedArgs = args;
39206
- const api = TeamCityAPI.getInstance();
39273
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39207
39274
  switch (typedArgs.action) {
39208
39275
  case "add": {
39209
39276
  const trigger = {
@@ -39215,9 +39282,14 @@ var FULL_MODE_TOOLS = [
39215
39282
  }))
39216
39283
  }
39217
39284
  };
39218
- await api.buildTypes.addTriggerToBuildType(typedArgs.buildTypeId, void 0, trigger, {
39219
- headers: { "Content-Type": "application/json", Accept: "application/json" }
39220
- });
39285
+ await adapter.modules.buildTypes.addTriggerToBuildType(
39286
+ typedArgs.buildTypeId,
39287
+ void 0,
39288
+ trigger,
39289
+ {
39290
+ headers: { "Content-Type": "application/json", Accept: "application/json" }
39291
+ }
39292
+ );
39221
39293
  return json({
39222
39294
  success: true,
39223
39295
  action: "add_build_trigger",
@@ -39232,7 +39304,10 @@ var FULL_MODE_TOOLS = [
39232
39304
  error: "Trigger ID is required for delete action"
39233
39305
  });
39234
39306
  }
39235
- await api.buildTypes.deleteTrigger(typedArgs.buildTypeId, typedArgs.triggerId);
39307
+ await adapter.modules.buildTypes.deleteTrigger(
39308
+ typedArgs.buildTypeId,
39309
+ typedArgs.triggerId
39310
+ );
39236
39311
  return json({
39237
39312
  success: true,
39238
39313
  action: "delete_build_trigger",
@@ -39272,21 +39347,21 @@ var FULL_MODE_TOOLS = [
39272
39347
  "set_build_configs_paused",
39273
39348
  schema,
39274
39349
  async (typed) => {
39275
- const api = TeamCityAPI.getInstance();
39350
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39276
39351
  let updated = 0;
39277
39352
  for (const id of typed.buildTypeIds) {
39278
- await api.buildTypes.setBuildTypeField(id, "paused", String(typed.paused));
39353
+ await adapter.modules.buildTypes.setBuildTypeField(id, "paused", String(typed.paused));
39279
39354
  updated += 1;
39280
39355
  }
39281
39356
  let canceled = 0;
39282
39357
  if (typed.cancelQueued) {
39283
- const queue = await api.buildQueue.getAllQueuedBuilds();
39358
+ const queue = await adapter.modules.buildQueue.getAllQueuedBuilds();
39284
39359
  const builds = queue.data?.build ?? [];
39285
39360
  const ids = new Set(typed.buildTypeIds);
39286
39361
  const toCancel = builds.filter((b) => b.buildTypeId && ids.has(b.buildTypeId));
39287
39362
  for (const b of toCancel) {
39288
39363
  if (b.id == null) continue;
39289
- await api.buildQueue.deleteQueuedBuild(String(b.id));
39364
+ await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
39290
39365
  canceled += 1;
39291
39366
  }
39292
39367
  }
@@ -39352,7 +39427,7 @@ var FULL_MODE_TOOLS = [
39352
39427
  "mute_tests",
39353
39428
  schema,
39354
39429
  async (typed) => {
39355
- const api = TeamCityAPI.getInstance();
39430
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39356
39431
  let scope;
39357
39432
  if (typed.buildTypeId) {
39358
39433
  scope = { buildType: { id: typed.buildTypeId } };
@@ -39375,7 +39450,7 @@ var FULL_MODE_TOOLS = [
39375
39450
  }
39376
39451
  ]
39377
39452
  };
39378
- const response = await api.mutes.muteMultipleTests(typed.fields, payload, {
39453
+ const response = await adapter.modules.mutes.muteMultipleTests(typed.fields, payload, {
39379
39454
  headers: {
39380
39455
  "Content-Type": "application/json",
39381
39456
  Accept: "application/json"
@@ -39410,8 +39485,8 @@ var FULL_MODE_TOOLS = [
39410
39485
  "move_queued_build_to_top",
39411
39486
  schema,
39412
39487
  async (typed) => {
39413
- const api = TeamCityAPI.getInstance();
39414
- await api.buildQueue.setQueuedBuildsOrder(void 0, {
39488
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39489
+ await adapter.modules.buildQueue.setQueuedBuildsOrder(void 0, {
39415
39490
  build: [{ id: parseInt(typed.buildId) }]
39416
39491
  });
39417
39492
  return json({
@@ -39439,8 +39514,8 @@ var FULL_MODE_TOOLS = [
39439
39514
  "reorder_queued_builds",
39440
39515
  schema,
39441
39516
  async (typed) => {
39442
- const api = TeamCityAPI.getInstance();
39443
- await api.buildQueue.setQueuedBuildsOrder(void 0, {
39517
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39518
+ await adapter.modules.buildQueue.setQueuedBuildsOrder(void 0, {
39444
39519
  build: typed.buildIds.map((id) => ({ id: parseInt(id) }))
39445
39520
  });
39446
39521
  return json({
@@ -39468,14 +39543,14 @@ var FULL_MODE_TOOLS = [
39468
39543
  "cancel_queued_builds_for_build_type",
39469
39544
  schema,
39470
39545
  async (typed) => {
39471
- const api = TeamCityAPI.getInstance();
39472
- const queue = await api.buildQueue.getAllQueuedBuilds();
39546
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39547
+ const queue = await adapter.modules.buildQueue.getAllQueuedBuilds();
39473
39548
  const builds = queue.data?.build ?? [];
39474
39549
  const toCancel = builds.filter((b) => b.buildTypeId === typed.buildTypeId);
39475
39550
  let canceled = 0;
39476
39551
  for (const b of toCancel) {
39477
39552
  if (b.id == null) continue;
39478
- await api.buildQueue.deleteQueuedBuild(String(b.id));
39553
+ await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
39479
39554
  canceled += 1;
39480
39555
  }
39481
39556
  return json({
@@ -39504,13 +39579,13 @@ var FULL_MODE_TOOLS = [
39504
39579
  "cancel_queued_builds_by_locator",
39505
39580
  schema,
39506
39581
  async (typed) => {
39507
- const api = TeamCityAPI.getInstance();
39508
- const queue = await api.buildQueue.getAllQueuedBuilds(typed.locator);
39582
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39583
+ const queue = await adapter.modules.buildQueue.getAllQueuedBuilds(typed.locator);
39509
39584
  const builds = queue.data?.build ?? [];
39510
39585
  let canceled = 0;
39511
39586
  for (const b of builds) {
39512
39587
  if (b.id == null) continue;
39513
- await api.buildQueue.deleteQueuedBuild(String(b.id));
39588
+ await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
39514
39589
  canceled += 1;
39515
39590
  }
39516
39591
  return json({
@@ -39553,8 +39628,10 @@ var FULL_MODE_TOOLS = [
39553
39628
  "pause_queue_for_pool",
39554
39629
  schema,
39555
39630
  async (typed) => {
39556
- const api = TeamCityAPI.getInstance();
39557
- const agentsResp = await api.agents.getAllAgents(`agentPool:(id:${typed.poolId})`);
39631
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39632
+ const agentsResp = await adapter.modules.agents.getAllAgents(
39633
+ `agentPool:(id:${typed.poolId})`
39634
+ );
39558
39635
  const agents = agentsResp.data?.agent ?? [];
39559
39636
  const body = {
39560
39637
  status: false
@@ -39565,21 +39642,21 @@ var FULL_MODE_TOOLS = [
39565
39642
  for (const a of agents) {
39566
39643
  const id = a.id;
39567
39644
  if (!id) continue;
39568
- await api.agents.setEnabledInfo(id, void 0, body, {
39645
+ await adapter.modules.agents.setEnabledInfo(id, void 0, body, {
39569
39646
  headers: { "Content-Type": "application/json", Accept: "application/json" }
39570
39647
  });
39571
39648
  disabled += 1;
39572
39649
  }
39573
39650
  let canceled = 0;
39574
39651
  if (typed.cancelQueuedForBuildTypeId) {
39575
- const queue = await api.buildQueue.getAllQueuedBuilds();
39652
+ const queue = await adapter.modules.buildQueue.getAllQueuedBuilds();
39576
39653
  const builds = queue.data?.build ?? [];
39577
39654
  const toCancel = builds.filter(
39578
39655
  (b) => b.buildTypeId === typed.cancelQueuedForBuildTypeId
39579
39656
  );
39580
39657
  for (const b of toCancel) {
39581
39658
  if (b.id == null) continue;
39582
- await api.buildQueue.deleteQueuedBuild(String(b.id));
39659
+ await adapter.modules.buildQueue.deleteQueuedBuild(String(b.id));
39583
39660
  canceled += 1;
39584
39661
  }
39585
39662
  }
@@ -39610,14 +39687,16 @@ var FULL_MODE_TOOLS = [
39610
39687
  "resume_queue_for_pool",
39611
39688
  schema,
39612
39689
  async (typed) => {
39613
- const api = TeamCityAPI.getInstance();
39614
- const agentsResp = await api.agents.getAllAgents(`agentPool:(id:${typed.poolId})`);
39690
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39691
+ const agentsResp = await adapter.modules.agents.getAllAgents(
39692
+ `agentPool:(id:${typed.poolId})`
39693
+ );
39615
39694
  const agents = agentsResp.data?.agent ?? [];
39616
39695
  let enabled = 0;
39617
39696
  for (const a of agents) {
39618
39697
  const id = a.id;
39619
39698
  if (!id) continue;
39620
- await api.agents.setEnabledInfo(
39699
+ await adapter.modules.agents.setEnabledInfo(
39621
39700
  id,
39622
39701
  void 0,
39623
39702
  { status: true },
@@ -39665,11 +39744,11 @@ var FULL_MODE_TOOLS = [
39665
39744
  "set_agent_enabled",
39666
39745
  schema,
39667
39746
  async (typed) => {
39668
- const api = TeamCityAPI.getInstance();
39747
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39669
39748
  const body = { status: typed.enabled };
39670
39749
  if (typed.comment) body.comment = { text: typed.comment };
39671
39750
  if (typed.until) body.statusSwitchTime = typed.until;
39672
- const resp = await api.agents.setEnabledInfo(typed.agentId, void 0, body, {
39751
+ const resp = await adapter.modules.agents.setEnabledInfo(typed.agentId, void 0, body, {
39673
39752
  headers: { "Content-Type": "application/json", Accept: "application/json" }
39674
39753
  });
39675
39754
  return json({
@@ -39724,13 +39803,13 @@ var FULL_MODE_TOOLS = [
39724
39803
  "bulk_set_agents_enabled",
39725
39804
  schema,
39726
39805
  async (typed) => {
39727
- const api = TeamCityAPI.getInstance();
39806
+ const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39728
39807
  const filters = [];
39729
39808
  if (typed.poolId) filters.push(`agentPool:(id:${typed.poolId})`);
39730
39809
  if (typed.locator) filters.push(typed.locator);
39731
39810
  if (typed.includeDisabled === false) filters.push("enabled:true");
39732
39811
  const locator = filters.join(",");
39733
- const list = await api.agents.getAllAgents(locator);
39812
+ const list = await adapter.modules.agents.getAllAgents(locator);
39734
39813
  const agents = list.data?.agent ?? [];
39735
39814
  const body = { status: typed.enabled };
39736
39815
  if (typed.comment) body.comment = { text: typed.comment };
@@ -39740,7 +39819,7 @@ var FULL_MODE_TOOLS = [
39740
39819
  const id = String(a.id ?? "");
39741
39820
  if (!id) continue;
39742
39821
  try {
39743
- await api.agents.setEnabledInfo(id, void 0, body, {
39822
+ await adapter.modules.agents.setEnabledInfo(id, void 0, body, {
39744
39823
  headers: {
39745
39824
  "Content-Type": "application/json",
39746
39825
  Accept: "application/json"