@daghis/teamcity-mcp 1.0.2 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.4](https://github.com/Daghis/teamcity-mcp/compare/v1.0.3...v1.0.4) (2025-09-12)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **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)
9
+
3
10
  ## [1.0.2](https://github.com/Daghis/teamcity-mcp/compare/v1.0.1...v1.0.2) (2025-09-12)
4
11
 
5
12
 
package/dist/index.js CHANGED
@@ -25788,18 +25788,59 @@ var DEV_TOOLS = [
25788
25788
  inputSchema: {
25789
25789
  type: "object",
25790
25790
  properties: {
25791
- locator: { type: "string", description: "Optional health item locator filter" }
25791
+ locator: {
25792
+ type: "string",
25793
+ description: "Optional health item locator filter. Omit or empty string fetches all items."
25794
+ }
25792
25795
  }
25793
25796
  },
25794
25797
  handler: async (args) => {
25795
- const schema = import_zod4.z.object({ locator: import_zod4.z.string().min(1).optional() });
25798
+ const schema = import_zod4.z.object({ locator: import_zod4.z.string().optional() });
25796
25799
  return runTool(
25797
25800
  "list_server_health_items",
25798
25801
  schema,
25799
25802
  async (typed) => {
25800
25803
  const api = TeamCityAPI.getInstance();
25801
- const response = await api.health.getHealthItems(typed.locator);
25802
- return json(response.data);
25804
+ const normalized = (() => {
25805
+ const raw = typeof typed.locator === "string" ? typed.locator.trim() : void 0;
25806
+ if (!raw || raw.length === 0) return void 0;
25807
+ return raw.replace(/category:\s*\((ERROR|WARNING|INFO)\)/g, "category:$1");
25808
+ })();
25809
+ try {
25810
+ const response = await api.health.getHealthItems(normalized);
25811
+ return json(response.data);
25812
+ } catch (err) {
25813
+ const isHttp400 = err?.statusCode === 400 || err?.code === "VALIDATION_ERROR";
25814
+ if (!isHttp400) throw err;
25815
+ const all = await api.health.getHealthItems();
25816
+ const rawItems = all.data?.healthItem ?? [];
25817
+ const filter = (item) => {
25818
+ if (!normalized) return true;
25819
+ const clauses = normalized.split(",").map((s) => s.trim()).filter(Boolean);
25820
+ for (const c of clauses) {
25821
+ const [k, v] = c.split(":");
25822
+ if (!k || v === void 0) continue;
25823
+ const key = k.trim();
25824
+ const val = v.trim();
25825
+ if (key === "severity") {
25826
+ if (String(item["severity"] ?? "").toUpperCase() !== val.toUpperCase())
25827
+ return false;
25828
+ } else if (key === "category") {
25829
+ if (String(item["category"] ?? "") !== val) return false;
25830
+ } else if (key === "id") {
25831
+ if (String(item["id"] ?? "") !== val) return false;
25832
+ }
25833
+ }
25834
+ return true;
25835
+ };
25836
+ const items = rawItems.filter(filter);
25837
+ return json({
25838
+ count: items.length,
25839
+ healthItem: items,
25840
+ href: "/app/rest/health",
25841
+ note: "Applied client-side filtering due to TeamCity 400 on locator. Unsupported filters ignored."
25842
+ });
25843
+ }
25803
25844
  },
25804
25845
  args
25805
25846
  );