@daghis/teamcity-mcp 1.9.4 → 1.9.6

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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "1.9.4"
2
+ ".": "1.9.6"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,109 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.9.6](https://github.com/Daghis/teamcity-mcp/compare/teamcity-mcp-v1.9.5...teamcity-mcp-v1.9.6) (2025-09-25)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **tools:** resolve builds by number (GH-198) ([#211](https://github.com/Daghis/teamcity-mcp/issues/211)) ([abcb614](https://github.com/Daghis/teamcity-mcp/commit/abcb614364e4ba60d6e4d19faabe515fa20c7d5a))
9
+
10
+ ## [1.9.5](https://github.com/Daghis/teamcity-mcp/compare/teamcity-mcp-v1.9.5...teamcity-mcp-v1.9.5) (2025-09-25)
11
+
12
+
13
+ ### Features
14
+
15
+ * add Codecov bundle analysis ([#28](https://github.com/Daghis/teamcity-mcp/issues/28)) ([87c3de8](https://github.com/Daghis/teamcity-mcp/commit/87c3de85af34bec5b071d82612d67ba4d5a52702))
16
+ * **publish:** automate mcp registry publishing ([#190](https://github.com/Daghis/teamcity-mcp/issues/190)) ([285b737](https://github.com/Daghis/teamcity-mcp/commit/285b737c5993332d8cf5e81e4db5be9864355701))
17
+ * **teamcity:** add runtime guards for manager responses ([#179](https://github.com/Daghis/teamcity-mcp/issues/179)) ([9d7eaef](https://github.com/Daghis/teamcity-mcp/commit/9d7eaef161e675246d317603df47f7f39407b7d8))
18
+ * **teamcity:** add streaming artifact downloads ([#161](https://github.com/Daghis/teamcity-mcp/issues/161)) ([b50b773](https://github.com/Daghis/teamcity-mcp/commit/b50b773ebee6f5cc85f4c53c98fef525e7098fe9)), closes [#151](https://github.com/Daghis/teamcity-mcp/issues/151)
19
+ * **teamcity:** add streaming artifact downloads ([#166](https://github.com/Daghis/teamcity-mcp/issues/166)) ([18830ed](https://github.com/Daghis/teamcity-mcp/commit/18830ed4805ad215518cc5a51640094adc35e31b)), closes [#151](https://github.com/Daghis/teamcity-mcp/issues/151)
20
+ * **tests:** add batched mcp tool execution ([#163](https://github.com/Daghis/teamcity-mcp/issues/163)) ([5f48060](https://github.com/Daghis/teamcity-mcp/commit/5f4806043b95686d5dac41a9d67515740b82a3f8)), closes [#162](https://github.com/Daghis/teamcity-mcp/issues/162)
21
+ * **tools:** add streaming mode to fetch_build_log ([#171](https://github.com/Daghis/teamcity-mcp/issues/171)) ([1abce69](https://github.com/Daghis/teamcity-mcp/commit/1abce69b7fa3866ac289501e2369d5d06d57d57f))
22
+ * **tools:** add VCS root property management tools + integration test ([#95](https://github.com/Daghis/teamcity-mcp/issues/95)) ([13bbe17](https://github.com/Daghis/teamcity-mcp/commit/13bbe178564a53564aad4fcdb99bb3f2e5db4cb8))
23
+ * **tools:** expose change and admin REST tools ([#112](https://github.com/Daghis/teamcity-mcp/issues/112)) ([e7f4e1e](https://github.com/Daghis/teamcity-mcp/commit/e7f4e1e74bb28572ffc3ee7a0fced6090c4f92ef))
24
+ * **tools:** support streaming artifacts in get_build_results ([#173](https://github.com/Daghis/teamcity-mcp/issues/173)) ([f95c5e4](https://github.com/Daghis/teamcity-mcp/commit/f95c5e4da9ffa80adc8b8f322c127a440c4524b5)), closes [#169](https://github.com/Daghis/teamcity-mcp/issues/169)
25
+ * **utils:** add TeamCity service message escaping ([#85](https://github.com/Daghis/teamcity-mcp/issues/85)) ([6ee3b72](https://github.com/Daghis/teamcity-mcp/commit/6ee3b72e4db065faa0e01c7046328e1d4e1375c8))
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * authorize_agent uses authorizedInfo JSON endpoint (TeamCity 2025.07 compatibility) ([#83](https://github.com/Daghis/teamcity-mcp/issues/83)) ([198fd02](https://github.com/Daghis/teamcity-mcp/commit/198fd02ca8b6e89d83f87a1a94aafeadda593504)), closes [#78](https://github.com/Daghis/teamcity-mcp/issues/78)
31
+ * **cli:** improve npx execution; release 0.9.2 ([#61](https://github.com/Daghis/teamcity-mcp/issues/61)) ([42577c3](https://github.com/Daghis/teamcity-mcp/commit/42577c3ed78dd7e29f21f6c8138d96da49582892))
32
+ * **cli:** remove duplicate shebang in entrypoint; bump to 0.9.1 ([#59](https://github.com/Daghis/teamcity-mcp/issues/59)) ([740530d](https://github.com/Daghis/teamcity-mcp/commit/740530d7bfba6bc81a42f8057fd017a2f8cae14e))
33
+ * delete_parameter: correct endpoint + arg order ([#84](https://github.com/Daghis/teamcity-mcp/issues/84)) ([9832821](https://github.com/Daghis/teamcity-mcp/commit/9832821e65fd945ec5ff0da2b85f744f413e7782))
34
+ * **health:** accept empty locator; normalize category; fallback on 400 ([#76](https://github.com/Daghis/teamcity-mcp/issues/76)) ([174c8e9](https://github.com/Daghis/teamcity-mcp/commit/174c8e932301b1b2262bfb704a73c4647520d3bf)), closes [#75](https://github.com/Daghis/teamcity-mcp/issues/75)
35
+ * **mcp:** normalize TeamCity errors and wrap server info/metrics with runTool ([#53](https://github.com/Daghis/teamcity-mcp/issues/53)) ([2c8ab85](https://github.com/Daghis/teamcity-mcp/commit/2c8ab855a85e5faec4216a498c089e3a1a93ed7b))
36
+ * **release:** restore 1.9.4 version metadata ([#205](https://github.com/Daghis/teamcity-mcp/issues/205)) ([c10c436](https://github.com/Daghis/teamcity-mcp/commit/c10c4362934f3af116e7d22537481aaceceeff40))
37
+ * **teamcity:** expose unified adapter surface ([#129](https://github.com/Daghis/teamcity-mcp/issues/129)) ([b0b15e8](https://github.com/Daghis/teamcity-mcp/commit/b0b15e8597d5a79c064388be38c3ffe9c0e1fc09)), closes [#114](https://github.com/Daghis/teamcity-mcp/issues/114)
38
+ * **teamcity:** resolve nested artifact downloads ([#188](https://github.com/Daghis/teamcity-mcp/issues/188)) ([e309b90](https://github.com/Daghis/teamcity-mcp/commit/e309b90de42fe121f072fe5b549ab25df3a91aaf))
39
+ * **teamcity:** restore artifact rules update compatibility ([#185](https://github.com/Daghis/teamcity-mcp/issues/185)) ([1d67268](https://github.com/Daghis/teamcity-mcp/commit/1d67268e6ee837db38ab9be27a94a5f3e072ab83))
40
+ * **teamcity:** retain adapter api credentials ([#138](https://github.com/Daghis/teamcity-mcp/issues/138)) ([3ad31ed](https://github.com/Daghis/teamcity-mcp/commit/3ad31edf227eac904eee84ec3a80d16455ae37fc)), closes [#135](https://github.com/Daghis/teamcity-mcp/issues/135)
41
+ * **teamcity:** route results + problems via shared client ([#111](https://github.com/Daghis/teamcity-mcp/issues/111)) ([3797bb5](https://github.com/Daghis/teamcity-mcp/commit/3797bb57d8421e2cb243112a9b1cdfda92fff1f7))
42
+ * **tools:** accept multi-line scripts + prep 1.9.5 (GH-200) ([#207](https://github.com/Daghis/teamcity-mcp/issues/207)) ([e9bf9d0](https://github.com/Daghis/teamcity-mcp/commit/e9bf9d041e7abc0c4d438a4bdf54a9211b9a61f2))
43
+ * **tools:** allow manage_build_steps updates ([#182](https://github.com/Daghis/teamcity-mcp/issues/182)) ([2c6bea0](https://github.com/Daghis/teamcity-mcp/commit/2c6bea0cf6770d22068b9e4b733542a056399148))
44
+ * **tools:** ensure multi-ref branchSpec; remove alias logic ([#103](https://github.com/Daghis/teamcity-mcp/issues/103)) ([5012439](https://github.com/Daghis/teamcity-mcp/commit/5012439caa926422960d5ac569579a3a725732ad))
45
+ * **tools:** harden batch artifact streaming outputs ([#177](https://github.com/Daghis/teamcity-mcp/issues/177)) ([0874325](https://github.com/Daghis/teamcity-mcp/commit/0874325c77aa2a79050cff57fced0aeec5a55ba0))
46
+ * **tools:** merge build step defaults during update (199) ([#203](https://github.com/Daghis/teamcity-mcp/issues/203)) ([43a668f](https://github.com/Daghis/teamcity-mcp/commit/43a668f0bdc3b0f69c6a3bca0e2a47c49f1cd1a7))
47
+ * **tools:** migrate MCP handlers to unified client ([#141](https://github.com/Daghis/teamcity-mcp/issues/141)) ([bc3a909](https://github.com/Daghis/teamcity-mcp/commit/bc3a909f6eb8c30798865c8b48604aca5405efc8))
48
+ * **tools:** repair manage_build_steps updates ([#154](https://github.com/Daghis/teamcity-mcp/issues/154)) ([b557e44](https://github.com/Daghis/teamcity-mcp/commit/b557e4424d5129de9d3b6e3240e1a876488da040))
49
+ * **tools:** stabilize batch artifact downloads ([#175](https://github.com/Daghis/teamcity-mcp/issues/175)) ([91a0ec3](https://github.com/Daghis/teamcity-mcp/commit/91a0ec33ac61e680dd34393fca46914e2ba3fe7f))
50
+ * **tools:** update_build_config uses 'settings/artifactRules' path; add tests ([#66](https://github.com/Daghis/teamcity-mcp/issues/66)) ([8b8afc6](https://github.com/Daghis/teamcity-mcp/commit/8b8afc6f41038bcde21a50a8662f90fa4acb7e9a))
51
+ * trigger 1.0.2 release (no functional change) ([392be27](https://github.com/Daghis/teamcity-mcp/commit/392be27fe705d55fb8a3057120ff5e2c0a41ca8a))
52
+ * trigger 1.0.3 release (no functional change) ([069212a](https://github.com/Daghis/teamcity-mcp/commit/069212a181861b17e7a1d5cfda05b40c2d11e933))
53
+
54
+
55
+ ### Miscellaneous Chores
56
+
57
+ * release 0.1.2 ([21e2595](https://github.com/Daghis/teamcity-mcp/commit/21e25950074ed49bd3e6c571f432f27fb8bd434e))
58
+
59
+ ## [0.1.2](https://github.com/Daghis/teamcity-mcp/compare/teamcity-mcp-v1.9.4...teamcity-mcp-v0.1.2) (2025-09-25)
60
+
61
+
62
+ ### Features
63
+
64
+ * add Codecov bundle analysis ([#28](https://github.com/Daghis/teamcity-mcp/issues/28)) ([87c3de8](https://github.com/Daghis/teamcity-mcp/commit/87c3de85af34bec5b071d82612d67ba4d5a52702))
65
+ * **publish:** automate mcp registry publishing ([#190](https://github.com/Daghis/teamcity-mcp/issues/190)) ([285b737](https://github.com/Daghis/teamcity-mcp/commit/285b737c5993332d8cf5e81e4db5be9864355701))
66
+ * **teamcity:** add runtime guards for manager responses ([#179](https://github.com/Daghis/teamcity-mcp/issues/179)) ([9d7eaef](https://github.com/Daghis/teamcity-mcp/commit/9d7eaef161e675246d317603df47f7f39407b7d8))
67
+ * **teamcity:** add streaming artifact downloads ([#161](https://github.com/Daghis/teamcity-mcp/issues/161)) ([b50b773](https://github.com/Daghis/teamcity-mcp/commit/b50b773ebee6f5cc85f4c53c98fef525e7098fe9)), closes [#151](https://github.com/Daghis/teamcity-mcp/issues/151)
68
+ * **teamcity:** add streaming artifact downloads ([#166](https://github.com/Daghis/teamcity-mcp/issues/166)) ([18830ed](https://github.com/Daghis/teamcity-mcp/commit/18830ed4805ad215518cc5a51640094adc35e31b)), closes [#151](https://github.com/Daghis/teamcity-mcp/issues/151)
69
+ * **tests:** add batched mcp tool execution ([#163](https://github.com/Daghis/teamcity-mcp/issues/163)) ([5f48060](https://github.com/Daghis/teamcity-mcp/commit/5f4806043b95686d5dac41a9d67515740b82a3f8)), closes [#162](https://github.com/Daghis/teamcity-mcp/issues/162)
70
+ * **tools:** add streaming mode to fetch_build_log ([#171](https://github.com/Daghis/teamcity-mcp/issues/171)) ([1abce69](https://github.com/Daghis/teamcity-mcp/commit/1abce69b7fa3866ac289501e2369d5d06d57d57f))
71
+ * **tools:** add VCS root property management tools + integration test ([#95](https://github.com/Daghis/teamcity-mcp/issues/95)) ([13bbe17](https://github.com/Daghis/teamcity-mcp/commit/13bbe178564a53564aad4fcdb99bb3f2e5db4cb8))
72
+ * **tools:** expose change and admin REST tools ([#112](https://github.com/Daghis/teamcity-mcp/issues/112)) ([e7f4e1e](https://github.com/Daghis/teamcity-mcp/commit/e7f4e1e74bb28572ffc3ee7a0fced6090c4f92ef))
73
+ * **tools:** support streaming artifacts in get_build_results ([#173](https://github.com/Daghis/teamcity-mcp/issues/173)) ([f95c5e4](https://github.com/Daghis/teamcity-mcp/commit/f95c5e4da9ffa80adc8b8f322c127a440c4524b5)), closes [#169](https://github.com/Daghis/teamcity-mcp/issues/169)
74
+ * **utils:** add TeamCity service message escaping ([#85](https://github.com/Daghis/teamcity-mcp/issues/85)) ([6ee3b72](https://github.com/Daghis/teamcity-mcp/commit/6ee3b72e4db065faa0e01c7046328e1d4e1375c8))
75
+
76
+
77
+ ### Bug Fixes
78
+
79
+ * authorize_agent uses authorizedInfo JSON endpoint (TeamCity 2025.07 compatibility) ([#83](https://github.com/Daghis/teamcity-mcp/issues/83)) ([198fd02](https://github.com/Daghis/teamcity-mcp/commit/198fd02ca8b6e89d83f87a1a94aafeadda593504)), closes [#78](https://github.com/Daghis/teamcity-mcp/issues/78)
80
+ * **cli:** improve npx execution; release 0.9.2 ([#61](https://github.com/Daghis/teamcity-mcp/issues/61)) ([42577c3](https://github.com/Daghis/teamcity-mcp/commit/42577c3ed78dd7e29f21f6c8138d96da49582892))
81
+ * **cli:** remove duplicate shebang in entrypoint; bump to 0.9.1 ([#59](https://github.com/Daghis/teamcity-mcp/issues/59)) ([740530d](https://github.com/Daghis/teamcity-mcp/commit/740530d7bfba6bc81a42f8057fd017a2f8cae14e))
82
+ * delete_parameter: correct endpoint + arg order ([#84](https://github.com/Daghis/teamcity-mcp/issues/84)) ([9832821](https://github.com/Daghis/teamcity-mcp/commit/9832821e65fd945ec5ff0da2b85f744f413e7782))
83
+ * **health:** accept empty locator; normalize category; fallback on 400 ([#76](https://github.com/Daghis/teamcity-mcp/issues/76)) ([174c8e9](https://github.com/Daghis/teamcity-mcp/commit/174c8e932301b1b2262bfb704a73c4647520d3bf)), closes [#75](https://github.com/Daghis/teamcity-mcp/issues/75)
84
+ * **mcp:** normalize TeamCity errors and wrap server info/metrics with runTool ([#53](https://github.com/Daghis/teamcity-mcp/issues/53)) ([2c8ab85](https://github.com/Daghis/teamcity-mcp/commit/2c8ab855a85e5faec4216a498c089e3a1a93ed7b))
85
+ * **release:** restore 1.9.4 version metadata ([#205](https://github.com/Daghis/teamcity-mcp/issues/205)) ([c10c436](https://github.com/Daghis/teamcity-mcp/commit/c10c4362934f3af116e7d22537481aaceceeff40))
86
+ * **teamcity:** expose unified adapter surface ([#129](https://github.com/Daghis/teamcity-mcp/issues/129)) ([b0b15e8](https://github.com/Daghis/teamcity-mcp/commit/b0b15e8597d5a79c064388be38c3ffe9c0e1fc09)), closes [#114](https://github.com/Daghis/teamcity-mcp/issues/114)
87
+ * **teamcity:** resolve nested artifact downloads ([#188](https://github.com/Daghis/teamcity-mcp/issues/188)) ([e309b90](https://github.com/Daghis/teamcity-mcp/commit/e309b90de42fe121f072fe5b549ab25df3a91aaf))
88
+ * **teamcity:** restore artifact rules update compatibility ([#185](https://github.com/Daghis/teamcity-mcp/issues/185)) ([1d67268](https://github.com/Daghis/teamcity-mcp/commit/1d67268e6ee837db38ab9be27a94a5f3e072ab83))
89
+ * **teamcity:** retain adapter api credentials ([#138](https://github.com/Daghis/teamcity-mcp/issues/138)) ([3ad31ed](https://github.com/Daghis/teamcity-mcp/commit/3ad31edf227eac904eee84ec3a80d16455ae37fc)), closes [#135](https://github.com/Daghis/teamcity-mcp/issues/135)
90
+ * **teamcity:** route results + problems via shared client ([#111](https://github.com/Daghis/teamcity-mcp/issues/111)) ([3797bb5](https://github.com/Daghis/teamcity-mcp/commit/3797bb57d8421e2cb243112a9b1cdfda92fff1f7))
91
+ * **tools:** allow manage_build_steps updates ([#182](https://github.com/Daghis/teamcity-mcp/issues/182)) ([2c6bea0](https://github.com/Daghis/teamcity-mcp/commit/2c6bea0cf6770d22068b9e4b733542a056399148))
92
+ * **tools:** ensure multi-ref branchSpec; remove alias logic ([#103](https://github.com/Daghis/teamcity-mcp/issues/103)) ([5012439](https://github.com/Daghis/teamcity-mcp/commit/5012439caa926422960d5ac569579a3a725732ad))
93
+ * **tools:** harden batch artifact streaming outputs ([#177](https://github.com/Daghis/teamcity-mcp/issues/177)) ([0874325](https://github.com/Daghis/teamcity-mcp/commit/0874325c77aa2a79050cff57fced0aeec5a55ba0))
94
+ * **tools:** merge build step defaults during update (199) ([#203](https://github.com/Daghis/teamcity-mcp/issues/203)) ([43a668f](https://github.com/Daghis/teamcity-mcp/commit/43a668f0bdc3b0f69c6a3bca0e2a47c49f1cd1a7))
95
+ * **tools:** migrate MCP handlers to unified client ([#141](https://github.com/Daghis/teamcity-mcp/issues/141)) ([bc3a909](https://github.com/Daghis/teamcity-mcp/commit/bc3a909f6eb8c30798865c8b48604aca5405efc8))
96
+ * **tools:** repair manage_build_steps updates ([#154](https://github.com/Daghis/teamcity-mcp/issues/154)) ([b557e44](https://github.com/Daghis/teamcity-mcp/commit/b557e4424d5129de9d3b6e3240e1a876488da040))
97
+ * **tools:** stabilize batch artifact downloads ([#175](https://github.com/Daghis/teamcity-mcp/issues/175)) ([91a0ec3](https://github.com/Daghis/teamcity-mcp/commit/91a0ec33ac61e680dd34393fca46914e2ba3fe7f))
98
+ * **tools:** update_build_config uses 'settings/artifactRules' path; add tests ([#66](https://github.com/Daghis/teamcity-mcp/issues/66)) ([8b8afc6](https://github.com/Daghis/teamcity-mcp/commit/8b8afc6f41038bcde21a50a8662f90fa4acb7e9a))
99
+ * trigger 1.0.2 release (no functional change) ([392be27](https://github.com/Daghis/teamcity-mcp/commit/392be27fe705d55fb8a3057120ff5e2c0a41ca8a))
100
+ * trigger 1.0.3 release (no functional change) ([069212a](https://github.com/Daghis/teamcity-mcp/commit/069212a181861b17e7a1d5cfda05b40c2d11e933))
101
+
102
+
103
+ ### Miscellaneous Chores
104
+
105
+ * release 0.1.2 ([21e2595](https://github.com/Daghis/teamcity-mcp/commit/21e25950074ed49bd3e6c571f432f27fb8bd434e))
106
+
3
107
  ## [1.9.4](https://github.com/Daghis/teamcity-mcp/compare/v1.9.3...v1.9.4) (2025-09-25)
4
108
 
5
109
  ### Bug Fixes
package/dist/index.js CHANGED
@@ -1891,11 +1891,37 @@ var BuildResultsManager = class _BuildResultsManager {
1891
1891
  }
1892
1892
  return result;
1893
1893
  } catch (error2) {
1894
- const errorMessage = error2 instanceof Error ? error2.message : String(error2);
1895
- if (errorMessage.includes("not found")) {
1896
- throw new Error(`Build not found: ${buildId}`);
1894
+ if (error2 instanceof TeamCityAPIError) {
1895
+ if (error2.statusCode === 404) {
1896
+ throw new TeamCityNotFoundError("Build", buildId, error2.requestId, error2);
1897
+ }
1898
+ throw error2;
1897
1899
  }
1898
- throw new Error(`Failed to fetch build results: ${errorMessage}`);
1900
+ if (this.isAxiosNotFound(error2)) {
1901
+ const axiosError = error2;
1902
+ const apiError = TeamCityAPIError.fromAxiosError(axiosError);
1903
+ if (apiError.statusCode === 404) {
1904
+ throw new TeamCityNotFoundError("Build", buildId, apiError.requestId, apiError);
1905
+ }
1906
+ throw apiError;
1907
+ }
1908
+ const message = error2 instanceof Error ? error2.message : String(error2);
1909
+ if (/not found/i.test(message)) {
1910
+ throw new TeamCityNotFoundError(
1911
+ "Build",
1912
+ buildId,
1913
+ void 0,
1914
+ error2 instanceof Error ? error2 : void 0
1915
+ );
1916
+ }
1917
+ throw new TeamCityAPIError(
1918
+ `Failed to fetch build results: ${message}`,
1919
+ "GET_BUILD_RESULTS_FAILED",
1920
+ void 0,
1921
+ void 0,
1922
+ void 0,
1923
+ error2 instanceof Error ? error2 : void 0
1924
+ );
1899
1925
  }
1900
1926
  }
1901
1927
  /**
@@ -2407,6 +2433,10 @@ var BuildResultsManager = class _BuildResultsManager {
2407
2433
  getCacheKey(buildId, options) {
2408
2434
  return `${buildId}:${JSON.stringify(options)}`;
2409
2435
  }
2436
+ isAxiosNotFound(error2) {
2437
+ const axiosError = error2;
2438
+ return Boolean(axiosError?.response && axiosError.response.status === 404);
2439
+ }
2410
2440
  /**
2411
2441
  * Get from cache if valid
2412
2442
  */
@@ -38988,6 +39018,17 @@ var DEV_TOOLS = [
38988
39018
  type: "object",
38989
39019
  properties: {
38990
39020
  buildId: { type: "string", description: "Build ID" },
39021
+ buildTypeId: {
39022
+ type: "string",
39023
+ description: "Build configuration ID when resolving by number"
39024
+ },
39025
+ buildNumber: {
39026
+ oneOf: [
39027
+ { type: "string", description: "Build number as TeamCity displays it" },
39028
+ { type: "number", description: "Numeric build number" }
39029
+ ],
39030
+ description: "Build number when buildId is not available"
39031
+ },
38991
39032
  includeArtifacts: {
38992
39033
  type: "boolean",
38993
39034
  description: "Include artifacts listing and metadata"
@@ -39006,12 +39047,13 @@ var DEV_TOOLS = [
39006
39047
  enum: ["base64", "stream"],
39007
39048
  default: "base64"
39008
39049
  }
39009
- },
39010
- required: ["buildId"]
39050
+ }
39011
39051
  },
39012
39052
  handler: async (args) => {
39013
39053
  const schema = import_zod4.z.object({
39014
- buildId: import_zod4.z.string().min(1),
39054
+ buildId: import_zod4.z.string().min(1).optional(),
39055
+ buildTypeId: import_zod4.z.string().min(1).optional(),
39056
+ buildNumber: import_zod4.z.union([import_zod4.z.string().min(1), import_zod4.z.number().int()]).optional(),
39015
39057
  includeArtifacts: import_zod4.z.boolean().optional(),
39016
39058
  includeStatistics: import_zod4.z.boolean().optional(),
39017
39059
  includeChanges: import_zod4.z.boolean().optional(),
@@ -39019,6 +39061,24 @@ var DEV_TOOLS = [
39019
39061
  artifactFilter: import_zod4.z.string().min(1).optional(),
39020
39062
  maxArtifactSize: import_zod4.z.number().int().min(1).optional(),
39021
39063
  artifactEncoding: import_zod4.z.enum(["base64", "stream"]).default("base64")
39064
+ }).superRefine((value, ctx) => {
39065
+ const hasBuildId = typeof value.buildId === "string" && value.buildId.trim().length > 0;
39066
+ const hasBuildType = typeof value.buildTypeId === "string" && value.buildTypeId.trim().length > 0;
39067
+ const hasBuildNumber = value.buildNumber !== void 0 && String(value.buildNumber).trim().length > 0;
39068
+ if (hasBuildType !== hasBuildNumber) {
39069
+ ctx.addIssue({
39070
+ code: import_zod4.z.ZodIssueCode.custom,
39071
+ message: "buildTypeId and buildNumber must be provided together",
39072
+ path: hasBuildType ? ["buildNumber"] : ["buildTypeId"]
39073
+ });
39074
+ }
39075
+ if (!hasBuildId && !(hasBuildType && hasBuildNumber)) {
39076
+ ctx.addIssue({
39077
+ code: import_zod4.z.ZodIssueCode.custom,
39078
+ message: "Provide either buildId or buildTypeId with buildNumber",
39079
+ path: ["buildId"]
39080
+ });
39081
+ }
39022
39082
  });
39023
39083
  return runTool(
39024
39084
  "get_build_results",
@@ -39026,16 +39086,42 @@ var DEV_TOOLS = [
39026
39086
  async (typed) => {
39027
39087
  const adapter = createAdapterFromTeamCityAPI(TeamCityAPI.getInstance());
39028
39088
  const manager = new BuildResultsManager(adapter);
39029
- const result = await manager.getBuildResults(typed.buildId, {
39030
- includeArtifacts: typed.includeArtifacts,
39031
- includeStatistics: typed.includeStatistics,
39032
- includeChanges: typed.includeChanges,
39033
- includeDependencies: typed.includeDependencies,
39034
- artifactFilter: typed.artifactFilter,
39035
- maxArtifactSize: typed.maxArtifactSize,
39036
- artifactEncoding: typed.artifactEncoding
39037
- });
39038
- return json(result);
39089
+ const trimmedBuildId = typeof typed.buildId === "string" ? typed.buildId.trim() : void 0;
39090
+ const hasBuildId = typeof trimmedBuildId === "string" && trimmedBuildId.length > 0;
39091
+ const buildTypeId = typed.buildTypeId?.trim();
39092
+ const buildNumberRaw = typed.buildNumber;
39093
+ const buildNumber = typeof buildNumberRaw === "number" ? buildNumberRaw.toString() : buildNumberRaw?.toString().trim();
39094
+ let buildLocator;
39095
+ let friendlyIdentifier;
39096
+ if (hasBuildId && trimmedBuildId) {
39097
+ buildLocator = trimmedBuildId;
39098
+ friendlyIdentifier = `ID '${trimmedBuildId}'`;
39099
+ } else if (buildTypeId && buildNumber) {
39100
+ buildLocator = `buildType:(id:${buildTypeId}),number:${buildNumber}`;
39101
+ friendlyIdentifier = `build type '${buildTypeId}' and number ${buildNumber}`;
39102
+ } else {
39103
+ throw new TeamCityAPIError(
39104
+ "Unable to resolve build identifier",
39105
+ "INVALID_BUILD_IDENTIFIER"
39106
+ );
39107
+ }
39108
+ try {
39109
+ const result = await manager.getBuildResults(buildLocator, {
39110
+ includeArtifacts: typed.includeArtifacts,
39111
+ includeStatistics: typed.includeStatistics,
39112
+ includeChanges: typed.includeChanges,
39113
+ includeDependencies: typed.includeDependencies,
39114
+ artifactFilter: typed.artifactFilter,
39115
+ maxArtifactSize: typed.maxArtifactSize,
39116
+ artifactEncoding: typed.artifactEncoding ?? "base64"
39117
+ });
39118
+ return json(result);
39119
+ } catch (error2) {
39120
+ if (error2 instanceof TeamCityNotFoundError) {
39121
+ throw new TeamCityNotFoundError("Build", friendlyIdentifier, error2.requestId, error2);
39122
+ }
39123
+ throw error2;
39124
+ }
39039
39125
  },
39040
39126
  args
39041
39127
  );
@@ -40505,6 +40591,16 @@ var FULL_MODE_TOOLS = [
40505
40591
  }
40506
40592
  }
40507
40593
  });
40594
+ const decodeScriptContent = (key, value) => {
40595
+ if (key !== "script.content" && key !== "kotlinScript.content") {
40596
+ return value;
40597
+ }
40598
+ const normalised = value.replace(/\r\n/g, "\n");
40599
+ if (!normalised.includes("\\")) {
40600
+ return normalised;
40601
+ }
40602
+ return normalised.replace(/\\r\\n/g, "\n").replace(/\\r/g, "\n").replace(/\\n/g, "\n");
40603
+ };
40508
40604
  return runTool(
40509
40605
  "manage_build_steps",
40510
40606
  schema,
@@ -40513,7 +40609,10 @@ var FULL_MODE_TOOLS = [
40513
40609
  switch (typedArgs.action) {
40514
40610
  case "add": {
40515
40611
  const stepProps = Object.fromEntries(
40516
- Object.entries(typedArgs.properties ?? {}).map(([k, v]) => [k, String(v)])
40612
+ Object.entries(typedArgs.properties ?? {}).map(([k, v]) => {
40613
+ const value = String(v);
40614
+ return [k, decodeScriptContent(k, value)];
40615
+ })
40517
40616
  );
40518
40617
  if (typedArgs.type === "simpleRunner" && stepProps["script.content"]) {
40519
40618
  stepProps["use.custom.script"] = stepProps["use.custom.script"] ?? "true";
@@ -40577,7 +40676,10 @@ var FULL_MODE_TOOLS = [
40577
40676
  }
40578
40677
  const rawProps = typedArgs.properties ?? {};
40579
40678
  const providedProps = Object.fromEntries(
40580
- Object.entries(rawProps).map(([k, v]) => [k, String(v)])
40679
+ Object.entries(rawProps).map(([k, v]) => {
40680
+ const value = String(v);
40681
+ return [k, decodeScriptContent(k, value)];
40682
+ })
40581
40683
  );
40582
40684
  const mergedProps = {
40583
40685
  ...existingProperties,