@onlyflows/servicenow-mcp 1.0.0 → 2.0.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/.env.example +56 -0
- package/CHANGELOG.md +153 -0
- package/README.md +939 -101
- package/dist/auth.d.ts +88 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +396 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +111 -17
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +554 -79
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +41 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +44 -34
- package/dist/config.js.map +1 -1
- package/dist/encoded-query-policy.d.ts +72 -0
- package/dist/encoded-query-policy.d.ts.map +1 -0
- package/dist/encoded-query-policy.js +409 -0
- package/dist/encoded-query-policy.js.map +1 -0
- package/dist/execution-context.d.ts +235 -0
- package/dist/execution-context.d.ts.map +1 -0
- package/dist/execution-context.js +439 -0
- package/dist/execution-context.js.map +1 -0
- package/dist/field-policy.d.ts +117 -0
- package/dist/field-policy.d.ts.map +1 -0
- package/dist/field-policy.js +1684 -0
- package/dist/field-policy.js.map +1 -0
- package/dist/http-auth.d.ts +131 -0
- package/dist/http-auth.d.ts.map +1 -0
- package/dist/http-auth.js +347 -0
- package/dist/http-auth.js.map +1 -0
- package/dist/http-entrypoint.d.ts +26 -0
- package/dist/http-entrypoint.d.ts.map +1 -0
- package/dist/http-entrypoint.js +255 -0
- package/dist/http-entrypoint.js.map +1 -0
- package/dist/http-observability.d.ts +147 -0
- package/dist/http-observability.d.ts.map +1 -0
- package/dist/http-observability.js +703 -0
- package/dist/http-observability.js.map +1 -0
- package/dist/http-request-policy.d.ts +72 -0
- package/dist/http-request-policy.d.ts.map +1 -0
- package/dist/http-request-policy.js +463 -0
- package/dist/http-request-policy.js.map +1 -0
- package/dist/http-request-signal.d.ts +12 -0
- package/dist/http-request-signal.d.ts.map +1 -0
- package/dist/http-request-signal.js +39 -0
- package/dist/http-request-signal.js.map +1 -0
- package/dist/http-runtime.d.ts +77 -0
- package/dist/http-runtime.d.ts.map +1 -0
- package/dist/http-runtime.js +1321 -0
- package/dist/http-runtime.js.map +1 -0
- package/dist/incident-journal-policy.d.ts +22 -0
- package/dist/incident-journal-policy.d.ts.map +1 -0
- package/dist/incident-journal-policy.js +115 -0
- package/dist/incident-journal-policy.js.map +1 -0
- package/dist/incident-write-policy.d.ts +20 -0
- package/dist/incident-write-policy.d.ts.map +1 -0
- package/dist/incident-write-policy.js +196 -0
- package/dist/incident-write-policy.js.map +1 -0
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +140 -36
- package/dist/index.js.map +1 -1
- package/dist/metadata-cache.d.ts +71 -0
- package/dist/metadata-cache.d.ts.map +1 -0
- package/dist/metadata-cache.js +397 -0
- package/dist/metadata-cache.js.map +1 -0
- package/dist/profile-admin.d.ts +64 -0
- package/dist/profile-admin.d.ts.map +1 -0
- package/dist/profile-admin.js +351 -0
- package/dist/profile-admin.js.map +1 -0
- package/dist/profile-credentials.d.ts +68 -0
- package/dist/profile-credentials.d.ts.map +1 -0
- package/dist/profile-credentials.js +329 -0
- package/dist/profile-credentials.js.map +1 -0
- package/dist/profile-manager.d.ts +187 -0
- package/dist/profile-manager.d.ts.map +1 -0
- package/dist/profile-manager.js +1026 -0
- package/dist/profile-manager.js.map +1 -0
- package/dist/record-identifier-policy.d.ts +39 -0
- package/dist/record-identifier-policy.d.ts.map +1 -0
- package/dist/record-identifier-policy.js +203 -0
- package/dist/record-identifier-policy.js.map +1 -0
- package/dist/runtime-environment.d.ts +23 -0
- package/dist/runtime-environment.d.ts.map +1 -0
- package/dist/runtime-environment.js +58 -0
- package/dist/runtime-environment.js.map +1 -0
- package/dist/server.d.ts +33 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +73 -0
- package/dist/server.js.map +1 -0
- package/dist/servicenow-identifiers.d.ts +8 -0
- package/dist/servicenow-identifiers.d.ts.map +1 -0
- package/dist/servicenow-identifiers.js +22 -0
- package/dist/servicenow-identifiers.js.map +1 -0
- package/dist/setup-prompts.d.ts +7 -0
- package/dist/setup-prompts.d.ts.map +1 -0
- package/dist/setup-prompts.js +123 -0
- package/dist/setup-prompts.js.map +1 -0
- package/dist/setup.d.ts +109 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +1903 -0
- package/dist/setup.js.map +1 -0
- package/dist/startup.d.ts +43 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +75 -0
- package/dist/startup.js.map +1 -0
- package/dist/stdio-runtime.d.ts +106 -0
- package/dist/stdio-runtime.d.ts.map +1 -0
- package/dist/stdio-runtime.js +231 -0
- package/dist/stdio-runtime.js.map +1 -0
- package/dist/structured-query.d.ts +187 -0
- package/dist/structured-query.d.ts.map +1 -0
- package/dist/structured-query.js +503 -0
- package/dist/structured-query.js.map +1 -0
- package/dist/table-defaults.d.ts +28 -0
- package/dist/table-defaults.d.ts.map +1 -0
- package/dist/table-defaults.js +85 -0
- package/dist/table-defaults.js.map +1 -0
- package/dist/table-policy.d.ts +71 -0
- package/dist/table-policy.d.ts.map +1 -0
- package/dist/table-policy.js +290 -0
- package/dist/table-policy.js.map +1 -0
- package/dist/tool-error.d.ts +48 -0
- package/dist/tool-error.d.ts.map +1 -0
- package/dist/tool-error.js +139 -0
- package/dist/tool-error.js.map +1 -0
- package/dist/tool-table-access.d.ts +19 -0
- package/dist/tool-table-access.d.ts.map +1 -0
- package/dist/tool-table-access.js +388 -0
- package/dist/tool-table-access.js.map +1 -0
- package/dist/tools/aggregate.d.ts +22 -42
- package/dist/tools/aggregate.d.ts.map +1 -1
- package/dist/tools/aggregate.js +103 -47
- package/dist/tools/aggregate.js.map +1 -1
- package/dist/tools/all-fields-cap.d.ts +45 -0
- package/dist/tools/all-fields-cap.d.ts.map +1 -0
- package/dist/tools/all-fields-cap.js +151 -0
- package/dist/tools/all-fields-cap.js.map +1 -0
- package/dist/tools/atf.d.ts +21 -60
- package/dist/tools/atf.d.ts.map +1 -1
- package/dist/tools/atf.js +180 -116
- package/dist/tools/atf.js.map +1 -1
- package/dist/tools/attach.d.ts +31 -45
- package/dist/tools/attach.d.ts.map +1 -1
- package/dist/tools/attach.js +175 -137
- package/dist/tools/attach.js.map +1 -1
- package/dist/tools/batch.d.ts +78 -42
- package/dist/tools/batch.d.ts.map +1 -1
- package/dist/tools/batch.js +172 -68
- package/dist/tools/batch.js.map +1 -1
- package/dist/tools/catalog.d.ts +6 -0
- package/dist/tools/catalog.d.ts.map +1 -0
- package/dist/tools/catalog.js +203 -0
- package/dist/tools/catalog.js.map +1 -0
- package/dist/tools/codesearch.d.ts +14 -25
- package/dist/tools/codesearch.d.ts.map +1 -1
- package/dist/tools/codesearch.js +60 -48
- package/dist/tools/codesearch.js.map +1 -1
- package/dist/tools/create-module.d.ts +48 -0
- package/dist/tools/create-module.d.ts.map +1 -0
- package/dist/tools/create-module.js +94 -0
- package/dist/tools/create-module.js.map +1 -0
- package/dist/tools/create.d.ts +2 -38
- package/dist/tools/create.d.ts.map +1 -1
- package/dist/tools/create.js +9 -41
- package/dist/tools/create.js.map +1 -1
- package/dist/tools/delete.d.ts +13 -23
- package/dist/tools/delete.d.ts.map +1 -1
- package/dist/tools/delete.js +30 -33
- package/dist/tools/delete.js.map +1 -1
- package/dist/tools/discover.d.ts +15 -27
- package/dist/tools/discover.d.ts.map +1 -1
- package/dist/tools/discover.js +103 -60
- package/dist/tools/discover.js.map +1 -1
- package/dist/tools/get-module.d.ts +85 -0
- package/dist/tools/get-module.d.ts.map +1 -0
- package/dist/tools/get-module.js +221 -0
- package/dist/tools/get-module.js.map +1 -0
- package/dist/tools/get.d.ts +2 -51
- package/dist/tools/get.d.ts.map +1 -1
- package/dist/tools/get.js +9 -49
- package/dist/tools/get.js.map +1 -1
- package/dist/tools/handler-result.d.ts +14 -0
- package/dist/tools/handler-result.d.ts.map +1 -0
- package/dist/tools/handler-result.js +177 -0
- package/dist/tools/handler-result.js.map +1 -0
- package/dist/tools/health.d.ts +12 -15
- package/dist/tools/health.d.ts.map +1 -1
- package/dist/tools/health.js +55 -36
- package/dist/tools/health.js.map +1 -1
- package/dist/tools/incident-journal-module.d.ts +12 -0
- package/dist/tools/incident-journal-module.d.ts.map +1 -0
- package/dist/tools/incident-journal-module.js +61 -0
- package/dist/tools/incident-journal-module.js.map +1 -0
- package/dist/tools/incident-write-shared.d.ts +6 -0
- package/dist/tools/incident-write-shared.d.ts.map +1 -0
- package/dist/tools/incident-write-shared.js +64 -0
- package/dist/tools/incident-write-shared.js.map +1 -0
- package/dist/tools/index.d.ts +47 -36
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +795 -35
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/nl.d.ts +10 -24
- package/dist/tools/nl.d.ts.map +1 -1
- package/dist/tools/nl.js +37 -147
- package/dist/tools/nl.js.map +1 -1
- package/dist/tools/profile.d.ts +37 -0
- package/dist/tools/profile.d.ts.map +1 -0
- package/dist/tools/profile.js +39 -0
- package/dist/tools/profile.js.map +1 -0
- package/dist/tools/query-module.d.ts +119 -0
- package/dist/tools/query-module.d.ts.map +1 -0
- package/dist/tools/query-module.js +324 -0
- package/dist/tools/query-module.js.map +1 -0
- package/dist/tools/query.d.ts +2 -72
- package/dist/tools/query.d.ts.map +1 -1
- package/dist/tools/query.js +8 -72
- package/dist/tools/query.js.map +1 -1
- package/dist/tools/relationships.d.ts +21 -42
- package/dist/tools/relationships.d.ts.map +1 -1
- package/dist/tools/relationships.js +70 -56
- package/dist/tools/relationships.js.map +1 -1
- package/dist/tools/result-envelope.d.ts +603 -0
- package/dist/tools/result-envelope.d.ts.map +1 -0
- package/dist/tools/result-envelope.js +767 -0
- package/dist/tools/result-envelope.js.map +1 -0
- package/dist/tools/schema-module.d.ts +64 -0
- package/dist/tools/schema-module.d.ts.map +1 -0
- package/dist/tools/schema-module.js +367 -0
- package/dist/tools/schema-module.js.map +1 -0
- package/dist/tools/schema.d.ts +2 -37
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +6 -57
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/script.d.ts +33 -27
- package/dist/tools/script.d.ts.map +1 -1
- package/dist/tools/script.js +43 -37
- package/dist/tools/script.js.map +1 -1
- package/dist/tools/syslog.d.ts +19 -46
- package/dist/tools/syslog.d.ts.map +1 -1
- package/dist/tools/syslog.js +101 -67
- package/dist/tools/syslog.js.map +1 -1
- package/dist/tools/tool-module.d.ts +143 -0
- package/dist/tools/tool-module.d.ts.map +1 -0
- package/dist/tools/tool-module.js +1095 -0
- package/dist/tools/tool-module.js.map +1 -0
- package/dist/tools/update-module.d.ts +51 -0
- package/dist/tools/update-module.d.ts.map +1 -0
- package/dist/tools/update-module.js +107 -0
- package/dist/tools/update-module.js.map +1 -0
- package/dist/tools/update.d.ts +2 -45
- package/dist/tools/update.d.ts.map +1 -1
- package/dist/tools/update.js +9 -41
- package/dist/tools/update.js.map +1 -1
- package/dist/utils.d.ts +68 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +114 -16
- package/dist/utils.js.map +1 -1
- package/dist/version.d.ts +10 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +13 -0
- package/dist/version.js.map +1 -0
- package/docs/ADDING-TOOLS.md +227 -0
- package/docs/CLIENT-SETUP.md +914 -0
- package/docs/CONTAINER-DEPLOYMENT.md +310 -0
- package/docs/CROSS-CLIENT-RELEASE-MATRIX.md +63 -0
- package/docs/ENTERPRISE-RELEASE-BOUNDARY.md +149 -0
- package/docs/OPERATIONS-RUNBOOK.md +383 -0
- package/docs/PRIVATE-CHATGPT-CONNECTIVITY.md +347 -0
- package/docs/PRODUCTION-SECURITY.md +368 -0
- package/docs/PROFILE-CREDENTIALS.md +126 -0
- package/docs/RELEASE-VALIDATION.md +140 -0
- package/docs/TESTING-OAUTH.md +101 -0
- package/docs/V2-MIGRATION.md +493 -0
- package/package.json +60 -13
- package/scripts/inspector.mjs +140 -0
- package/scripts/release-validate.mjs +201 -0
- package/scripts/smoke-test.mjs +274 -0
- package/tools/inspector/package-lock.json +3812 -0
- package/tools/inspector/package.json +12 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Canonical contract-bearing sn_get module. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getToolModule = exports.moduleInputSchema = exports.schema = exports.definition = void 0;
|
|
5
|
+
exports.handler = handler;
|
|
6
|
+
exports.resolveGetAccess = resolveGetAccess;
|
|
7
|
+
const all_fields_cap_js_1 = require("./all-fields-cap.js");
|
|
8
|
+
const result_envelope_js_1 = require("./result-envelope.js");
|
|
9
|
+
const node_util_1 = require("node:util");
|
|
10
|
+
const zod_1 = require("zod");
|
|
11
|
+
const metadata_cache_js_1 = require("../metadata-cache.js");
|
|
12
|
+
const field_policy_js_1 = require("../field-policy.js");
|
|
13
|
+
const record_identifier_policy_js_1 = require("../record-identifier-policy.js");
|
|
14
|
+
const servicenow_identifiers_js_1 = require("../servicenow-identifiers.js");
|
|
15
|
+
const table_policy_js_1 = require("../table-policy.js");
|
|
16
|
+
const tool_error_js_1 = require("../tool-error.js");
|
|
17
|
+
const utils_js_1 = require("../utils.js");
|
|
18
|
+
const result_envelope_js_2 = require("./result-envelope.js");
|
|
19
|
+
const tool_module_js_1 = require("./tool-module.js");
|
|
20
|
+
exports.definition = Object.freeze({
|
|
21
|
+
name: "sn_get",
|
|
22
|
+
description: "Get exactly one record from a policy-approved ServiceNow table by a strict " +
|
|
23
|
+
"32-hex sys_id or an approved table-specific human-readable identifier. " +
|
|
24
|
+
"Identifier resolution is exact and bounded: no match returns not_found and " +
|
|
25
|
+
"multiple matches return conflict. Explicit fields win; otherwise concise " +
|
|
26
|
+
"uses safe defaults and detailed returns all policy-approved readable fields.",
|
|
27
|
+
annotations: Object.freeze({
|
|
28
|
+
title: "Get record",
|
|
29
|
+
readOnlyHint: true,
|
|
30
|
+
destructiveHint: false,
|
|
31
|
+
idempotentHint: true,
|
|
32
|
+
openWorldHint: true,
|
|
33
|
+
}),
|
|
34
|
+
});
|
|
35
|
+
function compatibleInputSchema() {
|
|
36
|
+
return zod_1.z.object({
|
|
37
|
+
table: zod_1.z.string().describe("Policy-approved ServiceNow table name"),
|
|
38
|
+
sys_id: servicenow_identifiers_js_1.serviceNowSysIdSchema
|
|
39
|
+
.optional()
|
|
40
|
+
.describe("Exact 32-hex ServiceNow sys_id; mutually exclusive with identifier"),
|
|
41
|
+
identifier: record_identifier_policy_js_1.recordIdentifierSchema
|
|
42
|
+
.optional()
|
|
43
|
+
.describe("Approved table-specific human identifier as {field,value}; mutually exclusive with sys_id"),
|
|
44
|
+
fields: zod_1.z
|
|
45
|
+
.string()
|
|
46
|
+
.optional()
|
|
47
|
+
.describe('Comma-separated approved fields to return. Omit for safe defaults; pass "all" for every approved readable field.'),
|
|
48
|
+
response_format: zod_1.z
|
|
49
|
+
.enum(["concise", "detailed"])
|
|
50
|
+
.optional()
|
|
51
|
+
.default("concise")
|
|
52
|
+
.describe('Verbosity when fields is omitted. "concise" uses safe defaults; "detailed" uses every approved readable field. Ignored when fields is provided.'),
|
|
53
|
+
max_response_bytes: zod_1.z
|
|
54
|
+
.number()
|
|
55
|
+
.int()
|
|
56
|
+
.min(utils_js_1.MAX_RESPONSE_BYTES_MIN)
|
|
57
|
+
.max(utils_js_1.MAX_RESPONSE_BYTES_MAX)
|
|
58
|
+
.optional()
|
|
59
|
+
.default(utils_js_1.MAX_RESPONSE_BYTES_DEFAULT)
|
|
60
|
+
.describe("Final response byte budget (default 100000, min 1000, max 1000000). Long field values are shortened without mutating upstream data."),
|
|
61
|
+
display_value: zod_1.z
|
|
62
|
+
.enum(["true", "false", "all"])
|
|
63
|
+
.optional()
|
|
64
|
+
.describe("Display values mode: true, false, or all"),
|
|
65
|
+
force_recache: zod_1.z
|
|
66
|
+
.boolean()
|
|
67
|
+
.optional()
|
|
68
|
+
.default(false)
|
|
69
|
+
.describe("For metadata tables, bypass the per-instance metadata cache and refresh from ServiceNow."),
|
|
70
|
+
})
|
|
71
|
+
.strict();
|
|
72
|
+
}
|
|
73
|
+
/** Legacy source-level schema; MCP registration uses `moduleInputSchema`. */
|
|
74
|
+
exports.schema = compatibleInputSchema();
|
|
75
|
+
/** Exact public MCP input, including the mandatory shared profile selector. */
|
|
76
|
+
exports.moduleInputSchema = (0, tool_module_js_1.withRequiredProfile)(compatibleInputSchema());
|
|
77
|
+
/** Compatibility handler retained for direct source consumers. */
|
|
78
|
+
async function handler(args, client, config, _context) {
|
|
79
|
+
return executeGet(args, client, config);
|
|
80
|
+
}
|
|
81
|
+
/** Complete pre-client access resolution for the dedicated module. */
|
|
82
|
+
function resolveGetAccess(candidate) {
|
|
83
|
+
const parsed = exports.moduleInputSchema.parse(candidate);
|
|
84
|
+
const table = (0, table_policy_js_1.normalizeTableName)(parsed.table);
|
|
85
|
+
let prepared = (0, field_policy_js_1.prepareReadFieldArguments)(parsed, table, {
|
|
86
|
+
exposeFieldsArgument: true,
|
|
87
|
+
});
|
|
88
|
+
const selector = (0, record_identifier_policy_js_1.resolveRecordLookupSelector)(table, {
|
|
89
|
+
sys_id: parsed.sys_id,
|
|
90
|
+
identifier: parsed.identifier,
|
|
91
|
+
});
|
|
92
|
+
prepared = (0, field_policy_js_1.withFieldPolicyArgumentValues)(prepared, selector.kind === "sys_id"
|
|
93
|
+
? { table, sys_id: selector.sysId }
|
|
94
|
+
: {
|
|
95
|
+
table,
|
|
96
|
+
identifier: Object.freeze({
|
|
97
|
+
field: selector.field,
|
|
98
|
+
value: selector.value,
|
|
99
|
+
}),
|
|
100
|
+
});
|
|
101
|
+
return Object.freeze({
|
|
102
|
+
args: Object.freeze(prepared),
|
|
103
|
+
requests: Object.freeze([
|
|
104
|
+
Object.freeze({ operation: "read", table }),
|
|
105
|
+
]),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async function executeGet(args, client, config) {
|
|
109
|
+
const readableFields = (0, field_policy_js_1.preparedReadableFields)(args, args.table) ??
|
|
110
|
+
(0, field_policy_js_1.resolveReadableFields)(args.table, {
|
|
111
|
+
fields: args.fields,
|
|
112
|
+
responseFormat: args.response_format,
|
|
113
|
+
});
|
|
114
|
+
// A wildcard selection would drop sysparm_fields and pull every column.
|
|
115
|
+
const bounded = (0, field_policy_js_1.isAllFieldSelection)(readableFields)
|
|
116
|
+
? await (0, all_fields_cap_js_1.boundedAllFields)(client, args.table, (0, field_policy_js_1.resolveReadableFields)(args.table), args.force_recache === true)
|
|
117
|
+
: undefined;
|
|
118
|
+
const effectiveFields = bounded ? bounded.fields : readableFields;
|
|
119
|
+
const selector = (0, record_identifier_policy_js_1.resolveRecordLookupSelector)(args.table, {
|
|
120
|
+
sys_id: args.sys_id,
|
|
121
|
+
identifier: args.identifier,
|
|
122
|
+
});
|
|
123
|
+
const record = await fetchOneRecord(args, selector, effectiveFields, client, config);
|
|
124
|
+
const filtered = (0, utils_js_1.stripEmpty)((0, field_policy_js_1.filterReadableRecord)(record, effectiveFields));
|
|
125
|
+
if (typeof filtered !== "object" ||
|
|
126
|
+
filtered === null ||
|
|
127
|
+
Array.isArray(filtered)) {
|
|
128
|
+
throw (0, tool_error_js_1.createToolError)("upstream", "retry_if_safe_and_idempotent");
|
|
129
|
+
}
|
|
130
|
+
// Final byte fitting belongs to the central structured-envelope finalizer.
|
|
131
|
+
// Keeping the record namespace untouched avoids collisions with legitimate
|
|
132
|
+
// ServiceNow fields named `truncated`, `truncated_fields`, or `hint`, which
|
|
133
|
+
// is why a capped projection is reported through the reserved envelope key
|
|
134
|
+
// rather than as a field on the record.
|
|
135
|
+
return (0, utils_js_1.ok)(bounded?.capped === true
|
|
136
|
+
? {
|
|
137
|
+
[result_envelope_js_1.ENVELOPE_HINT_KEY]: (0, all_fields_cap_js_1.allFieldsCapNotice)(bounded, args.table),
|
|
138
|
+
record: filtered,
|
|
139
|
+
}
|
|
140
|
+
: filtered);
|
|
141
|
+
}
|
|
142
|
+
async function fetchOneRecord(args, selector, readableFields, client, config) {
|
|
143
|
+
const displayValue = args.display_value ?? config.displayValue;
|
|
144
|
+
if (selector.kind === "sys_id") {
|
|
145
|
+
const response = await client.get(`/api/now/table/${args.table}/${(0, servicenow_identifiers_js_1.serviceNowSysIdPathSegment)(selector.sysId)}`, {
|
|
146
|
+
...(0, utils_js_1.buildTableParams)({
|
|
147
|
+
fields: (0, field_policy_js_1.fieldSelectionToSysparmFields)(readableFields),
|
|
148
|
+
displayValue,
|
|
149
|
+
}),
|
|
150
|
+
...(args.force_recache ? { [metadata_cache_js_1.FORCE_RECACHE_PARAM]: "true" } : {}),
|
|
151
|
+
});
|
|
152
|
+
return resultProperty(response);
|
|
153
|
+
}
|
|
154
|
+
const requestFields = (0, field_policy_js_1.isAllFieldSelection)(readableFields)
|
|
155
|
+
? readableFields
|
|
156
|
+
: [...new Set([...readableFields, "sys_id"])];
|
|
157
|
+
const response = await client.get(`/api/now/table/${args.table}`, {
|
|
158
|
+
...(0, utils_js_1.buildTableParams)({
|
|
159
|
+
query: `${selector.field}=${(0, utils_js_1.escapeQueryValue)(selector.value)}` +
|
|
160
|
+
"^ORDERBYsys_id",
|
|
161
|
+
fields: (0, field_policy_js_1.fieldSelectionToSysparmFields)(requestFields),
|
|
162
|
+
limit: 2,
|
|
163
|
+
displayValue,
|
|
164
|
+
}),
|
|
165
|
+
...(args.force_recache ? { [metadata_cache_js_1.FORCE_RECACHE_PARAM]: "true" } : {}),
|
|
166
|
+
});
|
|
167
|
+
const results = resultProperty(response);
|
|
168
|
+
if (node_util_1.types.isProxy(results) || !Array.isArray(results)) {
|
|
169
|
+
throw (0, tool_error_js_1.createToolError)("upstream", "retry_if_safe_and_idempotent");
|
|
170
|
+
}
|
|
171
|
+
if (results.length === 0) {
|
|
172
|
+
throw (0, tool_error_js_1.createToolError)("not_found", "do_not_retry");
|
|
173
|
+
}
|
|
174
|
+
if (results.length > 1) {
|
|
175
|
+
throw (0, tool_error_js_1.createToolError)("conflict", "retry_after_correction");
|
|
176
|
+
}
|
|
177
|
+
const record = Object.getOwnPropertyDescriptor(results, "0");
|
|
178
|
+
if (!record || !("value" in record)) {
|
|
179
|
+
throw (0, tool_error_js_1.createToolError)("upstream", "retry_if_safe_and_idempotent");
|
|
180
|
+
}
|
|
181
|
+
return record.value;
|
|
182
|
+
}
|
|
183
|
+
/** Read the Table API wrapper without invoking accessors or Proxy traps. */
|
|
184
|
+
function resultProperty(response) {
|
|
185
|
+
if (typeof response !== "object" ||
|
|
186
|
+
response === null ||
|
|
187
|
+
node_util_1.types.isProxy(response) ||
|
|
188
|
+
Array.isArray(response)) {
|
|
189
|
+
throw (0, tool_error_js_1.createToolError)("upstream", "retry_if_safe_and_idempotent");
|
|
190
|
+
}
|
|
191
|
+
const prototype = Object.getPrototypeOf(response);
|
|
192
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
193
|
+
throw (0, tool_error_js_1.createToolError)("upstream", "retry_if_safe_and_idempotent");
|
|
194
|
+
}
|
|
195
|
+
const descriptor = Object.getOwnPropertyDescriptor(response, "result");
|
|
196
|
+
if (!descriptor || !("value" in descriptor)) {
|
|
197
|
+
throw (0, tool_error_js_1.createToolError)("upstream", "retry_if_safe_and_idempotent");
|
|
198
|
+
}
|
|
199
|
+
return descriptor.value;
|
|
200
|
+
}
|
|
201
|
+
/** Dedicated contract-bearing module for production registration. */
|
|
202
|
+
exports.getToolModule = (0, tool_module_js_1.defineServiceNowToolModule)({
|
|
203
|
+
runtime: "servicenow",
|
|
204
|
+
definition: exports.definition,
|
|
205
|
+
inputSchema: exports.moduleInputSchema,
|
|
206
|
+
outputSchema: result_envelope_js_2.productionToolOutputSchemas.sn_get,
|
|
207
|
+
requirements: {
|
|
208
|
+
permissions: ["read"],
|
|
209
|
+
tables: {
|
|
210
|
+
kind: "dynamic",
|
|
211
|
+
names: [],
|
|
212
|
+
description: "Caller-selected policy-approved table.",
|
|
213
|
+
},
|
|
214
|
+
apis: ["table"],
|
|
215
|
+
fieldPolicies: ["read"],
|
|
216
|
+
capabilities: ["record:get"],
|
|
217
|
+
},
|
|
218
|
+
resolveAccess: (args) => resolveGetAccess(args),
|
|
219
|
+
handler: async (args, services) => (0, result_envelope_js_2.envelopeCompatibilityResult)("sn_get", args, await executeGet(args, services.serviceNow, services.settings)),
|
|
220
|
+
});
|
|
221
|
+
//# sourceMappingURL=get-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-module.js","sourceRoot":"","sources":["../../src/tools/get-module.ts"],"names":[],"mappings":";AAAA,gDAAgD;;;AAmIhD,0BAOC;AAGD,4CA4BC;AAvKD,2DAA2E;AAC3E,6DAAyD;AACzD,yCAAmD;AAGnD,6BAAwB;AAIxB,4DAA2D;AAC3D,wDAS4B;AAC5B,gFAIwC;AACxC,4EAAiG;AACjG,wDAAwD;AACxD,oDAAmD;AACnD,0CAQqB;AACrB,6DAG8B;AAC9B,qDAK0B;AAEb,QAAA,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,6EAA6E;QAC7E,yEAAyE;QACzE,6EAA6E;QAC7E,2EAA2E;QAC3E,8EAA8E;IAChF,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,KAAK,EAAE,YAAY;QACnB,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,IAAI;KACpB,CAAC;CACsB,CAAC,CAAC;AAE5B,SAAS,qBAAqB;IAC5B,OAAO,OAAC,CAAC,MAAM,CAAC;QACZ,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;QACnE,MAAM,EAAE,iDAAqB;aAC1B,QAAQ,EAAE;aACV,QAAQ,CAAC,oEAAoE,CAAC;QACjF,UAAU,EAAE,oDAAsB;aAC/B,QAAQ,EA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1
|
-
|
|
2
|
-
|
|
3
|
-
import { ServiceNowConfig } from "../config.js";
|
|
4
|
-
export declare const definition: {
|
|
5
|
-
name: string;
|
|
6
|
-
description: string;
|
|
7
|
-
inputSchema: {
|
|
8
|
-
type: "object";
|
|
9
|
-
properties: {
|
|
10
|
-
table: {
|
|
11
|
-
type: string;
|
|
12
|
-
description: string;
|
|
13
|
-
};
|
|
14
|
-
sys_id: {
|
|
15
|
-
type: string;
|
|
16
|
-
description: string;
|
|
17
|
-
};
|
|
18
|
-
fields: {
|
|
19
|
-
type: string;
|
|
20
|
-
description: string;
|
|
21
|
-
};
|
|
22
|
-
display_value: {
|
|
23
|
-
type: string;
|
|
24
|
-
description: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
required: string[];
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export declare const schema: z.ZodObject<{
|
|
31
|
-
table: z.ZodString;
|
|
32
|
-
sys_id: z.ZodString;
|
|
33
|
-
fields: z.ZodOptional<z.ZodString>;
|
|
34
|
-
display_value: z.ZodOptional<z.ZodString>;
|
|
35
|
-
}, "strip", z.ZodTypeAny, {
|
|
36
|
-
table: string;
|
|
37
|
-
sys_id: string;
|
|
38
|
-
fields?: string | undefined;
|
|
39
|
-
display_value?: string | undefined;
|
|
40
|
-
}, {
|
|
41
|
-
table: string;
|
|
42
|
-
sys_id: string;
|
|
43
|
-
fields?: string | undefined;
|
|
44
|
-
display_value?: string | undefined;
|
|
45
|
-
}>;
|
|
46
|
-
export declare function handler(args: z.infer<typeof schema>, client: ServiceNowClient, config: ServiceNowConfig): Promise<{
|
|
47
|
-
content: Array<{
|
|
48
|
-
type: "text";
|
|
49
|
-
text: string;
|
|
50
|
-
}>;
|
|
51
|
-
}>;
|
|
1
|
+
/** Compatibility facade for the canonical sn_get module. */
|
|
2
|
+
export { definition, getToolModule, handler, moduleInputSchema, resolveGetAccess, schema, } from "./get-module.js";
|
|
52
3
|
//# sourceMappingURL=get.d.ts.map
|
package/dist/tools/get.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../src/tools/get.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../src/tools/get.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,OAAO,EACL,UAAU,EACV,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,GACP,MAAM,iBAAiB,CAAC"}
|
package/dist/tools/get.js
CHANGED
|
@@ -1,52 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/** Compatibility facade for the canonical sn_get module. */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.schema = exports.definition = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
type: "object",
|
|
12
|
-
properties: {
|
|
13
|
-
table: {
|
|
14
|
-
type: "string",
|
|
15
|
-
description: "ServiceNow table name (e.g. incident)",
|
|
16
|
-
},
|
|
17
|
-
sys_id: {
|
|
18
|
-
type: "string",
|
|
19
|
-
description: "The sys_id of the record to retrieve",
|
|
20
|
-
},
|
|
21
|
-
fields: {
|
|
22
|
-
type: "string",
|
|
23
|
-
description: "Comma-separated list of fields to return",
|
|
24
|
-
},
|
|
25
|
-
display_value: {
|
|
26
|
-
type: "string",
|
|
27
|
-
description: "Display values mode: true, false, or all",
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
required: ["table", "sys_id"],
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
exports.schema = zod_1.z.object({
|
|
34
|
-
table: zod_1.z.string(),
|
|
35
|
-
sys_id: zod_1.z.string(),
|
|
36
|
-
fields: zod_1.z.string().optional(),
|
|
37
|
-
display_value: zod_1.z.string().optional(),
|
|
38
|
-
});
|
|
39
|
-
async function handler(args, client, config) {
|
|
40
|
-
try {
|
|
41
|
-
const params = {};
|
|
42
|
-
if (args.fields)
|
|
43
|
-
params.sysparm_fields = args.fields;
|
|
44
|
-
params.sysparm_display_value = args.display_value ?? config.displayValue;
|
|
45
|
-
const resp = await client.get(`/api/now/table/${args.table}/${args.sys_id}`, params);
|
|
46
|
-
return (0, utils_js_1.ok)(resp.result);
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
return (0, utils_js_1.err)((0, utils_js_1.formatError)(error));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
4
|
+
exports.schema = exports.resolveGetAccess = exports.moduleInputSchema = exports.handler = exports.getToolModule = exports.definition = void 0;
|
|
5
|
+
var get_module_js_1 = require("./get-module.js");
|
|
6
|
+
Object.defineProperty(exports, "definition", { enumerable: true, get: function () { return get_module_js_1.definition; } });
|
|
7
|
+
Object.defineProperty(exports, "getToolModule", { enumerable: true, get: function () { return get_module_js_1.getToolModule; } });
|
|
8
|
+
Object.defineProperty(exports, "handler", { enumerable: true, get: function () { return get_module_js_1.handler; } });
|
|
9
|
+
Object.defineProperty(exports, "moduleInputSchema", { enumerable: true, get: function () { return get_module_js_1.moduleInputSchema; } });
|
|
10
|
+
Object.defineProperty(exports, "resolveGetAccess", { enumerable: true, get: function () { return get_module_js_1.resolveGetAccess; } });
|
|
11
|
+
Object.defineProperty(exports, "schema", { enumerable: true, get: function () { return get_module_js_1.schema; } });
|
|
52
12
|
//# sourceMappingURL=get.js.map
|
package/dist/tools/get.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/tools/get.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/tools/get.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;AAE5D,iDAOyB;AANvB,2GAAA,UAAU,OAAA;AACV,8GAAA,aAAa,OAAA;AACb,wGAAA,OAAO,OAAA;AACP,kHAAA,iBAAiB,OAAA;AACjB,iHAAA,gBAAgB,OAAA;AAChB,uGAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Guarded snapshot boundary for untrusted tool-handler output. */
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
export type GuardedHandlerResult = {
|
|
4
|
+
readonly kind: "error";
|
|
5
|
+
} | {
|
|
6
|
+
readonly kind: "success";
|
|
7
|
+
readonly result: CallToolResult;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Snapshot one result without invoking accessors, Proxy traps, iterators,
|
|
11
|
+
* coercion hooks, or `toJSON`. Only bounded JSON-compatible data survives.
|
|
12
|
+
*/
|
|
13
|
+
export declare function guardedHandlerResult(candidate: unknown): GuardedHandlerResult;
|
|
14
|
+
//# sourceMappingURL=handler-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler-result.d.ts","sourceRoot":"","sources":["../../src/tools/handler-result.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAUzE,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;CAAE,CAAC;AAUlE;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,OAAO,GAAG,oBAAoB,CAsD7E"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Guarded snapshot boundary for untrusted tool-handler output. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.guardedHandlerResult = guardedHandlerResult;
|
|
5
|
+
const node_util_1 = require("node:util");
|
|
6
|
+
const result_envelope_js_1 = require("./result-envelope.js");
|
|
7
|
+
const MAX_HANDLER_RESULT_DEPTH = 32;
|
|
8
|
+
const MAX_HANDLER_RESULT_NODES = 100_000;
|
|
9
|
+
const MAX_HANDLER_RESULT_OWN_KEYS = 200_000;
|
|
10
|
+
const MAX_HANDLER_RESULT_STRING_BYTES = result_envelope_js_1.ATTACHMENT_RESULT_BYTE_LIMIT + 64 * 1024;
|
|
11
|
+
/**
|
|
12
|
+
* Snapshot one result without invoking accessors, Proxy traps, iterators,
|
|
13
|
+
* coercion hooks, or `toJSON`. Only bounded JSON-compatible data survives.
|
|
14
|
+
*/
|
|
15
|
+
function guardedHandlerResult(candidate) {
|
|
16
|
+
const state = {
|
|
17
|
+
depth: 0,
|
|
18
|
+
nodes: 0,
|
|
19
|
+
ownKeys: 0,
|
|
20
|
+
stringBytes: 0,
|
|
21
|
+
active: new WeakSet(),
|
|
22
|
+
};
|
|
23
|
+
const snapshot = snapshotJson(candidate, state, "handler result");
|
|
24
|
+
if (!isPlainRecord(snapshot)) {
|
|
25
|
+
throw new TypeError("handler result must be a plain object");
|
|
26
|
+
}
|
|
27
|
+
const keys = Object.keys(snapshot);
|
|
28
|
+
if (keys.some((key) => key !== "content" &&
|
|
29
|
+
key !== "structuredContent" &&
|
|
30
|
+
key !== "isError")) {
|
|
31
|
+
throw new TypeError("handler result contains unsupported properties");
|
|
32
|
+
}
|
|
33
|
+
if (!Array.isArray(snapshot.content)) {
|
|
34
|
+
throw new TypeError("handler result content must be an array");
|
|
35
|
+
}
|
|
36
|
+
if (snapshot.content.length !== 1) {
|
|
37
|
+
throw new TypeError("handler result content count is invalid");
|
|
38
|
+
}
|
|
39
|
+
if (snapshot.isError !== undefined &&
|
|
40
|
+
typeof snapshot.isError !== "boolean") {
|
|
41
|
+
throw new TypeError("handler result isError must be boolean");
|
|
42
|
+
}
|
|
43
|
+
if (snapshot.isError === true)
|
|
44
|
+
return Object.freeze({ kind: "error" });
|
|
45
|
+
if (snapshot.isError === false) {
|
|
46
|
+
throw new TypeError("successful handler result must omit isError");
|
|
47
|
+
}
|
|
48
|
+
const content = snapshot.content[0];
|
|
49
|
+
if (!isPlainRecord(content) ||
|
|
50
|
+
Object.keys(content).length !== 2 ||
|
|
51
|
+
content.type !== "text" ||
|
|
52
|
+
typeof content.text !== "string") {
|
|
53
|
+
throw new TypeError("handler result content must be one exact text block");
|
|
54
|
+
}
|
|
55
|
+
return Object.freeze({
|
|
56
|
+
kind: "success",
|
|
57
|
+
result: snapshot,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function snapshotJson(candidate, state, label) {
|
|
61
|
+
if (candidate === null ||
|
|
62
|
+
typeof candidate === "boolean" ||
|
|
63
|
+
typeof candidate === "undefined") {
|
|
64
|
+
return candidate;
|
|
65
|
+
}
|
|
66
|
+
if (typeof candidate === "string") {
|
|
67
|
+
state.stringBytes += Buffer.byteLength(candidate, "utf8");
|
|
68
|
+
if (state.stringBytes > MAX_HANDLER_RESULT_STRING_BYTES) {
|
|
69
|
+
throw new RangeError("handler result string budget exceeded");
|
|
70
|
+
}
|
|
71
|
+
return candidate;
|
|
72
|
+
}
|
|
73
|
+
if (typeof candidate === "number") {
|
|
74
|
+
if (!Number.isFinite(candidate)) {
|
|
75
|
+
throw new TypeError(`${label} contains a non-finite number`);
|
|
76
|
+
}
|
|
77
|
+
return candidate;
|
|
78
|
+
}
|
|
79
|
+
if (typeof candidate !== "object" || node_util_1.types.isProxy(candidate)) {
|
|
80
|
+
throw new TypeError(`${label} contains unsupported data`);
|
|
81
|
+
}
|
|
82
|
+
if (state.active.has(candidate)) {
|
|
83
|
+
throw new TypeError("handler result must not contain cycles");
|
|
84
|
+
}
|
|
85
|
+
state.depth += 1;
|
|
86
|
+
state.nodes += 1;
|
|
87
|
+
if (state.depth > MAX_HANDLER_RESULT_DEPTH ||
|
|
88
|
+
state.nodes > MAX_HANDLER_RESULT_NODES) {
|
|
89
|
+
state.depth -= 1;
|
|
90
|
+
throw new RangeError("handler result traversal budget exceeded");
|
|
91
|
+
}
|
|
92
|
+
state.active.add(candidate);
|
|
93
|
+
try {
|
|
94
|
+
return Array.isArray(candidate)
|
|
95
|
+
? snapshotArray(candidate, state, label)
|
|
96
|
+
: snapshotRecord(candidate, state, label);
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
state.active.delete(candidate);
|
|
100
|
+
state.depth -= 1;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function snapshotArray(candidate, state, label) {
|
|
104
|
+
const descriptors = boundedDescriptors(candidate, state, label);
|
|
105
|
+
const lengthDescriptor = descriptors.length;
|
|
106
|
+
if (!lengthDescriptor ||
|
|
107
|
+
!("value" in lengthDescriptor) ||
|
|
108
|
+
!Number.isSafeInteger(lengthDescriptor.value) ||
|
|
109
|
+
lengthDescriptor.value < 0 ||
|
|
110
|
+
lengthDescriptor.value > MAX_HANDLER_RESULT_NODES) {
|
|
111
|
+
throw new TypeError(`${label} array length is invalid`);
|
|
112
|
+
}
|
|
113
|
+
const length = lengthDescriptor.value;
|
|
114
|
+
const output = [];
|
|
115
|
+
for (let index = 0; index < length; index += 1) {
|
|
116
|
+
const item = descriptors[String(index)];
|
|
117
|
+
if (!item || !("value" in item)) {
|
|
118
|
+
throw new TypeError(`${label} arrays must not be sparse or accessor-backed`);
|
|
119
|
+
}
|
|
120
|
+
const value = snapshotJson(item.value, state, `${label}[${index}]`);
|
|
121
|
+
if (value === undefined) {
|
|
122
|
+
throw new TypeError(`${label} arrays must not contain undefined`);
|
|
123
|
+
}
|
|
124
|
+
output.push(value);
|
|
125
|
+
}
|
|
126
|
+
for (const key of Reflect.ownKeys(descriptors)) {
|
|
127
|
+
if (key === "length")
|
|
128
|
+
continue;
|
|
129
|
+
if (typeof key !== "string" ||
|
|
130
|
+
!/^(?:0|[1-9][0-9]*)$/u.test(key) ||
|
|
131
|
+
Number(key) >= length) {
|
|
132
|
+
throw new TypeError(`${label} array contains unsupported properties`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return output;
|
|
136
|
+
}
|
|
137
|
+
function snapshotRecord(candidate, state, label) {
|
|
138
|
+
const prototype = Object.getPrototypeOf(candidate);
|
|
139
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
140
|
+
throw new TypeError(`${label} must contain only plain objects`);
|
|
141
|
+
}
|
|
142
|
+
const descriptors = boundedDescriptors(candidate, state, label);
|
|
143
|
+
const output = Object.create(null);
|
|
144
|
+
for (const key of Reflect.ownKeys(descriptors)) {
|
|
145
|
+
const property = descriptors[key];
|
|
146
|
+
if (typeof key !== "string" ||
|
|
147
|
+
!property.enumerable ||
|
|
148
|
+
!("value" in property)) {
|
|
149
|
+
throw new TypeError(`${label} must contain enumerable data properties`);
|
|
150
|
+
}
|
|
151
|
+
output[key] = snapshotJson(property.value, state, `${label}.${key}`);
|
|
152
|
+
}
|
|
153
|
+
return output;
|
|
154
|
+
}
|
|
155
|
+
function boundedDescriptors(candidate, state, label) {
|
|
156
|
+
const descriptors = Object.getOwnPropertyDescriptors(candidate);
|
|
157
|
+
const keys = Reflect.ownKeys(descriptors);
|
|
158
|
+
state.ownKeys += keys.length;
|
|
159
|
+
if (state.ownKeys > MAX_HANDLER_RESULT_OWN_KEYS) {
|
|
160
|
+
throw new RangeError("handler result property budget exceeded");
|
|
161
|
+
}
|
|
162
|
+
for (const key of keys) {
|
|
163
|
+
const property = descriptors[key];
|
|
164
|
+
if (!("value" in property)) {
|
|
165
|
+
throw new TypeError(`${label} must not contain accessors`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return descriptors;
|
|
169
|
+
}
|
|
170
|
+
function isPlainRecord(value) {
|
|
171
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
const prototype = Object.getPrototypeOf(value);
|
|
175
|
+
return prototype === Object.prototype || prototype === null;
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=handler-result.js.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@@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { ServiceNowOperations } from "../client.js";
|
|
3
|
+
import type { ExecutionContext } from "../execution-context.js";
|
|
4
|
+
import type { ServiceNowToolSettings } from "./tool-module.js";
|
|
4
5
|
export declare const definition: {
|
|
5
6
|
name: string;
|
|
6
7
|
description: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
description: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
required: never[];
|
|
8
|
+
annotations: {
|
|
9
|
+
title: string;
|
|
10
|
+
readOnlyHint: boolean;
|
|
11
|
+
destructiveHint: boolean;
|
|
12
|
+
idempotentHint: boolean;
|
|
13
|
+
openWorldHint: boolean;
|
|
17
14
|
};
|
|
18
15
|
};
|
|
19
16
|
export declare const schema: z.ZodObject<{
|
|
20
17
|
check: z.ZodDefault<z.ZodOptional<z.ZodEnum<["all", "version", "nodes", "jobs", "semaphores", "stats"]>>>;
|
|
21
18
|
}, "strip", z.ZodTypeAny, {
|
|
22
|
-
check: "
|
|
19
|
+
check: "version" | "all" | "stats" | "nodes" | "jobs" | "semaphores";
|
|
23
20
|
}, {
|
|
24
|
-
check?: "
|
|
21
|
+
check?: "version" | "all" | "stats" | "nodes" | "jobs" | "semaphores" | undefined;
|
|
25
22
|
}>;
|
|
26
|
-
export declare function handler(args: z.infer<typeof schema>, client:
|
|
23
|
+
export declare function handler(args: z.infer<typeof schema>, client: ServiceNowOperations, config: ServiceNowToolSettings, _context: ExecutionContext): Promise<{
|
|
27
24
|
content: Array<{
|
|
28
25
|
type: "text";
|
|
29
26
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/tools/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/tools/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI/D,eAAO,MAAM,UAAU;;;;;;;;;;CAWtB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;EAMjB,CAAC;AAoCH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,EAC5B,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,sBAAsB,EAC9B,QAAQ,EAAE,gBAAgB;;;;;GAgN3B"}
|