@voxslopuli/teamdynamix-mcp 0.4.1 → 0.5.0
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/README.md +42 -0
- package/index.js +483 -827
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,205 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
WorkspaceWatchService
|
|
4
|
+
} from "./chunk-XSNNBHPV.js";
|
|
5
|
+
import {
|
|
6
|
+
LedgerCorruptError,
|
|
7
|
+
defaultLedgerPath,
|
|
8
|
+
emptyLedger,
|
|
9
|
+
loadLedger
|
|
10
|
+
} from "./chunk-GTVZKRFG.js";
|
|
11
|
+
import {
|
|
12
|
+
CHARACTER_LIMIT,
|
|
13
|
+
LOG_LEVEL,
|
|
14
|
+
SERVER_NAME,
|
|
15
|
+
SERVER_NAME_OVERRIDE,
|
|
16
|
+
SERVER_VERSION,
|
|
17
|
+
SERVER_VERSION_OVERRIDE,
|
|
18
|
+
TEAMDYNAMIX_TOOL_PREFIX,
|
|
19
|
+
assertDeleteToolsEnabled,
|
|
20
|
+
assertWriteToolsEnabled,
|
|
21
|
+
createConfiguredTeamDynamixClient,
|
|
22
|
+
getTeamDynamixConfig,
|
|
23
|
+
getTeamDynamixConfigStatus
|
|
24
|
+
} from "./chunk-MARAUVWU.js";
|
|
2
25
|
|
|
3
26
|
// src/index.ts
|
|
4
27
|
import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
28
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
29
|
|
|
7
|
-
// src/config.ts
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
|
|
10
|
-
// package.json
|
|
11
|
-
var package_default = {
|
|
12
|
-
name: "@voxslopuli/teamdynamix-mcp",
|
|
13
|
-
version: "0.4.1",
|
|
14
|
-
private: false,
|
|
15
|
-
description: "A production-ready TypeScript MCP server for TeamDynamix",
|
|
16
|
-
keywords: [
|
|
17
|
-
"mcp",
|
|
18
|
-
"model context protocol",
|
|
19
|
-
"server",
|
|
20
|
-
"tdx",
|
|
21
|
-
"teamdynamix",
|
|
22
|
-
"typescript"
|
|
23
|
-
],
|
|
24
|
-
homepage: "https://github.com/voxslopuli/teamdynamix-mcp",
|
|
25
|
-
bugs: {
|
|
26
|
-
url: "https://github.com/voxslopuli/teamdynamix-mcp/issues"
|
|
27
|
-
},
|
|
28
|
-
license: "MIT",
|
|
29
|
-
author: "Grand Slopulissimo <slopulissimo@voxslopuli.org>",
|
|
30
|
-
repository: {
|
|
31
|
-
type: "git",
|
|
32
|
-
url: "git+https://github.com/voxslopuli/teamdynamix-mcp.git"
|
|
33
|
-
},
|
|
34
|
-
bin: "dist/index.js",
|
|
35
|
-
type: "module",
|
|
36
|
-
main: "dist/index.js",
|
|
37
|
-
scripts: {
|
|
38
|
-
build: "tsup",
|
|
39
|
-
postbuild: "node scripts/write-dist-package.js",
|
|
40
|
-
dev: "tsx watch src/index.ts",
|
|
41
|
-
"docs:build": "node scripts/prepare-docs-public.js && vitepress build docs",
|
|
42
|
-
"docs:dev": "vitepress dev docs",
|
|
43
|
-
"docs:preview": "vitepress preview docs",
|
|
44
|
-
format: "oxfmt . --write",
|
|
45
|
-
"format:check": "oxfmt . --check",
|
|
46
|
-
lint: "oxlint .",
|
|
47
|
-
"lint:fix": "oxlint . --fix",
|
|
48
|
-
prepare: "husky",
|
|
49
|
-
start: "node dist/index.js",
|
|
50
|
-
test: "vitest run",
|
|
51
|
-
"test:coverage": "vitest run --coverage",
|
|
52
|
-
typecheck: "tsc --noEmit"
|
|
53
|
-
},
|
|
54
|
-
dependencies: {
|
|
55
|
-
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
56
|
-
"@voxslopuli/teamdynamix-ts": "^0.2.0",
|
|
57
|
-
tablemark: "^4.1.0",
|
|
58
|
-
zod: "^4.6.2"
|
|
59
|
-
},
|
|
60
|
-
devDependencies: {
|
|
61
|
-
"@octokit/rest": "^22.0.1",
|
|
62
|
-
"@types/node": "25.9.2",
|
|
63
|
-
"@vitest/coverage-v8": "^5.0.0",
|
|
64
|
-
husky: "^9.1.7",
|
|
65
|
-
"lint-staged": "^17.5.1",
|
|
66
|
-
ora: "^9.4.1",
|
|
67
|
-
oxfmt: "^0.67.0",
|
|
68
|
-
oxlint: "^1.82.0",
|
|
69
|
-
tsup: "^8.5.1",
|
|
70
|
-
tsx: "^4.23.13",
|
|
71
|
-
typescript: "6.0.3",
|
|
72
|
-
vite: "8.3.0",
|
|
73
|
-
vitepress: "^1.6.4",
|
|
74
|
-
vitest: "5.0.0",
|
|
75
|
-
zx: "^8.8.5"
|
|
76
|
-
},
|
|
77
|
-
"lint-staged": {
|
|
78
|
-
"*.{ts,mts,cts,js,mjs,cjs}": [
|
|
79
|
-
"oxlint --fix --no-error-on-unmatched-pattern",
|
|
80
|
-
"oxfmt --no-error-on-unmatched-pattern --write"
|
|
81
|
-
],
|
|
82
|
-
"*.{json,yaml,yml,md}": [
|
|
83
|
-
"oxfmt --no-error-on-unmatched-pattern --write"
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
packageManager: "pnpm@10.32.1",
|
|
87
|
-
pnpm: {
|
|
88
|
-
overrides: {
|
|
89
|
-
hono: ">=4.12.18",
|
|
90
|
-
"@hono/node-server": ">=1.19.13"
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
mcpName: "io.github.selfagency/teamdynamix-mcp"
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// src/constants.ts
|
|
97
|
-
var SERVER_NAME = "teamdynamix-mcp";
|
|
98
|
-
var SERVER_VERSION = package_default.version;
|
|
99
|
-
var CHARACTER_LIMIT = 25e3;
|
|
100
|
-
var TEAMDYNAMIX_TOOL_PREFIX = "teamdynamix";
|
|
101
|
-
var TEAMDYNAMIX_DEFAULT_TIMEOUT_MS = 3e4;
|
|
102
|
-
var TEAMDYNAMIX_DEFAULT_MAX_RETRIES = 2;
|
|
103
|
-
var TEAMDYNAMIX_MAX_RETRY_ATTEMPTS = 5;
|
|
104
|
-
|
|
105
|
-
// src/config.ts
|
|
106
|
-
var SERVER_NAME_OVERRIDE = process.env["MCP_SERVER_NAME"]?.trim() || void 0;
|
|
107
|
-
var SERVER_VERSION_OVERRIDE = process.env["MCP_SERVER_VERSION"]?.trim() || void 0;
|
|
108
|
-
var validLogLevels = ["debug", "info", "warn", "error"];
|
|
109
|
-
var logLevelSchema = z.enum(validLogLevels);
|
|
110
|
-
var parsedLogLevel = logLevelSchema.safeParse(process.env["MCP_LOG_LEVEL"]?.trim());
|
|
111
|
-
var LOG_LEVEL = parsedLogLevel.success ? parsedLogLevel.data : "info";
|
|
112
|
-
function normalizeOptionalString(value) {
|
|
113
|
-
const normalized = value?.trim();
|
|
114
|
-
return normalized ? normalized : void 0;
|
|
115
|
-
}
|
|
116
|
-
function normalizeOptionalNumber(value) {
|
|
117
|
-
if (!value?.trim()) {
|
|
118
|
-
return void 0;
|
|
119
|
-
}
|
|
120
|
-
const parsed = Number.parseInt(value, 10);
|
|
121
|
-
return Number.isFinite(parsed) && parsed > 0 ? parsed : void 0;
|
|
122
|
-
}
|
|
123
|
-
function normalizeBoolean(value, defaultValue) {
|
|
124
|
-
if (!value) {
|
|
125
|
-
return defaultValue;
|
|
126
|
-
}
|
|
127
|
-
const normalized = value.trim().toLowerCase();
|
|
128
|
-
if (normalized === "true") return true;
|
|
129
|
-
if (normalized === "false") return false;
|
|
130
|
-
return defaultValue;
|
|
131
|
-
}
|
|
132
|
-
function normalizeNumberWithDefault(value, defaultValue, minimum) {
|
|
133
|
-
if (!value?.trim()) {
|
|
134
|
-
return defaultValue;
|
|
135
|
-
}
|
|
136
|
-
const parsed = Number.parseInt(value, 10);
|
|
137
|
-
return Number.isFinite(parsed) && parsed >= minimum ? parsed : defaultValue;
|
|
138
|
-
}
|
|
139
|
-
function normalizeTeamDynamixBaseUrl(value) {
|
|
140
|
-
const normalized = normalizeOptionalString(value);
|
|
141
|
-
return normalized ? normalized.replace(/\/+$/, "") : void 0;
|
|
142
|
-
}
|
|
143
|
-
function validateHttpsBaseUrl(value) {
|
|
144
|
-
if (!value) return void 0;
|
|
145
|
-
const schema = z.string().url().refine((url) => url.startsWith("https://"), {
|
|
146
|
-
message: "TEAMDYNAMIX_BASE_URL must be an https URL."
|
|
147
|
-
});
|
|
148
|
-
const parsed = schema.safeParse(value);
|
|
149
|
-
if (!parsed.success) {
|
|
150
|
-
throw new Error(parsed.error.issues[0]?.message ?? "Invalid TEAMDYNAMIX_BASE_URL.");
|
|
151
|
-
}
|
|
152
|
-
return value;
|
|
153
|
-
}
|
|
154
|
-
function normalizeTeamDynamixAuthMode(value) {
|
|
155
|
-
return value?.trim().toLowerCase() === "admin" ? "admin" : "standard";
|
|
156
|
-
}
|
|
157
|
-
function getTeamDynamixConfig() {
|
|
158
|
-
const baseUrl = validateHttpsBaseUrl(normalizeTeamDynamixBaseUrl(process.env["TEAMDYNAMIX_BASE_URL"]));
|
|
159
|
-
const maxRetries = normalizeNumberWithDefault(
|
|
160
|
-
process.env["TEAMDYNAMIX_MAX_RETRIES"],
|
|
161
|
-
TEAMDYNAMIX_DEFAULT_MAX_RETRIES,
|
|
162
|
-
0
|
|
163
|
-
);
|
|
164
|
-
if (maxRetries > 5) {
|
|
165
|
-
throw new Error(`TEAMDYNAMIX_MAX_RETRIES must be between 0 and ${TEAMDYNAMIX_MAX_RETRY_ATTEMPTS}.`);
|
|
166
|
-
}
|
|
167
|
-
return {
|
|
168
|
-
baseUrl,
|
|
169
|
-
authMode: normalizeTeamDynamixAuthMode(process.env["TEAMDYNAMIX_AUTH_MODE"]),
|
|
170
|
-
username: normalizeOptionalString(process.env["TEAMDYNAMIX_USERNAME"]),
|
|
171
|
-
password: normalizeOptionalString(process.env["TEAMDYNAMIX_PASSWORD"]),
|
|
172
|
-
beid: normalizeOptionalString(process.env["TEAMDYNAMIX_BEID"]),
|
|
173
|
-
webServicesKey: normalizeOptionalString(process.env["TEAMDYNAMIX_WEB_SERVICES_KEY"]),
|
|
174
|
-
defaultTicketAppId: normalizeOptionalNumber(process.env["TEAMDYNAMIX_DEFAULT_TICKET_APP_ID"]),
|
|
175
|
-
defaultAssetAppId: normalizeOptionalNumber(process.env["TEAMDYNAMIX_DEFAULT_ASSET_APP_ID"]),
|
|
176
|
-
defaultKnowledgeBaseAppId: normalizeOptionalNumber(process.env["TEAMDYNAMIX_DEFAULT_KB_APP_ID"]),
|
|
177
|
-
timeoutMs: normalizeNumberWithDefault(process.env["TEAMDYNAMIX_TIMEOUT_MS"], TEAMDYNAMIX_DEFAULT_TIMEOUT_MS, 1e3),
|
|
178
|
-
maxRetries,
|
|
179
|
-
enableWriteTools: normalizeBoolean(process.env["TEAMDYNAMIX_ENABLE_WRITE_TOOLS"], false),
|
|
180
|
-
enableAdminTools: normalizeBoolean(process.env["TEAMDYNAMIX_ENABLE_ADMIN_TOOLS"], false),
|
|
181
|
-
enableDeleteTools: normalizeBoolean(process.env["TEAMDYNAMIX_ENABLE_DELETE_TOOLS"], false)
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
function getTeamDynamixConfigStatus(config = getTeamDynamixConfig()) {
|
|
185
|
-
const missing = /* @__PURE__ */ new Set();
|
|
186
|
-
if (!config.baseUrl) {
|
|
187
|
-
missing.add("TEAMDYNAMIX_BASE_URL");
|
|
188
|
-
}
|
|
189
|
-
if (config.authMode === "admin") {
|
|
190
|
-
if (!config.beid) missing.add("TEAMDYNAMIX_BEID");
|
|
191
|
-
if (!config.webServicesKey) missing.add("TEAMDYNAMIX_WEB_SERVICES_KEY");
|
|
192
|
-
} else {
|
|
193
|
-
if (!config.username) missing.add("TEAMDYNAMIX_USERNAME");
|
|
194
|
-
if (!config.password) missing.add("TEAMDYNAMIX_PASSWORD");
|
|
195
|
-
}
|
|
196
|
-
return {
|
|
197
|
-
configured: missing.size === 0,
|
|
198
|
-
missing: [...missing],
|
|
199
|
-
authMode: config.authMode
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
30
|
// src/resources/teamdynamix.resources.ts
|
|
204
31
|
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
205
32
|
|
|
@@ -223,604 +50,229 @@ function redactTeamDynamixConfig(config) {
|
|
|
223
50
|
}
|
|
224
51
|
|
|
225
52
|
// src/tools/teamdynamix.domain-gateways.tools.ts
|
|
226
|
-
import { z as
|
|
53
|
+
import { z as z3 } from "zod";
|
|
227
54
|
|
|
228
55
|
// src/schemas/teamdynamix/index.ts
|
|
229
|
-
import { z as
|
|
56
|
+
import { z as z2 } from "zod";
|
|
230
57
|
|
|
231
58
|
// src/schemas/index.ts
|
|
232
|
-
import { z
|
|
233
|
-
var ResponseFormatSchema =
|
|
234
|
-
var TextTransformModeSchema =
|
|
59
|
+
import { z } from "zod";
|
|
60
|
+
var ResponseFormatSchema = z.enum(["markdown", "json"]).default("markdown").describe("Output format for the response.");
|
|
61
|
+
var TextTransformModeSchema = z.enum(["uppercase", "lowercase", "trim", "slug"]).describe("Transformation mode to apply to the input text.");
|
|
235
62
|
|
|
236
63
|
// src/schemas/teamdynamix/index.ts
|
|
237
|
-
var TeamDynamixAppIdSchema =
|
|
238
|
-
var IsoDateSchema =
|
|
64
|
+
var TeamDynamixAppIdSchema = z2.number().int().positive().describe("TeamDynamix application ID.");
|
|
65
|
+
var IsoDateSchema = z2.string().regex(
|
|
239
66
|
/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/,
|
|
240
67
|
"Must be a valid ISO 8601 date string."
|
|
241
68
|
);
|
|
242
|
-
var TeamDynamixGuidSchema =
|
|
69
|
+
var TeamDynamixGuidSchema = z2.string().uuid().describe("TeamDynamix GUID identifier.");
|
|
243
70
|
var TeamDynamixResponseFormatSchema = ResponseFormatSchema;
|
|
244
|
-
var TicketSearchSchema =
|
|
245
|
-
Keywords:
|
|
246
|
-
MaxResults:
|
|
247
|
-
StatusIDs:
|
|
248
|
-
TypeIDs:
|
|
249
|
-
PriorityIDs:
|
|
250
|
-
UrgencyIDs:
|
|
251
|
-
ImpactIDs:
|
|
252
|
-
AccountIDs:
|
|
253
|
-
ResponsibleGroupIDs:
|
|
254
|
-
ResponsibleUids:
|
|
255
|
-
RequestorUids:
|
|
71
|
+
var TicketSearchSchema = z2.object({
|
|
72
|
+
Keywords: z2.string().max(500).optional().describe("Full-text search term."),
|
|
73
|
+
MaxResults: z2.number().int().min(1).max(1e3).optional().default(50).describe("Maximum results to return (1\u20131000)."),
|
|
74
|
+
StatusIDs: z2.array(z2.number().int()).optional().describe("Filter by ticket status IDs."),
|
|
75
|
+
TypeIDs: z2.array(z2.number().int()).optional().describe("Filter by ticket type IDs."),
|
|
76
|
+
PriorityIDs: z2.array(z2.number().int()).optional().describe("Filter by ticket priority IDs."),
|
|
77
|
+
UrgencyIDs: z2.array(z2.number().int()).optional().describe("Filter by ticket urgency IDs."),
|
|
78
|
+
ImpactIDs: z2.array(z2.number().int()).optional().describe("Filter by ticket impact IDs."),
|
|
79
|
+
AccountIDs: z2.array(z2.number().int()).optional().describe("Filter by account/department IDs."),
|
|
80
|
+
ResponsibleGroupIDs: z2.array(z2.number().int()).optional().describe("Filter by responsible group IDs."),
|
|
81
|
+
ResponsibleUids: z2.array(z2.string().uuid()).optional().describe("Filter by responsible user GUIDs."),
|
|
82
|
+
RequestorUids: z2.array(z2.string().uuid()).optional().describe("Filter by requestor user GUIDs."),
|
|
256
83
|
CreatedDateFrom: IsoDateSchema.optional().describe("ISO 8601 start date for creation date filter."),
|
|
257
84
|
CreatedDateTo: IsoDateSchema.optional().describe("ISO 8601 end date for creation date filter."),
|
|
258
85
|
ModifiedDateFrom: IsoDateSchema.optional().describe("ISO 8601 start date for last-modified filter."),
|
|
259
86
|
ModifiedDateTo: IsoDateSchema.optional().describe("ISO 8601 end date for last-modified filter."),
|
|
260
87
|
ClosedDateFrom: IsoDateSchema.optional().describe("ISO 8601 start date for closed date filter."),
|
|
261
88
|
ClosedDateTo: IsoDateSchema.optional().describe("ISO 8601 end date for closed date filter."),
|
|
262
|
-
SortBy:
|
|
263
|
-
SortOrder:
|
|
89
|
+
SortBy: z2.string().max(100).optional().describe("Field name to sort results by."),
|
|
90
|
+
SortOrder: z2.enum(["A", "D"]).optional().describe("Sort order: A = ascending, D = descending.")
|
|
264
91
|
});
|
|
265
|
-
var TicketCreateSchema =
|
|
266
|
-
TypeID:
|
|
267
|
-
Title:
|
|
268
|
-
AccountID:
|
|
269
|
-
StatusID:
|
|
270
|
-
PriorityID:
|
|
271
|
-
UrgencyID:
|
|
272
|
-
ImpactID:
|
|
273
|
-
SourceID:
|
|
274
|
-
Description:
|
|
275
|
-
RequestorUID:
|
|
276
|
-
ResponsibleUID:
|
|
277
|
-
ResponsibleGroupID:
|
|
278
|
-
FormID:
|
|
279
|
-
Attributes:
|
|
280
|
-
|
|
281
|
-
ID:
|
|
282
|
-
Value:
|
|
92
|
+
var TicketCreateSchema = z2.object({
|
|
93
|
+
TypeID: z2.number().int().positive().describe("Ticket type ID."),
|
|
94
|
+
Title: z2.string().min(1).max(500).describe("Ticket title/subject."),
|
|
95
|
+
AccountID: z2.number().int().positive().optional().describe("Account/department ID."),
|
|
96
|
+
StatusID: z2.number().int().nonnegative().optional().describe("Initial ticket status ID."),
|
|
97
|
+
PriorityID: z2.number().int().nonnegative().optional().describe("Ticket priority ID."),
|
|
98
|
+
UrgencyID: z2.number().int().nonnegative().optional().describe("Ticket urgency ID."),
|
|
99
|
+
ImpactID: z2.number().int().nonnegative().optional().describe("Ticket impact ID."),
|
|
100
|
+
SourceID: z2.number().int().nonnegative().optional().describe("Ticket source ID."),
|
|
101
|
+
Description: z2.string().max(65535).optional().describe("Full description/body of the ticket (HTML supported)."),
|
|
102
|
+
RequestorUID: z2.string().uuid().optional().describe("GUID of the requestor."),
|
|
103
|
+
ResponsibleUID: z2.string().uuid().optional().describe("GUID of the responsible technician."),
|
|
104
|
+
ResponsibleGroupID: z2.number().int().positive().optional().describe("Responsible group ID."),
|
|
105
|
+
FormID: z2.number().int().positive().optional().describe("Ticket form ID."),
|
|
106
|
+
Attributes: z2.array(
|
|
107
|
+
z2.object({
|
|
108
|
+
ID: z2.number().int(),
|
|
109
|
+
Value: z2.string()
|
|
283
110
|
})
|
|
284
111
|
).optional().describe("Custom attribute values.")
|
|
285
112
|
});
|
|
286
|
-
var TicketPatchSchema =
|
|
287
|
-
TicketID:
|
|
288
|
-
Attributes:
|
|
113
|
+
var TicketPatchSchema = z2.object({
|
|
114
|
+
TicketID: z2.number().int().positive().describe("Ticket ID to update."),
|
|
115
|
+
Attributes: z2.record(z2.string().max(100), z2.string().max(65535)).refine((obj) => Object.keys(obj).length <= 50, { message: "Attributes may contain at most 50 fields per update." }).describe(
|
|
289
116
|
'Fields to update as key/value pairs. Keys must be valid ticket field names (e.g. "StatusID", "Title", "ResponsibleUID"). Maximum 50 fields per update.'
|
|
290
117
|
),
|
|
291
|
-
NotifyRequestor:
|
|
292
|
-
NotifyResponsible:
|
|
293
|
-
Comments:
|
|
294
|
-
IsPrivate:
|
|
295
|
-
});
|
|
296
|
-
var TicketCommentSchema = z3.object({
|
|
297
|
-
TicketID: z3.number().int().positive().describe("Ticket ID to comment on."),
|
|
298
|
-
Body: z3.string().min(1).max(65535).describe("Comment body (HTML supported)."),
|
|
299
|
-
IsPrivate: z3.boolean().optional().default(false).describe("Whether this comment is private."),
|
|
300
|
-
NotifyRequestor: z3.boolean().optional().default(false).describe("Notify the requestor."),
|
|
301
|
-
NotifyResponsible: z3.boolean().optional().default(false).describe("Notify the responsible technician.")
|
|
302
|
-
});
|
|
303
|
-
var UserSearchSchema = z3.object({
|
|
304
|
-
SearchText: z3.string().max(500).optional().describe("Name, username, or email to search for."),
|
|
305
|
-
IsActive: z3.boolean().optional().describe("Filter by active (true) or inactive (false) users."),
|
|
306
|
-
IsEmployee: z3.boolean().optional().describe("Filter to employees only."),
|
|
307
|
-
AppID: z3.number().int().positive().optional().describe("Scope search to a specific application."),
|
|
308
|
-
MaxResults: z3.number().int().min(1).max(1e3).optional().default(25).describe("Maximum results (1\u20131000).")
|
|
118
|
+
NotifyRequestor: z2.boolean().optional().default(false).describe("Notify the requestor of the change."),
|
|
119
|
+
NotifyResponsible: z2.boolean().optional().default(false).describe("Notify the responsible technician of the change."),
|
|
120
|
+
Comments: z2.string().max(65535).optional().describe("Comment to attach to this update."),
|
|
121
|
+
IsPrivate: z2.boolean().optional().default(false).describe("Whether the comment is private.")
|
|
309
122
|
});
|
|
310
|
-
var
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
123
|
+
var TicketCommentSchema = z2.object({
|
|
124
|
+
TicketID: z2.number().int().positive().describe("Ticket ID to comment on."),
|
|
125
|
+
Body: z2.string().min(1).max(65535).describe("Comment body (HTML supported)."),
|
|
126
|
+
IsPrivate: z2.boolean().optional().default(false).describe("Whether this comment is private."),
|
|
127
|
+
NotifyRequestor: z2.boolean().optional().default(false).describe("Notify the requestor."),
|
|
128
|
+
NotifyResponsible: z2.boolean().optional().default(false).describe("Notify the responsible technician.")
|
|
314
129
|
});
|
|
315
|
-
var
|
|
316
|
-
SearchText:
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
130
|
+
var UserSearchSchema = z2.object({
|
|
131
|
+
SearchText: z2.string().max(500).optional().describe("Name, username, or email to search for."),
|
|
132
|
+
AccountIDs: z2.array(z2.number().int()).optional().describe("Filter by account IDs (default account only)."),
|
|
133
|
+
AlternateID: z2.string().optional().describe("Filter by alternate ID."),
|
|
134
|
+
AppName: z2.string().optional().describe("Filter by system-defined application name."),
|
|
135
|
+
AuthenticationUserName: z2.string().optional().describe("Exact-match authentication username (max one result)."),
|
|
136
|
+
ExternalID: z2.string().optional().describe("Filter by external ID."),
|
|
137
|
+
IsActive: z2.boolean().optional().describe("Filter by active (true) or inactive (false) users."),
|
|
138
|
+
IsConfidential: z2.boolean().optional().describe("Filter by confidential status."),
|
|
139
|
+
IsEmployee: z2.boolean().optional().describe("Filter to employees only."),
|
|
140
|
+
MaxResults: z2.number().int().min(1).max(1e3).optional().describe("Maximum results (1-1000)."),
|
|
141
|
+
PhoneNumber: z2.string().optional().describe("Filter by phone number."),
|
|
142
|
+
ReferenceIDs: z2.array(z2.string()).optional().describe("Filter by user reference IDs (GUIDs)."),
|
|
143
|
+
SecurityRoleID: z2.number().int().optional().describe("Filter by security role ID."),
|
|
144
|
+
UserName: z2.string().optional().describe("Filter by username.")
|
|
145
|
+
}).strict();
|
|
146
|
+
var GroupSearchSchema = z2.object({
|
|
147
|
+
NameLike: z2.string().max(500).optional().describe("Partial group name to search."),
|
|
148
|
+
IsActive: z2.boolean().optional().describe("Filter by active (true) or inactive (false) groups."),
|
|
149
|
+
AssociatedAppID: z2.number().int().positive().optional().describe("Filter by associated application ID."),
|
|
150
|
+
HasAppID: z2.boolean().optional().describe("Filter to groups with (true) or without (false) an associated application."),
|
|
151
|
+
HasSystemAppName: z2.boolean().optional().describe("Filter to groups with (true) or without (false) a system app name.")
|
|
152
|
+
}).strict();
|
|
153
|
+
var KbArticleSearchSchema = z2.object({
|
|
154
|
+
SearchText: z2.string().max(500).optional().describe("Full-text search within articles."),
|
|
155
|
+
AuthorUID: z2.string().uuid().optional().describe("Filter by author GUID."),
|
|
156
|
+
CategoryID: z2.number().int().positive().optional().describe("Filter by KB category ID."),
|
|
157
|
+
CustomAttributes: z2.array(z2.record(z2.string(), z2.unknown())).optional().describe("Filter by custom attributes."),
|
|
158
|
+
IncludeArticleBodies: z2.boolean().optional().describe("Include article bodies in results."),
|
|
159
|
+
IncludeShortcuts: z2.boolean().optional().describe("Include shortcuts in results."),
|
|
160
|
+
IsPublic: z2.boolean().optional().describe("Filter by public visibility."),
|
|
161
|
+
IsPublished: z2.boolean().optional().describe("Filter to published articles only."),
|
|
162
|
+
ReturnCount: z2.number().int().min(1).max(500).optional().describe("Maximum results (1-500)."),
|
|
163
|
+
Status: z2.number().int().optional().describe("Filter by article status ID.")
|
|
164
|
+
}).strict();
|
|
165
|
+
var AssetSearchSchema = z2.object({
|
|
166
|
+
SerialLike: z2.string().max(200).optional().describe("Partial serial number to match."),
|
|
167
|
+
TagLike: z2.string().max(200).optional().describe("Partial asset tag to match."),
|
|
168
|
+
SearchText: z2.string().max(500).optional().describe("General text search across asset fields."),
|
|
169
|
+
StatusIDs: z2.array(z2.number().int()).optional().describe("Filter by asset status IDs."),
|
|
170
|
+
OwnerUID: z2.string().uuid().optional().describe("Filter by asset owner GUID."),
|
|
171
|
+
UsingDepartmentID: z2.number().int().positive().optional().describe("Filter by using department ID."),
|
|
172
|
+
MaxResults: z2.number().int().min(1).max(1e3).optional().default(25).describe("Maximum results (1\u20131000).")
|
|
320
173
|
});
|
|
321
|
-
var
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
OwnerUID: z3.string().uuid().optional().describe("Filter by asset owner GUID."),
|
|
327
|
-
UsingDepartmentID: z3.number().int().positive().optional().describe("Filter by using department ID."),
|
|
328
|
-
MaxResults: z3.number().int().min(1).max(1e3).optional().default(25).describe("Maximum results (1\u20131000).")
|
|
174
|
+
var ServiceSearchSchema = z2.object({
|
|
175
|
+
SearchText: z2.string().max(500).optional().describe("Full-text search across service fields."),
|
|
176
|
+
IsActive: z2.boolean().optional().describe("Filter to active services only."),
|
|
177
|
+
CategoryID: z2.number().int().positive().optional().describe("Filter by service category ID."),
|
|
178
|
+
MaxResults: z2.number().int().min(1).max(500).optional().default(25).describe("Maximum results (1\u2013500).")
|
|
329
179
|
});
|
|
330
|
-
var
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
180
|
+
var ProjectSearchSchema = z2.object({
|
|
181
|
+
NameLike: z2.string().max(500).optional().describe("Partial project name to search."),
|
|
182
|
+
TypeIDs: z2.array(z2.number().int()).optional().describe("Filter by project type IDs."),
|
|
183
|
+
IsActive: z2.boolean().optional().describe("Filter to active projects."),
|
|
184
|
+
ManagerUID: z2.string().uuid().optional().describe("Filter by project manager GUID."),
|
|
185
|
+
MaxResults: z2.number().int().min(1).max(500).optional().default(25).describe("Maximum results (1\u2013500).")
|
|
335
186
|
});
|
|
336
|
-
var
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
TicketID: z3.number().int().positive().describe("Parent ticket ID."),
|
|
345
|
-
Title: z3.string().min(1).max(500).describe("Task title."),
|
|
346
|
-
Description: z3.string().max(65535).optional().describe("Task description."),
|
|
347
|
-
IsActive: z3.boolean().optional().default(true).describe("Whether the task is active."),
|
|
348
|
-
AssignedUID: z3.string().uuid().optional().describe("GUID of the assigned user."),
|
|
349
|
-
AssignedGroupID: z3.number().int().positive().optional().describe("Assigned group ID."),
|
|
350
|
-
EstimatedMinutes: z3.number().int().nonnegative().optional().describe("Estimated minutes to complete."),
|
|
187
|
+
var TicketTaskCreateSchema = z2.object({
|
|
188
|
+
TicketID: z2.number().int().positive().describe("Parent ticket ID."),
|
|
189
|
+
Title: z2.string().min(1).max(500).describe("Task title."),
|
|
190
|
+
Description: z2.string().max(65535).optional().describe("Task description."),
|
|
191
|
+
IsActive: z2.boolean().optional().default(true).describe("Whether the task is active."),
|
|
192
|
+
AssignedUID: z2.string().uuid().optional().describe("GUID of the assigned user."),
|
|
193
|
+
AssignedGroupID: z2.number().int().positive().optional().describe("Assigned group ID."),
|
|
194
|
+
EstimatedMinutes: z2.number().int().nonnegative().optional().describe("Estimated minutes to complete."),
|
|
351
195
|
StartDate: IsoDateSchema.optional().describe("Task start date (ISO 8601)."),
|
|
352
196
|
EndDate: IsoDateSchema.optional().describe("Task due date (ISO 8601).")
|
|
353
197
|
});
|
|
354
|
-
var KbArticleCreateSchema =
|
|
355
|
-
Subject:
|
|
356
|
-
Body:
|
|
357
|
-
Summary:
|
|
358
|
-
CategoryID:
|
|
359
|
-
IsPublished:
|
|
360
|
-
Tags:
|
|
198
|
+
var KbArticleCreateSchema = z2.object({
|
|
199
|
+
Subject: z2.string().min(1).max(500).describe("Article title/subject."),
|
|
200
|
+
Body: z2.string().min(1).max(5e5).describe("Article body content (HTML supported)."),
|
|
201
|
+
Summary: z2.string().max(2e3).optional().describe("Short article summary."),
|
|
202
|
+
CategoryID: z2.number().int().positive().optional().describe("KB category ID."),
|
|
203
|
+
IsPublished: z2.boolean().optional().default(false).describe("Whether to publish the article immediately."),
|
|
204
|
+
Tags: z2.string().max(1e3).optional().describe("Comma-separated tags for the article.")
|
|
361
205
|
});
|
|
362
206
|
var KbArticleUpdateSchema = KbArticleCreateSchema.partial().extend({
|
|
363
|
-
ArticleID:
|
|
207
|
+
ArticleID: z2.number().int().positive().describe("KB article ID to update.")
|
|
364
208
|
});
|
|
365
|
-
var CiSearchSchema =
|
|
366
|
-
SearchText:
|
|
367
|
-
TypeIDs:
|
|
368
|
-
OwnerUID:
|
|
369
|
-
MaxResults:
|
|
209
|
+
var CiSearchSchema = z2.object({
|
|
210
|
+
SearchText: z2.string().max(500).optional().describe("Full-text search across CI fields."),
|
|
211
|
+
TypeIDs: z2.array(z2.number().int()).optional().describe("Filter by CI type IDs."),
|
|
212
|
+
OwnerUID: z2.string().uuid().optional().describe("Filter by owner GUID."),
|
|
213
|
+
MaxResults: z2.number().int().min(1).max(1e3).optional().default(25).describe("Maximum results (1\u20131000).")
|
|
370
214
|
});
|
|
371
|
-
var CustomAttributeComponentIdSchema =
|
|
215
|
+
var CustomAttributeComponentIdSchema = z2.number().int().positive().describe(
|
|
372
216
|
"TeamDynamix component ID for the attribute context. Common values: 9 = Ticket, 27 = Asset, 63 = KB Article, 31 = Person."
|
|
373
217
|
);
|
|
374
|
-
var ProjectIssueCreateSchema =
|
|
375
|
-
Title:
|
|
376
|
-
Description:
|
|
377
|
-
AssignedUID:
|
|
378
|
-
StatusID:
|
|
379
|
-
PriorityID:
|
|
218
|
+
var ProjectIssueCreateSchema = z2.object({
|
|
219
|
+
Title: z2.string().min(1).max(500).describe("Issue title."),
|
|
220
|
+
Description: z2.string().max(65535).optional().describe("Issue description."),
|
|
221
|
+
AssignedUID: z2.string().uuid().optional().describe("GUID of the assigned user."),
|
|
222
|
+
StatusID: z2.number().int().nonnegative().optional().describe("Issue status ID."),
|
|
223
|
+
PriorityID: z2.number().int().nonnegative().optional().describe("Issue priority ID."),
|
|
380
224
|
DueDate: IsoDateSchema.optional().describe("Issue due date (ISO 8601).")
|
|
381
225
|
});
|
|
382
|
-
var ProjectRiskCreateSchema =
|
|
383
|
-
Title:
|
|
384
|
-
Description:
|
|
385
|
-
AssignedUID:
|
|
386
|
-
StatusID:
|
|
387
|
-
Probability:
|
|
388
|
-
Impact:
|
|
226
|
+
var ProjectRiskCreateSchema = z2.object({
|
|
227
|
+
Title: z2.string().min(1).max(500).describe("Risk title."),
|
|
228
|
+
Description: z2.string().max(65535).optional().describe("Risk description."),
|
|
229
|
+
AssignedUID: z2.string().uuid().optional().describe("GUID of the risk owner."),
|
|
230
|
+
StatusID: z2.number().int().nonnegative().optional().describe("Risk status ID."),
|
|
231
|
+
Probability: z2.number().int().min(1).max(100).optional().describe("Probability percentage (1\u2013100)."),
|
|
232
|
+
Impact: z2.number().int().min(1).max(5).optional().describe("Impact level (1 = low, 5 = critical)."),
|
|
389
233
|
DueDate: IsoDateSchema.optional().describe("Risk resolution due date (ISO 8601).")
|
|
390
234
|
});
|
|
391
|
-
var TimeEntryQuerySchema =
|
|
235
|
+
var TimeEntryQuerySchema = z2.object({
|
|
392
236
|
StartDate: IsoDateSchema.describe("Start date for time entries query (ISO 8601 date, e.g. 2026-01-01)."),
|
|
393
237
|
EndDate: IsoDateSchema.describe("End date for time entries query (ISO 8601 date, e.g. 2026-01-31).")
|
|
394
238
|
});
|
|
395
|
-
var TeamDynamixEntitySchema =
|
|
396
|
-
var TeamDynamixNamedEntitySchema =
|
|
397
|
-
ID:
|
|
398
|
-
Name:
|
|
399
|
-
}).catchall(
|
|
239
|
+
var TeamDynamixEntitySchema = z2.record(z2.string(), z2.unknown()).describe("Base TeamDynamix entity with flexible additional fields");
|
|
240
|
+
var TeamDynamixNamedEntitySchema = z2.object({
|
|
241
|
+
ID: z2.number().int().positive("ID must be a positive integer"),
|
|
242
|
+
Name: z2.string().optional()
|
|
243
|
+
}).catchall(z2.unknown()).describe("TeamDynamix entity with ID and optional Name");
|
|
400
244
|
var TeamDynamixApplicationSchema = TeamDynamixNamedEntitySchema.extend({
|
|
401
|
-
Name:
|
|
245
|
+
Name: z2.string().optional()
|
|
402
246
|
}).describe("TeamDynamix Application entity");
|
|
403
247
|
var TeamDynamixTicketSchema = TeamDynamixNamedEntitySchema.extend({
|
|
404
|
-
Title:
|
|
405
|
-
Description:
|
|
406
|
-
StatusID:
|
|
407
|
-
TypeID:
|
|
248
|
+
Title: z2.string().optional(),
|
|
249
|
+
Description: z2.string().optional(),
|
|
250
|
+
StatusID: z2.number().int().optional(),
|
|
251
|
+
TypeID: z2.number().int().optional()
|
|
408
252
|
}).describe("TeamDynamix Ticket entity");
|
|
409
253
|
var TeamDynamixKbArticleSchema = TeamDynamixNamedEntitySchema.extend({
|
|
410
|
-
Subject:
|
|
411
|
-
Body:
|
|
412
|
-
IsPublished:
|
|
254
|
+
Subject: z2.string().optional(),
|
|
255
|
+
Body: z2.string().optional(),
|
|
256
|
+
IsPublished: z2.boolean().optional()
|
|
413
257
|
}).describe("TeamDynamix Knowledge Base Article entity");
|
|
414
258
|
var TeamDynamixAssetSchema = TeamDynamixNamedEntitySchema.extend({
|
|
415
|
-
Tag:
|
|
416
|
-
StatusID:
|
|
259
|
+
Tag: z2.string().optional(),
|
|
260
|
+
StatusID: z2.number().int().optional()
|
|
417
261
|
}).describe("TeamDynamix Asset entity");
|
|
418
262
|
var TeamDynamixProjectSchema = TeamDynamixNamedEntitySchema.extend({
|
|
419
|
-
Status:
|
|
263
|
+
Status: z2.string().optional()
|
|
420
264
|
}).describe("TeamDynamix Project entity");
|
|
421
265
|
var TeamDynamixGroupSchema = TeamDynamixNamedEntitySchema.extend({
|
|
422
|
-
Description:
|
|
266
|
+
Description: z2.string().optional()
|
|
423
267
|
}).describe("TeamDynamix Group entity");
|
|
424
|
-
var TeamDynamixUserSchema =
|
|
425
|
-
UID:
|
|
426
|
-
FullName:
|
|
427
|
-
Email:
|
|
428
|
-
IsActive:
|
|
429
|
-
}).catchall(
|
|
430
|
-
var TeamDynamixListResponseSchema =
|
|
431
|
-
var TeamDynamixSingleResponseSchema =
|
|
432
|
-
|
|
433
|
-
// src/client/sdk-client.factory.ts
|
|
434
|
-
import { existsSync } from "fs";
|
|
435
|
-
import { createRequire } from "module";
|
|
436
|
-
import { dirname, resolve } from "path";
|
|
437
|
-
import { fileURLToPath } from "url";
|
|
438
|
-
import { createTeamDynamixClient, loginWithPassword, loginWithServiceAccount } from "@voxslopuli/teamdynamix-ts";
|
|
439
|
-
var cachedSpecPath;
|
|
440
|
-
function resolveSdkSpecPath() {
|
|
441
|
-
const override = process.env["TEAMDYNAMIX_SPEC_PATH"]?.trim();
|
|
442
|
-
if (override) return override;
|
|
443
|
-
if (cachedSpecPath) return cachedSpecPath;
|
|
444
|
-
try {
|
|
445
|
-
const require2 = createRequire(fileURLToPath(import.meta.url));
|
|
446
|
-
const entryPath = require2.resolve("@voxslopuli/teamdynamix-ts");
|
|
447
|
-
const pkgRoot = dirname(entryPath);
|
|
448
|
-
const candidates = [
|
|
449
|
-
resolve(pkgRoot, "dist/generated/openapi.json"),
|
|
450
|
-
resolve(pkgRoot, "generated/openapi.json"),
|
|
451
|
-
resolve(pkgRoot, "src/generated/openapi.json")
|
|
452
|
-
];
|
|
453
|
-
cachedSpecPath = candidates.find((p) => existsSync(p));
|
|
454
|
-
return cachedSpecPath;
|
|
455
|
-
} catch {
|
|
456
|
-
return void 0;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
function createTokenProvider(config, tenant) {
|
|
460
|
-
if (config.authMode === "admin") {
|
|
461
|
-
if (!config.beid || !config.webServicesKey) {
|
|
462
|
-
throw new Error("BEID and WebServicesKey are required for admin authentication");
|
|
463
|
-
}
|
|
464
|
-
return loginWithServiceAccount({
|
|
465
|
-
tenant,
|
|
466
|
-
baseUrl: config.baseUrl,
|
|
467
|
-
beid: config.beid,
|
|
468
|
-
webServicesKey: config.webServicesKey
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
if (!config.username || !config.password) {
|
|
472
|
-
throw new Error("Username and password are required for standard authentication");
|
|
473
|
-
}
|
|
474
|
-
return loginWithPassword({
|
|
475
|
-
tenant,
|
|
476
|
-
baseUrl: config.baseUrl,
|
|
477
|
-
username: config.username,
|
|
478
|
-
password: config.password
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
function extractTenant(baseUrl) {
|
|
482
|
-
const normalized = baseUrl.replace(/\/+$/, "").replace(/\/TDWebApi$/, "");
|
|
483
|
-
const withoutProtocol = normalized.replace(/^https?:\/\//, "");
|
|
484
|
-
const parts = withoutProtocol.split("/");
|
|
485
|
-
return parts[0] ?? "";
|
|
486
|
-
}
|
|
487
|
-
function buildSdkConfig(config, tenant, tokenProvider) {
|
|
488
|
-
return {
|
|
489
|
-
tenant,
|
|
490
|
-
tokenProvider,
|
|
491
|
-
environment: config.baseUrl?.includes("sandbox") ? "sandbox" : "production",
|
|
492
|
-
baseUrl: config.baseUrl,
|
|
493
|
-
timeoutMs: config.timeoutMs,
|
|
494
|
-
runtimeValidationMode: "fail-open",
|
|
495
|
-
...resolveSdkSpecPath() ? { specPath: resolveSdkSpecPath() } : {},
|
|
496
|
-
retryPolicy: {
|
|
497
|
-
maxRetries: config.maxRetries
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
async function createMcpSdkClient(config) {
|
|
502
|
-
const tenant = extractTenant(config.baseUrl ?? "");
|
|
503
|
-
const tokenProvider = createTokenProvider(config, tenant);
|
|
504
|
-
const sdkConfig = buildSdkConfig(config, tenant, tokenProvider);
|
|
505
|
-
const { client } = await createTeamDynamixClient(sdkConfig);
|
|
506
|
-
return client;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
// src/services/teamdynamix/client.factory.ts
|
|
510
|
-
var TICKET_SEARCH_FIELD_MAP = {
|
|
511
|
-
ResponsibleGroupIDs: "ResponsibilityGroupIDs",
|
|
512
|
-
ResponsibleGroupID: "ResponsibilityGroupID",
|
|
513
|
-
ResponsibleGroups: "ResponsibilityGroupIDs"
|
|
514
|
-
};
|
|
515
|
-
function mapTicketSearchBody(body) {
|
|
516
|
-
const mapped = {};
|
|
517
|
-
for (const [key, value] of Object.entries(body)) {
|
|
518
|
-
if (value === void 0) continue;
|
|
519
|
-
mapped[TICKET_SEARCH_FIELD_MAP[key] ?? key] = value;
|
|
520
|
-
}
|
|
521
|
-
return mapped;
|
|
522
|
-
}
|
|
523
|
-
var UnifiedTeamDynamixClient = class {
|
|
524
|
-
constructor(config) {
|
|
525
|
-
this.config = config;
|
|
526
|
-
}
|
|
527
|
-
config;
|
|
528
|
-
sdkPromise = null;
|
|
529
|
-
sdk() {
|
|
530
|
-
this.sdkPromise ??= createMcpSdkClient(this.config);
|
|
531
|
-
return this.sdkPromise;
|
|
532
|
-
}
|
|
533
|
-
//
|
|
534
|
-
// Discovery
|
|
535
|
-
//
|
|
536
|
-
getCurrentUser() {
|
|
537
|
-
return this.sdk().then((s) => s.discovery.authGetuser());
|
|
538
|
-
}
|
|
539
|
-
listApplications() {
|
|
540
|
-
return this.sdk().then((s) => s.discovery.applications());
|
|
541
|
-
}
|
|
542
|
-
//
|
|
543
|
-
// Tickets
|
|
544
|
-
//
|
|
545
|
-
getTicket(appId, ticketId) {
|
|
546
|
-
return this.sdk().then((s) => s.tickets.appIdTicketsId({ params: { path: { appId, id: ticketId } } }));
|
|
547
|
-
}
|
|
548
|
-
searchTickets(appId, body) {
|
|
549
|
-
return this.sdk().then(async (s) => {
|
|
550
|
-
const { data, error } = await s.POST("/api/{appId}/tickets/search", {
|
|
551
|
-
params: { path: { appId } },
|
|
552
|
-
body: mapTicketSearchBody(body)
|
|
553
|
-
});
|
|
554
|
-
if (error) {
|
|
555
|
-
throw new Error(`Ticket search failed: ${JSON.stringify(error)}`);
|
|
556
|
-
}
|
|
557
|
-
return Array.isArray(data) ? data : [];
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
listTicketTypes(appId) {
|
|
561
|
-
return this.sdk().then((s) => s.tickets.appIdTicketsTypes({ params: { path: { appId } } }));
|
|
562
|
-
}
|
|
563
|
-
listTicketPriorities(appId) {
|
|
564
|
-
return this.sdk().then((s) => s.tickets.appIdTicketsPriorities({ params: { path: { appId } } }));
|
|
565
|
-
}
|
|
566
|
-
listTicketUrgencies(appId) {
|
|
567
|
-
return this.sdk().then((s) => s.tickets.appIdTicketsUrgencies({ params: { path: { appId } } }));
|
|
568
|
-
}
|
|
569
|
-
listTicketImpacts(appId) {
|
|
570
|
-
return this.sdk().then((s) => s.tickets.appIdTicketsImpacts({ params: { path: { appId } } }));
|
|
571
|
-
}
|
|
572
|
-
listTicketSources(appId) {
|
|
573
|
-
return this.sdk().then((s) => s.tickets.appIdTicketsSources({ params: { path: { appId } } }));
|
|
574
|
-
}
|
|
575
|
-
getTicketFeed(appId, ticketId) {
|
|
576
|
-
return this.sdk().then((s) => s.tickets.appIdTicketsIdFeed({ params: { path: { appId, id: ticketId } } }));
|
|
577
|
-
}
|
|
578
|
-
//
|
|
579
|
-
// Ticket Relationships
|
|
580
|
-
//
|
|
581
|
-
getTicketTasks(appId, ticketId) {
|
|
582
|
-
return this.sdk().then(
|
|
583
|
-
(s) => s.ticketRelationships.appIdTicketsTicketIdTasks({ params: { path: { appId, ticketId } } })
|
|
584
|
-
);
|
|
585
|
-
}
|
|
586
|
-
createTicketTask(appId, ticketId, body) {
|
|
587
|
-
return this.sdk().then((s) => s.ticketRelationships.createTicketTask({ appId, ticketId, body }));
|
|
588
|
-
}
|
|
589
|
-
listTicketAssets(appId, ticketId) {
|
|
590
|
-
return this.sdk().then(
|
|
591
|
-
(s) => s.ticketRelationships.appIdTicketsIdAssets({ params: { path: { appId, id: ticketId } } })
|
|
592
|
-
);
|
|
593
|
-
}
|
|
594
|
-
addTicketAsset(appId, ticketId, assetId) {
|
|
595
|
-
return this.sdk().then((s) => s.ticketRelationships.addTicketAsset({ appId, ticketId, assetId }));
|
|
596
|
-
}
|
|
597
|
-
removeTicketAsset(appId, ticketId, assetId) {
|
|
598
|
-
return this.sdk().then((s) => {
|
|
599
|
-
s.ticketRelationships.removeTicketAsset({ appId, ticketId, assetId, confirm: true });
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
getTicketContacts(appId, ticketId) {
|
|
603
|
-
return this.sdk().then(
|
|
604
|
-
(s) => s.ticketRelationships.appIdTicketsIdContacts({ params: { path: { appId, id: ticketId } } })
|
|
605
|
-
);
|
|
606
|
-
}
|
|
607
|
-
addTicketContact(appId, ticketId, contactUid) {
|
|
608
|
-
return this.sdk().then((s) => s.ticketRelationships.addTicketContact({ appId, ticketId, contactUid }));
|
|
609
|
-
}
|
|
610
|
-
removeTicketContact(appId, ticketId, contactUid) {
|
|
611
|
-
return this.sdk().then((s) => {
|
|
612
|
-
s.ticketRelationships.removeTicketContact({ appId, ticketId, contactUid, confirm: true });
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
//
|
|
616
|
-
// People
|
|
617
|
-
//
|
|
618
|
-
getUser(uid) {
|
|
619
|
-
return this.sdk().then((s) => s.people.peopleUid({ params: { path: { uid } } }));
|
|
620
|
-
}
|
|
621
|
-
searchUsers(body) {
|
|
622
|
-
const searchText = typeof body["SearchText"] === "string" ? body["SearchText"] : "";
|
|
623
|
-
return this.sdk().then((s) => s.people.peopleLookup({ body: { SearchText: searchText } }));
|
|
624
|
-
}
|
|
625
|
-
getGroup(groupId) {
|
|
626
|
-
return this.sdk().then((s) => s.people.groupsId({ params: { path: { id: groupId } } }));
|
|
627
|
-
}
|
|
628
|
-
searchGroups(_body) {
|
|
629
|
-
return this.sdk().then((s) => s.people.searchGroups({ body: {} }));
|
|
630
|
-
}
|
|
631
|
-
getGroupMembers(groupId) {
|
|
632
|
-
return this.sdk().then((s) => s.people.groupsIdMembers({ params: { path: { id: groupId } } }));
|
|
633
|
-
}
|
|
634
|
-
//
|
|
635
|
-
// Knowledge Base
|
|
636
|
-
//
|
|
637
|
-
getKbArticle(appId, articleId) {
|
|
638
|
-
return this.sdk().then((s) => s.knowledgeBase.appIdKnowledgebaseId({ params: { path: { appId, id: articleId } } }));
|
|
639
|
-
}
|
|
640
|
-
searchKbArticles(appId, body) {
|
|
641
|
-
const keyword = typeof body["SearchText"] === "string" ? body["SearchText"] : "";
|
|
642
|
-
return this.sdk().then((s) => s.knowledgeBase.appIdKnowledgebaseId({ params: { path: { appId, id: 0 } } })).then(
|
|
643
|
-
(r) => Array.isArray(r) ? r.filter((item) => {
|
|
644
|
-
const s = typeof item === "object" && item !== null ? JSON.stringify(item).toLowerCase() : "";
|
|
645
|
-
return keyword ? s.includes(keyword.toLowerCase()) : true;
|
|
646
|
-
}) : []
|
|
647
|
-
);
|
|
648
|
-
}
|
|
649
|
-
listKbCategories(appId) {
|
|
650
|
-
return this.sdk().then(
|
|
651
|
-
(s) => s.knowledgeBase.appIdKnowledgebaseCategories({ params: { path: { appId } } })
|
|
652
|
-
);
|
|
653
|
-
}
|
|
654
|
-
//
|
|
655
|
-
// Assets
|
|
656
|
-
//
|
|
657
|
-
getAsset(appId, assetId) {
|
|
658
|
-
return this.sdk().then((s) => s.assets.appIdAssetsId({ params: { path: { appId, id: assetId } } }));
|
|
659
|
-
}
|
|
660
|
-
searchAssets(appId, _body) {
|
|
661
|
-
return this.sdk().then((s) => s.assets.appIdAssetsFeed({ params: { path: { appId } } }));
|
|
662
|
-
}
|
|
663
|
-
listAssetStatuses(appId) {
|
|
664
|
-
return this.sdk().then((s) => s.assets.appIdAssetsStatuses({ params: { path: { appId } } }));
|
|
665
|
-
}
|
|
666
|
-
listProductModels(appId) {
|
|
667
|
-
return this.sdk().then((s) => s.assets.appIdAssetsModels({ params: { path: { appId } } }));
|
|
668
|
-
}
|
|
669
|
-
listVendors(appId) {
|
|
670
|
-
return this.sdk().then((s) => s.cmdb.appIdAssetsVendors({ params: { path: { appId } } }));
|
|
671
|
-
}
|
|
672
|
-
//
|
|
673
|
-
// CMDB
|
|
674
|
-
//
|
|
675
|
-
getConfigurationItem(appId, ciId) {
|
|
676
|
-
return this.sdk().then((s) => s.cmdb.appIdCmdbId({ params: { path: { appId, id: ciId } } }));
|
|
677
|
-
}
|
|
678
|
-
searchConfigurationItems(appId, _body) {
|
|
679
|
-
return this.sdk().then((s) => s.cmdb.appIdCmdbSearches({ params: { path: { appId } } }));
|
|
680
|
-
}
|
|
681
|
-
listCiTypes(appId) {
|
|
682
|
-
return this.sdk().then((s) => s.cmdb.appIdCmdbTypes({ params: { path: { appId } } }));
|
|
683
|
-
}
|
|
684
|
-
listCiRelationshipTypes() {
|
|
685
|
-
return this.sdk().then((s) => s.cmdb.appIdCmdbRelationshiptypes());
|
|
686
|
-
}
|
|
687
|
-
//
|
|
688
|
-
// Services
|
|
689
|
-
//
|
|
690
|
-
listServiceCatalog(appId) {
|
|
691
|
-
return this.sdk().then((s) => s.services.appIdServices({ params: { path: { appId } } }));
|
|
692
|
-
}
|
|
693
|
-
getService(appId, serviceId) {
|
|
694
|
-
return this.sdk().then((s) => s.services.appIdServicesId({ params: { path: { appId, id: serviceId } } }));
|
|
695
|
-
}
|
|
696
|
-
searchServices(appId, body) {
|
|
697
|
-
const keyword = typeof body["Keyword"] === "string" ? body["Keyword"] : "";
|
|
698
|
-
return this.sdk().then((s) => s.services.appIdServices({ params: { path: { appId } } })).then((r) => {
|
|
699
|
-
if (!Array.isArray(r)) return [];
|
|
700
|
-
if (!keyword) return r;
|
|
701
|
-
const lower = keyword.toLowerCase();
|
|
702
|
-
return r.filter((item) => {
|
|
703
|
-
const text = typeof item === "object" && item !== null ? JSON.stringify(item).toLowerCase() : "";
|
|
704
|
-
return text.includes(lower);
|
|
705
|
-
});
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
listServiceCategories(appId) {
|
|
709
|
-
return this.sdk().then((s) => s.services.appIdServicesCategories({ params: { path: { appId } } }));
|
|
710
|
-
}
|
|
711
|
-
//
|
|
712
|
-
// Projects
|
|
713
|
-
//
|
|
714
|
-
getProject(projectId) {
|
|
715
|
-
return this.sdk().then((s) => s.projects.projectsId({ params: { path: { id: projectId } } }));
|
|
716
|
-
}
|
|
717
|
-
searchProjects(_body) {
|
|
718
|
-
return this.sdk().then((s) => s.projects.projectsFeed());
|
|
719
|
-
}
|
|
720
|
-
listProjectTypes() {
|
|
721
|
-
return this.sdk().then((s) => s.projects.projectsTypes());
|
|
722
|
-
}
|
|
723
|
-
getProjectPlans(projectId) {
|
|
724
|
-
return this.sdk().then(
|
|
725
|
-
(s) => s.projects.projectsProjectIDPlansPlanID({ params: { path: { id: projectId } } })
|
|
726
|
-
);
|
|
727
|
-
}
|
|
728
|
-
getProjectIssues(projectId) {
|
|
729
|
-
return this.sdk().then(
|
|
730
|
-
(s) => s.projects.projectsProjectIdIssuesCategories({ params: { path: { id: projectId } } })
|
|
731
|
-
);
|
|
732
|
-
}
|
|
733
|
-
getProjectRisks(projectId) {
|
|
734
|
-
return this.sdk().then(
|
|
735
|
-
(s) => s.projects.projectsProjectIdRisksCategories({ params: { path: { id: projectId } } })
|
|
736
|
-
);
|
|
737
|
-
}
|
|
738
|
-
//
|
|
739
|
-
// Time
|
|
740
|
-
//
|
|
741
|
-
listTimeTypes() {
|
|
742
|
-
return this.sdk().then((s) => s.time.timeTypes());
|
|
743
|
-
}
|
|
744
|
-
getMyTimeEntries(_startDate, _endDate) {
|
|
745
|
-
return this.sdk().then((s) => s.time.timeId({ params: { path: { id: 0 } } }));
|
|
746
|
-
}
|
|
747
|
-
//
|
|
748
|
-
// Reference Data
|
|
749
|
-
//
|
|
750
|
-
listAccounts(_appId) {
|
|
751
|
-
return this.sdk().then((s) => s.referenceData.accounts());
|
|
752
|
-
}
|
|
753
|
-
getAccount(accountId) {
|
|
754
|
-
return this.sdk().then((s) => s.referenceData.accountsId({ params: { path: { id: accountId } } }));
|
|
755
|
-
}
|
|
756
|
-
listLocations() {
|
|
757
|
-
return this.sdk().then((s) => s.referenceData.locations());
|
|
758
|
-
}
|
|
759
|
-
listFunctionalRoles() {
|
|
760
|
-
return this.sdk().then((s) => s.referenceData.securityrolesPermissions());
|
|
761
|
-
}
|
|
762
|
-
listCustomAttributes(_componentId, _appId, _associatedTypeId) {
|
|
763
|
-
return this.sdk().then((s) => s.referenceData.attributesCustom());
|
|
764
|
-
}
|
|
765
|
-
listTicketStatuses(appId) {
|
|
766
|
-
return this.sdk().then((s) => s.referenceData.appIdTicketsStatuses({ params: { path: { appId } } }));
|
|
767
|
-
}
|
|
768
|
-
//
|
|
769
|
-
// Mutations
|
|
770
|
-
//
|
|
771
|
-
createTicket(appId, body, _notifyRequestor, _notifyResponsible) {
|
|
772
|
-
return this.sdk().then((s) => s.tickets.createTicket({ appId, body }));
|
|
773
|
-
}
|
|
774
|
-
updateTicket(appId, ticketId, body, _notifyRequestor, _notifyResponsible, _comments, _isPrivate) {
|
|
775
|
-
return this.sdk().then((s) => s.tickets.updateTicket({ appId, ticketId, body }));
|
|
776
|
-
}
|
|
777
|
-
addTicketComment(appId, ticketId, body, _isPrivate, _notifyRequestor, _notifyResponsible) {
|
|
778
|
-
return this.sdk().then((s) => s.tickets.addTicketComment({ appId, ticketId, body: { Body: body } }));
|
|
779
|
-
}
|
|
780
|
-
createKbArticle(appId, body) {
|
|
781
|
-
return this.sdk().then((s) => s.knowledgeBase.createArticle({ appId, body }));
|
|
782
|
-
}
|
|
783
|
-
updateKbArticle(appId, articleId, body) {
|
|
784
|
-
return this.sdk().then((s) => s.knowledgeBase.updateArticle({ appId, articleId, body }));
|
|
785
|
-
}
|
|
786
|
-
createProjectIssue(_projectId, body) {
|
|
787
|
-
return this.sdk().then((s) => s.projects.createIssue({ body }));
|
|
788
|
-
}
|
|
789
|
-
createProjectRisk(_projectId, body) {
|
|
790
|
-
return this.sdk().then((s) => s.projects.createRisk({ body }));
|
|
791
|
-
}
|
|
792
|
-
//
|
|
793
|
-
// Delete mutations (confirm:true required for all)
|
|
794
|
-
//
|
|
795
|
-
deleteAsset(appId, assetId) {
|
|
796
|
-
return this.sdk().then((s) => s.assets.deleteAsset({ appId, assetId, confirm: true }));
|
|
797
|
-
}
|
|
798
|
-
deleteConfigurationItem(appId, ciId) {
|
|
799
|
-
return this.sdk().then((s) => s.cmdb.deleteConfigurationItem({ appId, configurationItemId: ciId, confirm: true }));
|
|
800
|
-
}
|
|
801
|
-
deleteService(appId, serviceId) {
|
|
802
|
-
return this.sdk().then((s) => s.services.deleteService({ appId, serviceId, confirm: true }));
|
|
803
|
-
}
|
|
804
|
-
deleteServiceCategory(appId, categoryId) {
|
|
805
|
-
return this.sdk().then((s) => s.services.deleteServiceCategory({ appId, categoryId, confirm: true }));
|
|
806
|
-
}
|
|
807
|
-
deleteTimeEntry(timeEntryId) {
|
|
808
|
-
return this.sdk().then((s) => s.time.deleteTimeEntry({ timeEntryId, confirm: true }));
|
|
809
|
-
}
|
|
810
|
-
};
|
|
811
|
-
function createConfiguredTeamDynamixClient() {
|
|
812
|
-
return new UnifiedTeamDynamixClient(getTeamDynamixConfig());
|
|
813
|
-
}
|
|
814
|
-
function assertWriteToolsEnabled(config) {
|
|
815
|
-
if (!config.enableWriteTools) {
|
|
816
|
-
throw new Error("Write tools are disabled. Set TEAMDYNAMIX_ENABLE_WRITE_TOOLS=true in your environment.");
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
function assertDeleteToolsEnabled(config) {
|
|
820
|
-
if (!config.enableDeleteTools) {
|
|
821
|
-
throw new Error("Delete tools are disabled. Set TEAMDYNAMIX_ENABLE_DELETE_TOOLS=true in your environment.");
|
|
822
|
-
}
|
|
823
|
-
}
|
|
268
|
+
var TeamDynamixUserSchema = z2.object({
|
|
269
|
+
UID: z2.string({ error: "User UID is required" }),
|
|
270
|
+
FullName: z2.string().optional(),
|
|
271
|
+
Email: z2.string().email().optional(),
|
|
272
|
+
IsActive: z2.boolean().optional()
|
|
273
|
+
}).catchall(z2.unknown()).describe("TeamDynamix User entity");
|
|
274
|
+
var TeamDynamixListResponseSchema = z2.array(z2.record(z2.string(), z2.unknown())).describe("Array of TeamDynamix entities");
|
|
275
|
+
var TeamDynamixSingleResponseSchema = z2.record(z2.string(), z2.unknown()).describe("Single TeamDynamix entity response");
|
|
824
276
|
|
|
825
277
|
// src/services/teamdynamix/render.service.ts
|
|
826
278
|
import { tablemark } from "tablemark";
|
|
@@ -934,13 +386,13 @@ function truncateMarkdown(markdown, limit) {
|
|
|
934
386
|
}
|
|
935
387
|
|
|
936
388
|
// src/tools/teamdynamix.domain-gateways.tools.ts
|
|
937
|
-
var teamdynamixDiscoveryActionSchema =
|
|
389
|
+
var teamdynamixDiscoveryActionSchema = z3.enum([
|
|
938
390
|
"server_status",
|
|
939
391
|
"get_current_user",
|
|
940
392
|
"list_applications",
|
|
941
393
|
"list_ticket_statuses"
|
|
942
394
|
]);
|
|
943
|
-
var teamdynamixTicketActionSchema =
|
|
395
|
+
var teamdynamixTicketActionSchema = z3.enum([
|
|
944
396
|
"list_ticket_types",
|
|
945
397
|
"list_ticket_priorities",
|
|
946
398
|
"list_ticket_urgencies",
|
|
@@ -953,7 +405,7 @@ var teamdynamixTicketActionSchema = z4.enum([
|
|
|
953
405
|
"add_ticket_comment",
|
|
954
406
|
"get_ticket_feed"
|
|
955
407
|
]);
|
|
956
|
-
var teamdynamixTicketRelationshipActionSchema =
|
|
408
|
+
var teamdynamixTicketRelationshipActionSchema = z3.enum([
|
|
957
409
|
"get_ticket_tasks",
|
|
958
410
|
"create_ticket_task",
|
|
959
411
|
"list_ticket_assets",
|
|
@@ -963,28 +415,28 @@ var teamdynamixTicketRelationshipActionSchema = z4.enum([
|
|
|
963
415
|
"add_ticket_contact",
|
|
964
416
|
"remove_ticket_contact"
|
|
965
417
|
]);
|
|
966
|
-
var teamdynamixPeopleActionSchema =
|
|
418
|
+
var teamdynamixPeopleActionSchema = z3.enum([
|
|
967
419
|
"get_user",
|
|
968
420
|
"search_users",
|
|
969
421
|
"get_group",
|
|
970
422
|
"search_groups",
|
|
971
423
|
"get_group_members"
|
|
972
424
|
]);
|
|
973
|
-
var teamdynamixKnowledgeBaseActionSchema =
|
|
425
|
+
var teamdynamixKnowledgeBaseActionSchema = z3.enum([
|
|
974
426
|
"get_kb_article",
|
|
975
427
|
"search_kb_articles",
|
|
976
428
|
"list_kb_categories",
|
|
977
429
|
"create_kb_article",
|
|
978
430
|
"update_kb_article"
|
|
979
431
|
]);
|
|
980
|
-
var teamdynamixAssetsActionSchema =
|
|
432
|
+
var teamdynamixAssetsActionSchema = z3.enum([
|
|
981
433
|
"get_asset",
|
|
982
434
|
"search_assets",
|
|
983
435
|
"list_asset_statuses",
|
|
984
436
|
"list_product_models",
|
|
985
437
|
"delete_asset"
|
|
986
438
|
]);
|
|
987
|
-
var teamdynamixCmdbActionSchema =
|
|
439
|
+
var teamdynamixCmdbActionSchema = z3.enum([
|
|
988
440
|
"get_ci",
|
|
989
441
|
"search_cis",
|
|
990
442
|
"list_ci_types",
|
|
@@ -992,7 +444,7 @@ var teamdynamixCmdbActionSchema = z4.enum([
|
|
|
992
444
|
"list_vendors",
|
|
993
445
|
"delete_ci"
|
|
994
446
|
]);
|
|
995
|
-
var teamdynamixServicesActionSchema =
|
|
447
|
+
var teamdynamixServicesActionSchema = z3.enum([
|
|
996
448
|
"list_services",
|
|
997
449
|
"get_service",
|
|
998
450
|
"search_services",
|
|
@@ -1000,7 +452,7 @@ var teamdynamixServicesActionSchema = z4.enum([
|
|
|
1000
452
|
"delete_service",
|
|
1001
453
|
"delete_service_category"
|
|
1002
454
|
]);
|
|
1003
|
-
var teamdynamixProjectsActionSchema =
|
|
455
|
+
var teamdynamixProjectsActionSchema = z3.enum([
|
|
1004
456
|
"get_project",
|
|
1005
457
|
"search_projects",
|
|
1006
458
|
"list_project_types",
|
|
@@ -1010,15 +462,15 @@ var teamdynamixProjectsActionSchema = z4.enum([
|
|
|
1010
462
|
"create_project_issue",
|
|
1011
463
|
"create_project_risk"
|
|
1012
464
|
]);
|
|
1013
|
-
var teamdynamixTimeActionSchema =
|
|
1014
|
-
var teamdynamixReferenceDataActionSchema =
|
|
465
|
+
var teamdynamixTimeActionSchema = z3.enum(["list_time_types", "get_my_time_entries"]);
|
|
466
|
+
var teamdynamixReferenceDataActionSchema = z3.enum([
|
|
1015
467
|
"list_accounts",
|
|
1016
468
|
"get_account",
|
|
1017
469
|
"list_locations",
|
|
1018
470
|
"list_functional_roles",
|
|
1019
471
|
"list_custom_attributes"
|
|
1020
472
|
]);
|
|
1021
|
-
var gatewayPayloadSchema =
|
|
473
|
+
var gatewayPayloadSchema = z3.record(z3.string(), z3.unknown()).default({});
|
|
1022
474
|
function messageFromError(error) {
|
|
1023
475
|
return error instanceof Error ? error.message : String(error);
|
|
1024
476
|
}
|
|
@@ -1163,7 +615,7 @@ function registerTeamDynamixDiscoveryGateway(server2) {
|
|
|
1163
615
|
return toSuccessResponse({ count: applications.length, applications }, response_format);
|
|
1164
616
|
}
|
|
1165
617
|
case "list_ticket_statuses": {
|
|
1166
|
-
const parsed = parsePayload(
|
|
618
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema.optional() }), payload, action);
|
|
1167
619
|
const config = getTeamDynamixConfig();
|
|
1168
620
|
const effectiveAppId = parsed.app_id ?? config.defaultTicketAppId;
|
|
1169
621
|
if (!effectiveAppId) {
|
|
@@ -1199,33 +651,33 @@ function registerTeamDynamixTicketsGateway(server2) {
|
|
|
1199
651
|
const client = createConfiguredTeamDynamixClient();
|
|
1200
652
|
switch (action) {
|
|
1201
653
|
case "list_ticket_types": {
|
|
1202
|
-
const parsed = parsePayload(
|
|
654
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1203
655
|
const types = await client.listTicketTypes(parsed.app_id);
|
|
1204
656
|
return toSuccessResponse({ appId: parsed.app_id, types }, response_format);
|
|
1205
657
|
}
|
|
1206
658
|
case "list_ticket_priorities": {
|
|
1207
|
-
const parsed = parsePayload(
|
|
659
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1208
660
|
const priorities = await client.listTicketPriorities(parsed.app_id);
|
|
1209
661
|
return toSuccessResponse({ appId: parsed.app_id, priorities }, response_format);
|
|
1210
662
|
}
|
|
1211
663
|
case "list_ticket_urgencies": {
|
|
1212
|
-
const parsed = parsePayload(
|
|
664
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1213
665
|
const urgencies = await client.listTicketUrgencies(parsed.app_id);
|
|
1214
666
|
return toSuccessResponse({ appId: parsed.app_id, urgencies }, response_format);
|
|
1215
667
|
}
|
|
1216
668
|
case "list_ticket_impacts": {
|
|
1217
|
-
const parsed = parsePayload(
|
|
669
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1218
670
|
const impacts = await client.listTicketImpacts(parsed.app_id);
|
|
1219
671
|
return toSuccessResponse({ appId: parsed.app_id, impacts }, response_format);
|
|
1220
672
|
}
|
|
1221
673
|
case "list_ticket_sources": {
|
|
1222
|
-
const parsed = parsePayload(
|
|
674
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1223
675
|
const sources = await client.listTicketSources(parsed.app_id);
|
|
1224
676
|
return toSuccessResponse({ appId: parsed.app_id, sources }, response_format);
|
|
1225
677
|
}
|
|
1226
678
|
case "get_ticket": {
|
|
1227
679
|
const parsed = parsePayload(
|
|
1228
|
-
|
|
680
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, ticket_id: z3.number().int().positive() }),
|
|
1229
681
|
payload,
|
|
1230
682
|
action
|
|
1231
683
|
);
|
|
@@ -1234,7 +686,7 @@ function registerTeamDynamixTicketsGateway(server2) {
|
|
|
1234
686
|
}
|
|
1235
687
|
case "search_tickets": {
|
|
1236
688
|
const parsed = parsePayload(
|
|
1237
|
-
|
|
689
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, search: TicketSearchSchema }),
|
|
1238
690
|
payload,
|
|
1239
691
|
action
|
|
1240
692
|
);
|
|
@@ -1243,11 +695,11 @@ function registerTeamDynamixTicketsGateway(server2) {
|
|
|
1243
695
|
}
|
|
1244
696
|
case "create_ticket": {
|
|
1245
697
|
const parsed = parsePayload(
|
|
1246
|
-
|
|
698
|
+
z3.object({
|
|
1247
699
|
app_id: TeamDynamixAppIdSchema,
|
|
1248
700
|
ticket: TicketCreateSchema,
|
|
1249
|
-
notify_requestor:
|
|
1250
|
-
notify_responsible:
|
|
701
|
+
notify_requestor: z3.boolean().optional().default(false),
|
|
702
|
+
notify_responsible: z3.boolean().optional().default(false)
|
|
1251
703
|
}),
|
|
1252
704
|
payload,
|
|
1253
705
|
action
|
|
@@ -1263,7 +715,7 @@ function registerTeamDynamixTicketsGateway(server2) {
|
|
|
1263
715
|
}
|
|
1264
716
|
case "update_ticket": {
|
|
1265
717
|
const parsed = parsePayload(
|
|
1266
|
-
|
|
718
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, patch: TicketPatchSchema }),
|
|
1267
719
|
payload,
|
|
1268
720
|
action
|
|
1269
721
|
);
|
|
@@ -1281,7 +733,7 @@ function registerTeamDynamixTicketsGateway(server2) {
|
|
|
1281
733
|
}
|
|
1282
734
|
case "add_ticket_comment": {
|
|
1283
735
|
const parsed = parsePayload(
|
|
1284
|
-
|
|
736
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, comment: TicketCommentSchema }),
|
|
1285
737
|
payload,
|
|
1286
738
|
action
|
|
1287
739
|
);
|
|
@@ -1298,7 +750,7 @@ function registerTeamDynamixTicketsGateway(server2) {
|
|
|
1298
750
|
}
|
|
1299
751
|
case "get_ticket_feed": {
|
|
1300
752
|
const parsed = parsePayload(
|
|
1301
|
-
|
|
753
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, ticket_id: z3.number().int().positive() }),
|
|
1302
754
|
payload,
|
|
1303
755
|
action
|
|
1304
756
|
);
|
|
@@ -1334,7 +786,7 @@ function registerTeamDynamixTicketRelationshipsGateway(server2) {
|
|
|
1334
786
|
switch (action) {
|
|
1335
787
|
case "get_ticket_tasks": {
|
|
1336
788
|
const parsed = parsePayload(
|
|
1337
|
-
|
|
789
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, ticket_id: z3.number().int().positive() }),
|
|
1338
790
|
payload,
|
|
1339
791
|
action
|
|
1340
792
|
);
|
|
@@ -1346,7 +798,7 @@ function registerTeamDynamixTicketRelationshipsGateway(server2) {
|
|
|
1346
798
|
}
|
|
1347
799
|
case "create_ticket_task": {
|
|
1348
800
|
const parsed = parsePayload(
|
|
1349
|
-
|
|
801
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, task: TicketTaskCreateSchema }),
|
|
1350
802
|
payload,
|
|
1351
803
|
action
|
|
1352
804
|
);
|
|
@@ -1360,7 +812,7 @@ function registerTeamDynamixTicketRelationshipsGateway(server2) {
|
|
|
1360
812
|
}
|
|
1361
813
|
case "list_ticket_assets": {
|
|
1362
814
|
const parsed = parsePayload(
|
|
1363
|
-
|
|
815
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, ticket_id: z3.number().int().positive() }),
|
|
1364
816
|
payload,
|
|
1365
817
|
action
|
|
1366
818
|
);
|
|
@@ -1372,10 +824,10 @@ function registerTeamDynamixTicketRelationshipsGateway(server2) {
|
|
|
1372
824
|
}
|
|
1373
825
|
case "add_ticket_asset": {
|
|
1374
826
|
const parsed = parsePayload(
|
|
1375
|
-
|
|
827
|
+
z3.object({
|
|
1376
828
|
app_id: TeamDynamixAppIdSchema,
|
|
1377
|
-
ticket_id:
|
|
1378
|
-
asset_id:
|
|
829
|
+
ticket_id: z3.number().int().positive(),
|
|
830
|
+
asset_id: z3.number().int().positive()
|
|
1379
831
|
}),
|
|
1380
832
|
payload,
|
|
1381
833
|
action
|
|
@@ -1386,11 +838,11 @@ function registerTeamDynamixTicketRelationshipsGateway(server2) {
|
|
|
1386
838
|
}
|
|
1387
839
|
case "remove_ticket_asset": {
|
|
1388
840
|
const parsed = parsePayload(
|
|
1389
|
-
|
|
841
|
+
z3.object({
|
|
1390
842
|
app_id: TeamDynamixAppIdSchema,
|
|
1391
|
-
ticket_id:
|
|
1392
|
-
asset_id:
|
|
1393
|
-
confirm:
|
|
843
|
+
ticket_id: z3.number().int().positive(),
|
|
844
|
+
asset_id: z3.number().int().positive(),
|
|
845
|
+
confirm: z3.literal(true)
|
|
1394
846
|
}),
|
|
1395
847
|
payload,
|
|
1396
848
|
action
|
|
@@ -1409,7 +861,7 @@ function registerTeamDynamixTicketRelationshipsGateway(server2) {
|
|
|
1409
861
|
}
|
|
1410
862
|
case "get_ticket_contacts": {
|
|
1411
863
|
const parsed = parsePayload(
|
|
1412
|
-
|
|
864
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, ticket_id: z3.number().int().positive() }),
|
|
1413
865
|
payload,
|
|
1414
866
|
action
|
|
1415
867
|
);
|
|
@@ -1421,9 +873,9 @@ function registerTeamDynamixTicketRelationshipsGateway(server2) {
|
|
|
1421
873
|
}
|
|
1422
874
|
case "add_ticket_contact": {
|
|
1423
875
|
const parsed = parsePayload(
|
|
1424
|
-
|
|
876
|
+
z3.object({
|
|
1425
877
|
app_id: TeamDynamixAppIdSchema,
|
|
1426
|
-
ticket_id:
|
|
878
|
+
ticket_id: z3.number().int().positive(),
|
|
1427
879
|
contact_uid: TeamDynamixGuidSchema
|
|
1428
880
|
}),
|
|
1429
881
|
payload,
|
|
@@ -1435,11 +887,11 @@ function registerTeamDynamixTicketRelationshipsGateway(server2) {
|
|
|
1435
887
|
}
|
|
1436
888
|
case "remove_ticket_contact": {
|
|
1437
889
|
const parsed = parsePayload(
|
|
1438
|
-
|
|
890
|
+
z3.object({
|
|
1439
891
|
app_id: TeamDynamixAppIdSchema,
|
|
1440
|
-
ticket_id:
|
|
892
|
+
ticket_id: z3.number().int().positive(),
|
|
1441
893
|
contact_uid: TeamDynamixGuidSchema,
|
|
1442
|
-
confirm:
|
|
894
|
+
confirm: z3.literal(true)
|
|
1443
895
|
}),
|
|
1444
896
|
payload,
|
|
1445
897
|
action
|
|
@@ -1481,27 +933,27 @@ function registerTeamDynamixPeopleGateway(server2) {
|
|
|
1481
933
|
const client = createConfiguredTeamDynamixClient();
|
|
1482
934
|
switch (action) {
|
|
1483
935
|
case "get_user": {
|
|
1484
|
-
const parsed = parsePayload(
|
|
936
|
+
const parsed = parsePayload(z3.object({ uid: TeamDynamixGuidSchema }), payload, action);
|
|
1485
937
|
const user = await client.getUser(parsed.uid);
|
|
1486
938
|
return toSuccessResponse(user, response_format);
|
|
1487
939
|
}
|
|
1488
940
|
case "search_users": {
|
|
1489
|
-
const parsed = parsePayload(
|
|
941
|
+
const parsed = parsePayload(z3.object({ search: UserSearchSchema }), payload, action);
|
|
1490
942
|
const users = await client.searchUsers(parsed.search);
|
|
1491
943
|
return toSuccessResponse({ count: users.length, users }, response_format);
|
|
1492
944
|
}
|
|
1493
945
|
case "get_group": {
|
|
1494
|
-
const parsed = parsePayload(
|
|
946
|
+
const parsed = parsePayload(z3.object({ group_id: z3.number().int().positive() }), payload, action);
|
|
1495
947
|
const group = await client.getGroup(parsed.group_id);
|
|
1496
948
|
return toSuccessResponse(group, response_format);
|
|
1497
949
|
}
|
|
1498
950
|
case "search_groups": {
|
|
1499
|
-
const parsed = parsePayload(
|
|
951
|
+
const parsed = parsePayload(z3.object({ search: GroupSearchSchema }), payload, action);
|
|
1500
952
|
const groups = await client.searchGroups(parsed.search);
|
|
1501
953
|
return toSuccessResponse({ count: groups.length, groups }, response_format);
|
|
1502
954
|
}
|
|
1503
955
|
case "get_group_members": {
|
|
1504
|
-
const parsed = parsePayload(
|
|
956
|
+
const parsed = parsePayload(z3.object({ group_id: z3.number().int().positive() }), payload, action);
|
|
1505
957
|
const members = await client.getGroupMembers(parsed.group_id);
|
|
1506
958
|
return toSuccessResponse({ groupId: parsed.group_id, count: members.length, members }, response_format);
|
|
1507
959
|
}
|
|
@@ -1531,7 +983,7 @@ function registerTeamDynamixKnowledgeBaseGateway(server2) {
|
|
|
1531
983
|
switch (action) {
|
|
1532
984
|
case "get_kb_article": {
|
|
1533
985
|
const parsed = parsePayload(
|
|
1534
|
-
|
|
986
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, article_id: z3.number().int().positive() }),
|
|
1535
987
|
payload,
|
|
1536
988
|
action
|
|
1537
989
|
);
|
|
@@ -1540,7 +992,7 @@ function registerTeamDynamixKnowledgeBaseGateway(server2) {
|
|
|
1540
992
|
}
|
|
1541
993
|
case "search_kb_articles": {
|
|
1542
994
|
const parsed = parsePayload(
|
|
1543
|
-
|
|
995
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, search: KbArticleSearchSchema }),
|
|
1544
996
|
payload,
|
|
1545
997
|
action
|
|
1546
998
|
);
|
|
@@ -1548,13 +1000,13 @@ function registerTeamDynamixKnowledgeBaseGateway(server2) {
|
|
|
1548
1000
|
return toSuccessResponse({ appId: parsed.app_id, count: articles.length, articles }, response_format);
|
|
1549
1001
|
}
|
|
1550
1002
|
case "list_kb_categories": {
|
|
1551
|
-
const parsed = parsePayload(
|
|
1003
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1552
1004
|
const categories = await client.listKbCategories(parsed.app_id);
|
|
1553
1005
|
return toSuccessResponse({ appId: parsed.app_id, count: categories.length, categories }, response_format);
|
|
1554
1006
|
}
|
|
1555
1007
|
case "create_kb_article": {
|
|
1556
1008
|
const parsed = parsePayload(
|
|
1557
|
-
|
|
1009
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, article: KbArticleCreateSchema }),
|
|
1558
1010
|
payload,
|
|
1559
1011
|
action
|
|
1560
1012
|
);
|
|
@@ -1564,7 +1016,7 @@ function registerTeamDynamixKnowledgeBaseGateway(server2) {
|
|
|
1564
1016
|
}
|
|
1565
1017
|
case "update_kb_article": {
|
|
1566
1018
|
const parsed = parsePayload(
|
|
1567
|
-
|
|
1019
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, article: KbArticleUpdateSchema }),
|
|
1568
1020
|
payload,
|
|
1569
1021
|
action
|
|
1570
1022
|
);
|
|
@@ -1599,7 +1051,7 @@ function registerTeamDynamixAssetsGateway(server2) {
|
|
|
1599
1051
|
switch (action) {
|
|
1600
1052
|
case "get_asset": {
|
|
1601
1053
|
const parsed = parsePayload(
|
|
1602
|
-
|
|
1054
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, asset_id: z3.number().int().positive() }),
|
|
1603
1055
|
payload,
|
|
1604
1056
|
action
|
|
1605
1057
|
);
|
|
@@ -1608,7 +1060,7 @@ function registerTeamDynamixAssetsGateway(server2) {
|
|
|
1608
1060
|
}
|
|
1609
1061
|
case "search_assets": {
|
|
1610
1062
|
const parsed = parsePayload(
|
|
1611
|
-
|
|
1063
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, search: AssetSearchSchema }),
|
|
1612
1064
|
payload,
|
|
1613
1065
|
action
|
|
1614
1066
|
);
|
|
@@ -1616,21 +1068,21 @@ function registerTeamDynamixAssetsGateway(server2) {
|
|
|
1616
1068
|
return toSuccessResponse({ appId: parsed.app_id, count: assets.length, assets }, response_format);
|
|
1617
1069
|
}
|
|
1618
1070
|
case "list_asset_statuses": {
|
|
1619
|
-
const parsed = parsePayload(
|
|
1071
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1620
1072
|
const statuses = await client.listAssetStatuses(parsed.app_id);
|
|
1621
1073
|
return toSuccessResponse({ appId: parsed.app_id, count: statuses.length, statuses }, response_format);
|
|
1622
1074
|
}
|
|
1623
1075
|
case "list_product_models": {
|
|
1624
|
-
const parsed = parsePayload(
|
|
1076
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1625
1077
|
const models = await client.listProductModels(parsed.app_id);
|
|
1626
1078
|
return toSuccessResponse({ appId: parsed.app_id, count: models.length, models }, response_format);
|
|
1627
1079
|
}
|
|
1628
1080
|
case "delete_asset": {
|
|
1629
1081
|
const parsed = parsePayload(
|
|
1630
|
-
|
|
1082
|
+
z3.object({
|
|
1631
1083
|
app_id: TeamDynamixAppIdSchema,
|
|
1632
|
-
asset_id:
|
|
1633
|
-
confirm:
|
|
1084
|
+
asset_id: z3.number().int().positive(),
|
|
1085
|
+
confirm: z3.literal(true)
|
|
1634
1086
|
}),
|
|
1635
1087
|
payload,
|
|
1636
1088
|
action
|
|
@@ -1668,7 +1120,7 @@ function registerTeamDynamixCmdbGateway(server2) {
|
|
|
1668
1120
|
switch (action) {
|
|
1669
1121
|
case "get_ci": {
|
|
1670
1122
|
const parsed = parsePayload(
|
|
1671
|
-
|
|
1123
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, ci_id: z3.number().int().positive() }),
|
|
1672
1124
|
payload,
|
|
1673
1125
|
action
|
|
1674
1126
|
);
|
|
@@ -1677,7 +1129,7 @@ function registerTeamDynamixCmdbGateway(server2) {
|
|
|
1677
1129
|
}
|
|
1678
1130
|
case "search_cis": {
|
|
1679
1131
|
const parsed = parsePayload(
|
|
1680
|
-
|
|
1132
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, search: CiSearchSchema }),
|
|
1681
1133
|
payload,
|
|
1682
1134
|
action
|
|
1683
1135
|
);
|
|
@@ -1688,7 +1140,7 @@ function registerTeamDynamixCmdbGateway(server2) {
|
|
|
1688
1140
|
return toSuccessResponse({ appId: parsed.app_id, count: results.length, results }, response_format);
|
|
1689
1141
|
}
|
|
1690
1142
|
case "list_ci_types": {
|
|
1691
|
-
const parsed = parsePayload(
|
|
1143
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1692
1144
|
const types = await client.listCiTypes(parsed.app_id);
|
|
1693
1145
|
return toSuccessResponse({ appId: parsed.app_id, count: types.length, types }, response_format);
|
|
1694
1146
|
}
|
|
@@ -1697,16 +1149,16 @@ function registerTeamDynamixCmdbGateway(server2) {
|
|
|
1697
1149
|
return toSuccessResponse({ count: types.length, types }, response_format);
|
|
1698
1150
|
}
|
|
1699
1151
|
case "list_vendors": {
|
|
1700
|
-
const parsed = parsePayload(
|
|
1152
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1701
1153
|
const vendors = await client.listVendors(parsed.app_id);
|
|
1702
1154
|
return toSuccessResponse({ appId: parsed.app_id, count: vendors.length, vendors }, response_format);
|
|
1703
1155
|
}
|
|
1704
1156
|
case "delete_ci": {
|
|
1705
1157
|
const parsed = parsePayload(
|
|
1706
|
-
|
|
1158
|
+
z3.object({
|
|
1707
1159
|
app_id: TeamDynamixAppIdSchema,
|
|
1708
|
-
ci_id:
|
|
1709
|
-
confirm:
|
|
1160
|
+
ci_id: z3.number().int().positive(),
|
|
1161
|
+
confirm: z3.literal(true)
|
|
1710
1162
|
}),
|
|
1711
1163
|
payload,
|
|
1712
1164
|
action
|
|
@@ -1740,13 +1192,13 @@ function registerTeamDynamixServicesGateway(server2) {
|
|
|
1740
1192
|
const client = createConfiguredTeamDynamixClient();
|
|
1741
1193
|
switch (action) {
|
|
1742
1194
|
case "list_services": {
|
|
1743
|
-
const parsed = parsePayload(
|
|
1195
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1744
1196
|
const services = await client.listServiceCatalog(parsed.app_id);
|
|
1745
1197
|
return toSuccessResponse({ appId: parsed.app_id, count: services.length, services }, response_format);
|
|
1746
1198
|
}
|
|
1747
1199
|
case "get_service": {
|
|
1748
1200
|
const parsed = parsePayload(
|
|
1749
|
-
|
|
1201
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, service_id: z3.number().int().positive() }),
|
|
1750
1202
|
payload,
|
|
1751
1203
|
action
|
|
1752
1204
|
);
|
|
@@ -1755,7 +1207,7 @@ function registerTeamDynamixServicesGateway(server2) {
|
|
|
1755
1207
|
}
|
|
1756
1208
|
case "search_services": {
|
|
1757
1209
|
const parsed = parsePayload(
|
|
1758
|
-
|
|
1210
|
+
z3.object({ app_id: TeamDynamixAppIdSchema, search: ServiceSearchSchema }),
|
|
1759
1211
|
payload,
|
|
1760
1212
|
action
|
|
1761
1213
|
);
|
|
@@ -1763,16 +1215,16 @@ function registerTeamDynamixServicesGateway(server2) {
|
|
|
1763
1215
|
return toSuccessResponse({ appId: parsed.app_id, count: services.length, services }, response_format);
|
|
1764
1216
|
}
|
|
1765
1217
|
case "list_service_categories": {
|
|
1766
|
-
const parsed = parsePayload(
|
|
1218
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema }), payload, action);
|
|
1767
1219
|
const categories = await client.listServiceCategories(parsed.app_id);
|
|
1768
1220
|
return toSuccessResponse({ appId: parsed.app_id, count: categories.length, categories }, response_format);
|
|
1769
1221
|
}
|
|
1770
1222
|
case "delete_service": {
|
|
1771
1223
|
const parsed = parsePayload(
|
|
1772
|
-
|
|
1224
|
+
z3.object({
|
|
1773
1225
|
app_id: TeamDynamixAppIdSchema,
|
|
1774
|
-
service_id:
|
|
1775
|
-
confirm:
|
|
1226
|
+
service_id: z3.number().int().positive(),
|
|
1227
|
+
confirm: z3.literal(true)
|
|
1776
1228
|
}),
|
|
1777
1229
|
payload,
|
|
1778
1230
|
action
|
|
@@ -1786,10 +1238,10 @@ function registerTeamDynamixServicesGateway(server2) {
|
|
|
1786
1238
|
}
|
|
1787
1239
|
case "delete_service_category": {
|
|
1788
1240
|
const parsed = parsePayload(
|
|
1789
|
-
|
|
1241
|
+
z3.object({
|
|
1790
1242
|
app_id: TeamDynamixAppIdSchema,
|
|
1791
|
-
category_id:
|
|
1792
|
-
confirm:
|
|
1243
|
+
category_id: z3.number().int().positive(),
|
|
1244
|
+
confirm: z3.literal(true)
|
|
1793
1245
|
}),
|
|
1794
1246
|
payload,
|
|
1795
1247
|
action
|
|
@@ -1826,12 +1278,12 @@ function registerTeamDynamixProjectsGateway(server2) {
|
|
|
1826
1278
|
const client = createConfiguredTeamDynamixClient();
|
|
1827
1279
|
switch (action) {
|
|
1828
1280
|
case "get_project": {
|
|
1829
|
-
const parsed = parsePayload(
|
|
1281
|
+
const parsed = parsePayload(z3.object({ project_id: z3.number().int().positive() }), payload, action);
|
|
1830
1282
|
const project = await client.getProject(parsed.project_id);
|
|
1831
1283
|
return toSuccessResponse(project, response_format);
|
|
1832
1284
|
}
|
|
1833
1285
|
case "search_projects": {
|
|
1834
|
-
const parsed = parsePayload(
|
|
1286
|
+
const parsed = parsePayload(z3.object({ search: ProjectSearchSchema }), payload, action);
|
|
1835
1287
|
const projects = await client.searchProjects(parsed.search);
|
|
1836
1288
|
return toSuccessResponse({ count: projects.length, projects }, response_format);
|
|
1837
1289
|
}
|
|
@@ -1840,23 +1292,23 @@ function registerTeamDynamixProjectsGateway(server2) {
|
|
|
1840
1292
|
return toSuccessResponse({ count: types.length, types }, response_format);
|
|
1841
1293
|
}
|
|
1842
1294
|
case "get_project_plans": {
|
|
1843
|
-
const parsed = parsePayload(
|
|
1295
|
+
const parsed = parsePayload(z3.object({ project_id: z3.number().int().positive() }), payload, action);
|
|
1844
1296
|
const plans = await client.getProjectPlans(parsed.project_id);
|
|
1845
1297
|
return toSuccessResponse({ projectId: parsed.project_id, count: plans.length, plans }, response_format);
|
|
1846
1298
|
}
|
|
1847
1299
|
case "get_project_issues": {
|
|
1848
|
-
const parsed = parsePayload(
|
|
1300
|
+
const parsed = parsePayload(z3.object({ project_id: z3.number().int().positive() }), payload, action);
|
|
1849
1301
|
const issues = await client.getProjectIssues(parsed.project_id);
|
|
1850
1302
|
return toSuccessResponse({ projectId: parsed.project_id, count: issues.length, issues }, response_format);
|
|
1851
1303
|
}
|
|
1852
1304
|
case "get_project_risks": {
|
|
1853
|
-
const parsed = parsePayload(
|
|
1305
|
+
const parsed = parsePayload(z3.object({ project_id: z3.number().int().positive() }), payload, action);
|
|
1854
1306
|
const risks = await client.getProjectRisks(parsed.project_id);
|
|
1855
1307
|
return toSuccessResponse({ projectId: parsed.project_id, count: risks.length, risks }, response_format);
|
|
1856
1308
|
}
|
|
1857
1309
|
case "create_project_issue": {
|
|
1858
1310
|
const parsed = parsePayload(
|
|
1859
|
-
|
|
1311
|
+
z3.object({ project_id: z3.number().int().positive(), issue: ProjectIssueCreateSchema }),
|
|
1860
1312
|
payload,
|
|
1861
1313
|
action
|
|
1862
1314
|
);
|
|
@@ -1866,7 +1318,7 @@ function registerTeamDynamixProjectsGateway(server2) {
|
|
|
1866
1318
|
}
|
|
1867
1319
|
case "create_project_risk": {
|
|
1868
1320
|
const parsed = parsePayload(
|
|
1869
|
-
|
|
1321
|
+
z3.object({ project_id: z3.number().int().positive(), risk: ProjectRiskCreateSchema }),
|
|
1870
1322
|
payload,
|
|
1871
1323
|
action
|
|
1872
1324
|
);
|
|
@@ -1903,7 +1355,7 @@ function registerTeamDynamixTimeGateway(server2) {
|
|
|
1903
1355
|
return toSuccessResponse({ count: types.length, types }, response_format);
|
|
1904
1356
|
}
|
|
1905
1357
|
case "get_my_time_entries": {
|
|
1906
|
-
const parsed = parsePayload(
|
|
1358
|
+
const parsed = parsePayload(z3.object({ query: TimeEntryQuerySchema }), payload, action);
|
|
1907
1359
|
const entries = await client.getMyTimeEntries(parsed.query.StartDate, parsed.query.EndDate);
|
|
1908
1360
|
return toSuccessResponse({ count: entries.length, entries }, response_format);
|
|
1909
1361
|
}
|
|
@@ -1932,12 +1384,12 @@ function registerTeamDynamixReferenceDataGateway(server2) {
|
|
|
1932
1384
|
const client = createConfiguredTeamDynamixClient();
|
|
1933
1385
|
switch (action) {
|
|
1934
1386
|
case "list_accounts": {
|
|
1935
|
-
const parsed = parsePayload(
|
|
1387
|
+
const parsed = parsePayload(z3.object({ app_id: TeamDynamixAppIdSchema.optional() }), payload, action);
|
|
1936
1388
|
const accounts = await client.listAccounts(parsed.app_id);
|
|
1937
1389
|
return toSuccessResponse({ count: accounts.length, accounts }, response_format);
|
|
1938
1390
|
}
|
|
1939
1391
|
case "get_account": {
|
|
1940
|
-
const parsed = parsePayload(
|
|
1392
|
+
const parsed = parsePayload(z3.object({ account_id: z3.number().int().positive() }), payload, action);
|
|
1941
1393
|
const account = await client.getAccount(parsed.account_id);
|
|
1942
1394
|
return toSuccessResponse(account, response_format);
|
|
1943
1395
|
}
|
|
@@ -1951,10 +1403,10 @@ function registerTeamDynamixReferenceDataGateway(server2) {
|
|
|
1951
1403
|
}
|
|
1952
1404
|
case "list_custom_attributes": {
|
|
1953
1405
|
const parsed = parsePayload(
|
|
1954
|
-
|
|
1406
|
+
z3.object({
|
|
1955
1407
|
component_id: CustomAttributeComponentIdSchema,
|
|
1956
1408
|
app_id: TeamDynamixAppIdSchema.optional(),
|
|
1957
|
-
associated_type_id:
|
|
1409
|
+
associated_type_id: z3.number().int().positive().optional()
|
|
1958
1410
|
}),
|
|
1959
1411
|
payload,
|
|
1960
1412
|
action
|
|
@@ -2059,12 +1511,188 @@ function registerTeamDynamixResources(server2) {
|
|
|
2059
1511
|
);
|
|
2060
1512
|
}
|
|
2061
1513
|
|
|
1514
|
+
// src/tools/teamdynamix.watch.tools.ts
|
|
1515
|
+
import { z as z4 } from "zod";
|
|
1516
|
+
var WatchKindSchema = z4.enum(["mine", "watching", "waiting-on-others"]);
|
|
1517
|
+
var BallSchema = z4.enum(["us", "them"]);
|
|
1518
|
+
function messageFromError2(error) {
|
|
1519
|
+
return error instanceof Error ? error.message : String(error);
|
|
1520
|
+
}
|
|
1521
|
+
async function withService(responseFormat, fn) {
|
|
1522
|
+
try {
|
|
1523
|
+
const client = createConfiguredTeamDynamixClient();
|
|
1524
|
+
const ledgerPath = defaultLedgerPath();
|
|
1525
|
+
let ledger;
|
|
1526
|
+
try {
|
|
1527
|
+
ledger = await loadLedger(ledgerPath);
|
|
1528
|
+
} catch (cause) {
|
|
1529
|
+
if (cause instanceof LedgerCorruptError) throw cause;
|
|
1530
|
+
ledger = emptyLedger();
|
|
1531
|
+
}
|
|
1532
|
+
const svc = new WorkspaceWatchService(ledger, ledgerPath, client);
|
|
1533
|
+
const data = await fn(svc);
|
|
1534
|
+
return {
|
|
1535
|
+
content: [{ type: "text", text: render(data, responseFormat) }],
|
|
1536
|
+
structuredContent: data
|
|
1537
|
+
};
|
|
1538
|
+
} catch (error) {
|
|
1539
|
+
return { content: [{ type: "text", text: `Error: ${messageFromError2(error)}` }], isError: true };
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
function registerTeamDynamixWatchTools(server2) {
|
|
1543
|
+
const readOnly = { readOnlyHint: true, idempotentHint: false, destructiveHint: false, openWorldHint: true };
|
|
1544
|
+
server2.registerTool(
|
|
1545
|
+
`${TEAMDYNAMIX_TOOL_PREFIX}_watch_check`,
|
|
1546
|
+
{
|
|
1547
|
+
title: "Watch Check",
|
|
1548
|
+
description: "Diff pass over the watch ledger: sweeps queue searches per app, deep-fetches only changed tickets, and returns classified deltas (status, new-entry, hidden-reply, ownership, sla, hold-window).",
|
|
1549
|
+
inputSchema: {
|
|
1550
|
+
tickets: z4.array(z4.number().int().positive()).optional().describe("Restrict the check to these ticket IDs."),
|
|
1551
|
+
response_format: TeamDynamixResponseFormatSchema
|
|
1552
|
+
},
|
|
1553
|
+
annotations: { ...readOnly }
|
|
1554
|
+
},
|
|
1555
|
+
async ({ tickets, response_format }) => withService(response_format, (svc) => svc.check({ tickets }))
|
|
1556
|
+
);
|
|
1557
|
+
server2.registerTool(
|
|
1558
|
+
`${TEAMDYNAMIX_TOOL_PREFIX}_watch_status`,
|
|
1559
|
+
{
|
|
1560
|
+
title: "Watch Status",
|
|
1561
|
+
description: "Ledger summary (counts, ball-in-court, pending-triage queue, oldest freshness) without any TDX calls.",
|
|
1562
|
+
inputSchema: { response_format: TeamDynamixResponseFormatSchema },
|
|
1563
|
+
annotations: { ...readOnly, idempotentHint: true, openWorldHint: false }
|
|
1564
|
+
},
|
|
1565
|
+
async ({ response_format }) => withService(response_format, async (svc) => ({
|
|
1566
|
+
...await svc.status(),
|
|
1567
|
+
pendingTriage: svc.pendingTriage()
|
|
1568
|
+
}))
|
|
1569
|
+
);
|
|
1570
|
+
server2.registerTool(
|
|
1571
|
+
`${TEAMDYNAMIX_TOOL_PREFIX}_watch_sweep`,
|
|
1572
|
+
{
|
|
1573
|
+
title: "Watch Sweep",
|
|
1574
|
+
description: "Cheap sweep: one queue search per configured app, client-side team restriction (TEAMDYNAMIX_TICKET_GROUP_IDS), ledger freshness, and pending-triage queue maintenance (changed + new-unassigned tickets). No deep fetches.",
|
|
1575
|
+
inputSchema: { response_format: TeamDynamixResponseFormatSchema },
|
|
1576
|
+
annotations: { ...readOnly }
|
|
1577
|
+
},
|
|
1578
|
+
async ({ response_format }) => withService(response_format, (svc) => svc.sweep())
|
|
1579
|
+
);
|
|
1580
|
+
server2.registerTool(
|
|
1581
|
+
`${TEAMDYNAMIX_TOOL_PREFIX}_watch_triage`,
|
|
1582
|
+
{
|
|
1583
|
+
title: "Watch Triage Queue",
|
|
1584
|
+
description: "Local triage queue (never calls TDX). op=queue lists pending tickets needing background triage; op=done removes a ticket after the agent has reviewed it and updated notes.",
|
|
1585
|
+
inputSchema: {
|
|
1586
|
+
op: z4.enum(["queue", "done"]),
|
|
1587
|
+
ticket_id: z4.number().int().positive().optional().describe("Required for op=done."),
|
|
1588
|
+
response_format: TeamDynamixResponseFormatSchema
|
|
1589
|
+
},
|
|
1590
|
+
annotations: { ...readOnly, openWorldHint: false }
|
|
1591
|
+
},
|
|
1592
|
+
async ({
|
|
1593
|
+
op,
|
|
1594
|
+
ticket_id,
|
|
1595
|
+
response_format
|
|
1596
|
+
}) => withService(response_format, async (svc) => {
|
|
1597
|
+
if (op === "queue") return { pending: svc.pendingTriage() };
|
|
1598
|
+
if (ticket_id === void 0) throw new Error("op=done requires ticket_id.");
|
|
1599
|
+
return await svc.markTriaged(ticket_id);
|
|
1600
|
+
})
|
|
1601
|
+
);
|
|
1602
|
+
server2.registerTool(
|
|
1603
|
+
`${TEAMDYNAMIX_TOOL_PREFIX}_watch_register`,
|
|
1604
|
+
{
|
|
1605
|
+
title: "Watch Register",
|
|
1606
|
+
description: "Add/update a ledger row when a ticket is claimed, re-scoped, or swept in. Never calls TDX.",
|
|
1607
|
+
inputSchema: {
|
|
1608
|
+
app_id: z4.number().int().positive().describe("Ticketing application ID."),
|
|
1609
|
+
id: z4.number().int().positive().describe("Ticket ID."),
|
|
1610
|
+
kind: WatchKindSchema.describe("Lane: mine, watching, or waiting-on-others."),
|
|
1611
|
+
title: z4.string().max(200).optional().describe("Short title (stored locally only)."),
|
|
1612
|
+
district: z4.string().max(100).optional().describe("District/lane label."),
|
|
1613
|
+
ball: BallSchema.optional().describe("Manual ball-in-court override (survives auto-inference)."),
|
|
1614
|
+
next_action: z4.string().max(500).optional().describe("Next action note."),
|
|
1615
|
+
response_format: TeamDynamixResponseFormatSchema
|
|
1616
|
+
},
|
|
1617
|
+
annotations: { ...readOnly, openWorldHint: false }
|
|
1618
|
+
},
|
|
1619
|
+
async ({
|
|
1620
|
+
app_id,
|
|
1621
|
+
id,
|
|
1622
|
+
kind,
|
|
1623
|
+
title,
|
|
1624
|
+
district,
|
|
1625
|
+
ball,
|
|
1626
|
+
next_action,
|
|
1627
|
+
response_format
|
|
1628
|
+
}) => withService(
|
|
1629
|
+
response_format,
|
|
1630
|
+
(svc) => svc.register({ appId: app_id, id, kind, title, district, ball, nextAction: next_action })
|
|
1631
|
+
)
|
|
1632
|
+
);
|
|
1633
|
+
server2.registerTool(
|
|
1634
|
+
`${TEAMDYNAMIX_TOOL_PREFIX}_watch_archive`,
|
|
1635
|
+
{
|
|
1636
|
+
title: "Watch Archive",
|
|
1637
|
+
description: "Move a confirmed-closed row to the archive section. Memory (notes) is preserved. Never calls TDX.",
|
|
1638
|
+
inputSchema: {
|
|
1639
|
+
id: z4.number().int().positive().describe("Ticket ID."),
|
|
1640
|
+
outcome: z4.string().max(200).optional().describe("Resolution outcome label."),
|
|
1641
|
+
response_format: TeamDynamixResponseFormatSchema
|
|
1642
|
+
},
|
|
1643
|
+
annotations: { ...readOnly, openWorldHint: false }
|
|
1644
|
+
},
|
|
1645
|
+
async ({ id, outcome, response_format }) => withService(response_format, (svc) => svc.archive({ id, outcome }))
|
|
1646
|
+
);
|
|
1647
|
+
server2.registerTool(
|
|
1648
|
+
`${TEAMDYNAMIX_TOOL_PREFIX}_watch_notes`,
|
|
1649
|
+
{
|
|
1650
|
+
title: "Watch Notes",
|
|
1651
|
+
description: "Local-only notes attached to ledgered tickets \u2014 the server's own memory. Never written to TDX. op: add | update | delete | list.",
|
|
1652
|
+
inputSchema: {
|
|
1653
|
+
op: z4.enum(["add", "update", "delete", "list"]),
|
|
1654
|
+
app_id: z4.number().int().positive().optional(),
|
|
1655
|
+
ticket_id: z4.number().int().positive().optional(),
|
|
1656
|
+
note_id: z4.string().optional(),
|
|
1657
|
+
text: z4.string().max(4e3).optional(),
|
|
1658
|
+
response_format: TeamDynamixResponseFormatSchema
|
|
1659
|
+
},
|
|
1660
|
+
annotations: { ...readOnly, openWorldHint: false }
|
|
1661
|
+
},
|
|
1662
|
+
async ({
|
|
1663
|
+
op,
|
|
1664
|
+
app_id,
|
|
1665
|
+
ticket_id,
|
|
1666
|
+
note_id,
|
|
1667
|
+
text,
|
|
1668
|
+
response_format
|
|
1669
|
+
}) => withService(response_format, async (svc) => {
|
|
1670
|
+
switch (op) {
|
|
1671
|
+
case "add":
|
|
1672
|
+
if (app_id === void 0 || ticket_id === void 0 || !text) {
|
|
1673
|
+
throw new Error("op=add requires app_id, ticket_id, and text.");
|
|
1674
|
+
}
|
|
1675
|
+
return svc.notesAdd({ appId: app_id, ticketId: ticket_id, text });
|
|
1676
|
+
case "update":
|
|
1677
|
+
if (!note_id || !text) throw new Error("op=update requires note_id and text.");
|
|
1678
|
+
return svc.notesUpdate({ noteId: note_id, text });
|
|
1679
|
+
case "delete":
|
|
1680
|
+
if (!note_id) throw new Error("op=delete requires note_id.");
|
|
1681
|
+
return svc.notesDelete({ noteId: note_id });
|
|
1682
|
+
case "list":
|
|
1683
|
+
return svc.notesList({ appId: app_id, ticketId: ticket_id });
|
|
1684
|
+
}
|
|
1685
|
+
})
|
|
1686
|
+
);
|
|
1687
|
+
}
|
|
1688
|
+
|
|
2062
1689
|
// src/index.ts
|
|
2063
1690
|
var server = new McpServer2({
|
|
2064
1691
|
name: SERVER_NAME_OVERRIDE ?? SERVER_NAME,
|
|
2065
1692
|
version: SERVER_VERSION_OVERRIDE ?? SERVER_VERSION
|
|
2066
1693
|
});
|
|
2067
1694
|
registerTeamDynamixDomainGatewayTools(server);
|
|
1695
|
+
registerTeamDynamixWatchTools(server);
|
|
2068
1696
|
registerTeamDynamixResources(server);
|
|
2069
1697
|
async function main() {
|
|
2070
1698
|
console.error(`[teamdynamix-mcp] log level: ${LOG_LEVEL}`);
|
|
@@ -2072,9 +1700,37 @@ async function main() {
|
|
|
2072
1700
|
const config = getTeamDynamixConfig();
|
|
2073
1701
|
console.error(`[teamdynamix-mcp] sanitized config: ${JSON.stringify(redactTeamDynamixConfig(config))}`);
|
|
2074
1702
|
}
|
|
1703
|
+
startWatchSweepTimer();
|
|
2075
1704
|
const transport = new StdioServerTransport();
|
|
2076
1705
|
await server.connect(transport);
|
|
2077
1706
|
}
|
|
1707
|
+
function startWatchSweepTimer() {
|
|
1708
|
+
const secs = Number(process.env["TEAMDYNAMIX_WATCH_SWEEP_SECS"] ?? 0);
|
|
1709
|
+
if (!Number.isFinite(secs) || secs <= 0) return;
|
|
1710
|
+
const timer = setInterval(() => {
|
|
1711
|
+
import("./watch.store-TMX6RTON.js").then(async ({ loadLedger: loadLedger2, saveLedger, emptyLedger: emptyLedger2, defaultLedgerPath: defaultLedgerPath2, LedgerCorruptError: LedgerCorruptError2 }) => {
|
|
1712
|
+
const { createConfiguredTeamDynamixClient: createConfiguredTeamDynamixClient2 } = await import("./client.service-B22MXWP4.js");
|
|
1713
|
+
const { WorkspaceWatchService: WorkspaceWatchService2 } = await import("./watch.service-D367V6RC.js");
|
|
1714
|
+
const ledgerPath = defaultLedgerPath2();
|
|
1715
|
+
let ledger;
|
|
1716
|
+
try {
|
|
1717
|
+
ledger = await loadLedger2(ledgerPath);
|
|
1718
|
+
} catch (cause) {
|
|
1719
|
+
if (cause instanceof LedgerCorruptError2) throw cause;
|
|
1720
|
+
ledger = emptyLedger2();
|
|
1721
|
+
}
|
|
1722
|
+
const client = await createConfiguredTeamDynamixClient2();
|
|
1723
|
+
const svc = new WorkspaceWatchService2(ledger, ledgerPath, client);
|
|
1724
|
+
const result = await svc.sweep();
|
|
1725
|
+
console.error(`[teamdynamix-mcp] watch sweep: ${JSON.stringify(result)}`);
|
|
1726
|
+
}).catch((cause) => {
|
|
1727
|
+
console.error(
|
|
1728
|
+
`[teamdynamix-mcp] watch sweep failed: ${cause instanceof Error ? cause.message : String(cause)}`
|
|
1729
|
+
);
|
|
1730
|
+
});
|
|
1731
|
+
}, secs * 1e3);
|
|
1732
|
+
timer.unref();
|
|
1733
|
+
}
|
|
2078
1734
|
main().catch((error) => {
|
|
2079
1735
|
const message = error instanceof Error ? error.message : String(error);
|
|
2080
1736
|
console.error(`Server startup failed: ${message}`);
|