@onlyflows/servicenow-mcp 1.0.0 → 2.1.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 +214 -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 +441 -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 +711 -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/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 +98 -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/index.d.ts +47 -36
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +814 -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/record-write-shared.d.ts +7 -0
- package/dist/tools/record-write-shared.d.ts.map +1 -0
- package/dist/tools/record-write-shared.js +65 -0
- package/dist/tools/record-write-shared.js.map +1 -0
- 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 +770 -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 +111 -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/dist/write-value-policy.d.ts +56 -0
- package/dist/write-value-policy.d.ts.map +1 -0
- package/dist/write-value-policy.js +310 -0
- package/dist/write-value-policy.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,119 @@
|
|
|
1
|
+
/** Canonical contract-bearing sn_query module. */
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { ServiceNowOperations } from "../client.js";
|
|
4
|
+
import type { ExecutionContext } from "../execution-context.js";
|
|
5
|
+
import type { ServiceNowToolSettings } from "./tool-module.js";
|
|
6
|
+
export declare const definition: Readonly<{
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
annotations: Readonly<{
|
|
10
|
+
title: "Query records";
|
|
11
|
+
readOnlyHint: true;
|
|
12
|
+
destructiveHint: false;
|
|
13
|
+
idempotentHint: true;
|
|
14
|
+
openWorldHint: true;
|
|
15
|
+
}>;
|
|
16
|
+
}>;
|
|
17
|
+
/** Legacy source-level schema; MCP registration uses `moduleInputSchema`. */
|
|
18
|
+
export declare const schema: z.ZodObject<{
|
|
19
|
+
table: z.ZodString;
|
|
20
|
+
query: z.ZodOptional<z.ZodString>;
|
|
21
|
+
structured_query: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
22
|
+
filter: z.ZodOptional<z.ZodType<import("../structured-query.js").StructuredQueryFilter, z.ZodTypeDef, import("../structured-query.js").StructuredQueryFilter>>;
|
|
23
|
+
order_by: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
24
|
+
field: z.ZodString;
|
|
25
|
+
direction: z.ZodDefault<z.ZodOptional<z.ZodEnum<["asc", "desc"]>>>;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
field: string;
|
|
28
|
+
direction: "asc" | "desc";
|
|
29
|
+
}, {
|
|
30
|
+
field: string;
|
|
31
|
+
direction?: "asc" | "desc" | undefined;
|
|
32
|
+
}>, "many">>;
|
|
33
|
+
}, "strict", z.ZodTypeAny, {
|
|
34
|
+
filter?: import("../structured-query.js").StructuredQueryFilter | undefined;
|
|
35
|
+
order_by?: {
|
|
36
|
+
field: string;
|
|
37
|
+
direction: "asc" | "desc";
|
|
38
|
+
}[] | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
filter?: import("../structured-query.js").StructuredQueryFilter | undefined;
|
|
41
|
+
order_by?: {
|
|
42
|
+
field: string;
|
|
43
|
+
direction?: "asc" | "desc" | undefined;
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
}>, {
|
|
46
|
+
filter?: import("../structured-query.js").StructuredQueryFilter | undefined;
|
|
47
|
+
order_by?: {
|
|
48
|
+
field: string;
|
|
49
|
+
direction: "asc" | "desc";
|
|
50
|
+
}[] | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
filter?: import("../structured-query.js").StructuredQueryFilter | undefined;
|
|
53
|
+
order_by?: {
|
|
54
|
+
field: string;
|
|
55
|
+
direction?: "asc" | "desc" | undefined;
|
|
56
|
+
}[] | undefined;
|
|
57
|
+
}>>;
|
|
58
|
+
fields: z.ZodOptional<z.ZodString>;
|
|
59
|
+
response_format: z.ZodDefault<z.ZodOptional<z.ZodEnum<["concise", "detailed"]>>>;
|
|
60
|
+
max_response_bytes: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
61
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
62
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
orderby: z.ZodOptional<z.ZodString>;
|
|
64
|
+
display_value: z.ZodOptional<z.ZodEnum<["true", "false", "all"]>>;
|
|
65
|
+
force_recache: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
66
|
+
}, "strict", z.ZodTypeAny, {
|
|
67
|
+
limit: number;
|
|
68
|
+
table: string;
|
|
69
|
+
response_format: "concise" | "detailed";
|
|
70
|
+
max_response_bytes: number;
|
|
71
|
+
force_recache: boolean;
|
|
72
|
+
fields?: string | undefined;
|
|
73
|
+
display_value?: "all" | "true" | "false" | undefined;
|
|
74
|
+
query?: string | undefined;
|
|
75
|
+
structured_query?: {
|
|
76
|
+
filter?: import("../structured-query.js").StructuredQueryFilter | undefined;
|
|
77
|
+
order_by?: {
|
|
78
|
+
field: string;
|
|
79
|
+
direction: "asc" | "desc";
|
|
80
|
+
}[] | undefined;
|
|
81
|
+
} | undefined;
|
|
82
|
+
orderby?: string | undefined;
|
|
83
|
+
offset?: number | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
table: string;
|
|
86
|
+
limit?: number | undefined;
|
|
87
|
+
fields?: string | undefined;
|
|
88
|
+
response_format?: "concise" | "detailed" | undefined;
|
|
89
|
+
display_value?: "all" | "true" | "false" | undefined;
|
|
90
|
+
query?: string | undefined;
|
|
91
|
+
structured_query?: {
|
|
92
|
+
filter?: import("../structured-query.js").StructuredQueryFilter | undefined;
|
|
93
|
+
order_by?: {
|
|
94
|
+
field: string;
|
|
95
|
+
direction?: "asc" | "desc" | undefined;
|
|
96
|
+
}[] | undefined;
|
|
97
|
+
} | undefined;
|
|
98
|
+
orderby?: string | undefined;
|
|
99
|
+
offset?: number | undefined;
|
|
100
|
+
max_response_bytes?: number | undefined;
|
|
101
|
+
force_recache?: boolean | undefined;
|
|
102
|
+
}>;
|
|
103
|
+
/** Exact public MCP input, including the mandatory shared profile selector. */
|
|
104
|
+
export declare const moduleInputSchema: z.ZodObject<{} & {
|
|
105
|
+
[x: string]: z.ZodTypeAny;
|
|
106
|
+
}, "strict", z.ZodTypeAny, {
|
|
107
|
+
[x: string]: any;
|
|
108
|
+
}, {
|
|
109
|
+
[x: string]: any;
|
|
110
|
+
}>;
|
|
111
|
+
export declare function handler(args: z.infer<typeof schema>, client: ServiceNowOperations, config: ServiceNowToolSettings, _context: ExecutionContext): Promise<{
|
|
112
|
+
content: Array<{
|
|
113
|
+
type: "text";
|
|
114
|
+
text: string;
|
|
115
|
+
}>;
|
|
116
|
+
}>;
|
|
117
|
+
/** Dedicated contract-bearing module for production registration. */
|
|
118
|
+
export declare const queryToolModule: import("./tool-module.js").ServiceNowToolModuleContract;
|
|
119
|
+
//# sourceMappingURL=query-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-module.d.ts","sourceRoot":"","sources":["../../src/tools/query-module.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAGlD,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;AAEhE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAqC/D,eAAO,MAAM,UAAU;;;;;;;;;;EAiBI,CAAC;AAyF5B,6EAA6E;AAC7E,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA0B,CAAC;AAE9C,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB;;;;;;EAA+C,CAAC;AA2G9E,wBAAsB,OAAO,CAC3B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,EAC5B,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,sBAAsB,EAC9B,QAAQ,EAAE,gBAAgB;;;;;GAG3B;AAmID,qEAAqE;AACrE,eAAO,MAAM,eAAe,yDA6B1B,CAAC"}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Canonical contract-bearing sn_query module. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.queryToolModule = exports.moduleInputSchema = exports.schema = exports.definition = void 0;
|
|
5
|
+
exports.handler = handler;
|
|
6
|
+
const all_fields_cap_js_1 = require("./all-fields-cap.js");
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
const metadata_cache_js_1 = require("../metadata-cache.js");
|
|
9
|
+
const encoded_query_policy_js_1 = require("../encoded-query-policy.js");
|
|
10
|
+
const field_policy_js_1 = require("../field-policy.js");
|
|
11
|
+
const structured_query_js_1 = require("../structured-query.js");
|
|
12
|
+
const tool_table_access_js_1 = require("../tool-table-access.js");
|
|
13
|
+
const utils_js_1 = require("../utils.js");
|
|
14
|
+
const result_envelope_js_1 = require("./result-envelope.js");
|
|
15
|
+
const tool_module_js_1 = require("./tool-module.js");
|
|
16
|
+
exports.definition = Object.freeze({
|
|
17
|
+
name: "sn_query",
|
|
18
|
+
description: "Query a policy-approved ServiceNow table. Returns records with pagination metadata " +
|
|
19
|
+
"(record_count, total, has_more, next_offset). Field verbosity: an " +
|
|
20
|
+
"explicit fields list always wins; otherwise response_format=\"concise\" " +
|
|
21
|
+
"(default) uses the table's safe default field set and " +
|
|
22
|
+
"response_format=\"detailed\" returns all policy-approved readable fields " +
|
|
23
|
+
"(same as fields=\"all\"). Responses larger than max_response_bytes are truncated " +
|
|
24
|
+
"by dropping whole records from the tail, with a hint for fetching the rest.",
|
|
25
|
+
annotations: Object.freeze({
|
|
26
|
+
title: "Query records",
|
|
27
|
+
readOnlyHint: true,
|
|
28
|
+
destructiveHint: false,
|
|
29
|
+
idempotentHint: true,
|
|
30
|
+
openWorldHint: true,
|
|
31
|
+
}),
|
|
32
|
+
});
|
|
33
|
+
function compatibleInputSchema() {
|
|
34
|
+
return zod_1.z.object({
|
|
35
|
+
table: zod_1.z
|
|
36
|
+
.string()
|
|
37
|
+
.describe("ServiceNow table name (e.g. incident, change_request, sys_user)"),
|
|
38
|
+
query: zod_1.z
|
|
39
|
+
.string()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("Legacy raw ServiceNow encoded query. Disabled by default; accepted " +
|
|
42
|
+
"only for an explicit bounded sn_query/table policy rule. Prefer " +
|
|
43
|
+
"structured_query."),
|
|
44
|
+
structured_query: structured_query_js_1.structuredQuerySchema
|
|
45
|
+
.optional()
|
|
46
|
+
.describe("Policy-authorized structured filters and ordering. Use instead of " +
|
|
47
|
+
"raw query/orderby; supports bounded equality, set, range, text, " +
|
|
48
|
+
"null, AND/OR group, and order_by cases."),
|
|
49
|
+
fields: zod_1.z
|
|
50
|
+
.string()
|
|
51
|
+
.optional()
|
|
52
|
+
.describe("Comma-separated approved fields to return. Always takes precedence " +
|
|
53
|
+
'over response_format. Omit for the table safe defaults; pass "all" ' +
|
|
54
|
+
"for every policy-approved readable field."),
|
|
55
|
+
response_format: zod_1.z
|
|
56
|
+
.enum(["concise", "detailed"])
|
|
57
|
+
.optional()
|
|
58
|
+
.default("concise")
|
|
59
|
+
.describe('Verbosity when fields is omitted (default "concise"). "concise" ' +
|
|
60
|
+
"returns the safe default set; \"detailed\" returns every " +
|
|
61
|
+
"policy-approved readable field. Ignored when fields is provided."),
|
|
62
|
+
max_response_bytes: zod_1.z
|
|
63
|
+
.number()
|
|
64
|
+
.int()
|
|
65
|
+
.min(utils_js_1.MAX_RESPONSE_BYTES_MIN)
|
|
66
|
+
.max(utils_js_1.MAX_RESPONSE_BYTES_MAX)
|
|
67
|
+
.optional()
|
|
68
|
+
.default(utils_js_1.MAX_RESPONSE_BYTES_DEFAULT)
|
|
69
|
+
.describe("Byte budget for the serialized response (default 100000, min 1000, " +
|
|
70
|
+
"max 1000000). When exceeded, whole records are dropped from the " +
|
|
71
|
+
"tail (the JSON is never mangled) and the response gains truncated: " +
|
|
72
|
+
"true plus a hint stating how many records were dropped, the total " +
|
|
73
|
+
"available, and the exact offset/limit/fields/response_format " +
|
|
74
|
+
"follow-up arguments to fetch the rest."),
|
|
75
|
+
limit: zod_1.z
|
|
76
|
+
.number()
|
|
77
|
+
.int()
|
|
78
|
+
.min(1)
|
|
79
|
+
.max(1000)
|
|
80
|
+
.optional()
|
|
81
|
+
.default(20)
|
|
82
|
+
.describe("Maximum records to return (default 20, max 1000)"),
|
|
83
|
+
offset: zod_1.z
|
|
84
|
+
.number()
|
|
85
|
+
.int()
|
|
86
|
+
.min(0)
|
|
87
|
+
.max(10_000)
|
|
88
|
+
.optional()
|
|
89
|
+
.describe("Pagination offset (max 10000)"),
|
|
90
|
+
orderby: zod_1.z
|
|
91
|
+
.string()
|
|
92
|
+
.optional()
|
|
93
|
+
.describe("Sort field. Prefix with - for descending (e.g. -sys_created_on)"),
|
|
94
|
+
display_value: zod_1.z
|
|
95
|
+
.enum(["true", "false", "all"])
|
|
96
|
+
.optional()
|
|
97
|
+
.describe("Display values mode: true, false, or all (default: true)"),
|
|
98
|
+
force_recache: zod_1.z
|
|
99
|
+
.boolean()
|
|
100
|
+
.optional()
|
|
101
|
+
.default(false)
|
|
102
|
+
.describe("For metadata tables, bypass the per-instance metadata cache and refresh from ServiceNow."),
|
|
103
|
+
}).strict(encoded_query_policy_js_1.ENCODED_QUERY_MIGRATION_MESSAGE);
|
|
104
|
+
}
|
|
105
|
+
/** Legacy source-level schema; MCP registration uses `moduleInputSchema`. */
|
|
106
|
+
exports.schema = compatibleInputSchema();
|
|
107
|
+
/** Exact public MCP input, including the mandatory shared profile selector. */
|
|
108
|
+
exports.moduleInputSchema = (0, tool_module_js_1.withRequiredProfile)(compatibleInputSchema());
|
|
109
|
+
function stableOrderQuery(conditionQuery, orderby, structuredOrder) {
|
|
110
|
+
const tokens = conditionQuery ? [conditionQuery] : [];
|
|
111
|
+
if (!structuredOrder && orderby) {
|
|
112
|
+
const descending = orderby.startsWith("-");
|
|
113
|
+
const field = descending ? orderby.slice(1) : orderby;
|
|
114
|
+
tokens.push(`${descending ? "ORDERBYDESC" : "ORDERBY"}${field}`);
|
|
115
|
+
}
|
|
116
|
+
const alreadyStable = structuredOrder
|
|
117
|
+
? structuredOrder.some(({ field }) => field === "sys_id")
|
|
118
|
+
: orderby === "sys_id" || orderby === "-sys_id";
|
|
119
|
+
if (!alreadyStable)
|
|
120
|
+
tokens.push("ORDERBYsys_id");
|
|
121
|
+
return tokens.join("^");
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Enforce the max_response_bytes budget by dropping whole records from the
|
|
125
|
+
* tail of `results`. Records are never split or mangled -- the reply stays
|
|
126
|
+
* valid JSON. Untouched payloads are returned as-is (byte-identical to the
|
|
127
|
+
* unguarded response). On truncation the payload gains `truncated: true`
|
|
128
|
+
* and a hint with the exact follow-up arguments (offset/limit/fields/
|
|
129
|
+
* response_format) needed to fetch the dropped records.
|
|
130
|
+
*/
|
|
131
|
+
function enforceByteBudget(payload, results, args, total) {
|
|
132
|
+
const maxBytes = args.max_response_bytes;
|
|
133
|
+
if (results.length === 0 || (0, utils_js_1.serializedBytes)(payload) <= maxBytes)
|
|
134
|
+
return payload;
|
|
135
|
+
const fetched = results.length;
|
|
136
|
+
const offset = args.offset ?? 0;
|
|
137
|
+
const upstreamHasMore = payload.has_more === true;
|
|
138
|
+
const declaredNextOffset = payload.next_offset;
|
|
139
|
+
const upstreamNextOffset = typeof declaredNextOffset === "number" &&
|
|
140
|
+
Number.isSafeInteger(declaredNextOffset) &&
|
|
141
|
+
declaredNextOffset > offset
|
|
142
|
+
? declaredNextOffset
|
|
143
|
+
: offset + args.limit;
|
|
144
|
+
const shrinkAdvice = args.fields === undefined && args.response_format === "detailed"
|
|
145
|
+
? 'response_format="concise"'
|
|
146
|
+
: 'fields="sys_id,number"';
|
|
147
|
+
const build = (keep) => {
|
|
148
|
+
const dropped = fetched - keep;
|
|
149
|
+
const out = { record_count: keep };
|
|
150
|
+
if (total !== undefined)
|
|
151
|
+
out.total = total;
|
|
152
|
+
// Keep the authoritative post-window continuation even when this local
|
|
153
|
+
// byte budget cannot retain a row. The shared envelope separately marks
|
|
154
|
+
// same-offset recovery for rows dropped from the consumed window.
|
|
155
|
+
out.has_more = upstreamHasMore;
|
|
156
|
+
if (out.has_more)
|
|
157
|
+
out.next_offset = upstreamNextOffset;
|
|
158
|
+
out.truncated = true;
|
|
159
|
+
out.dropped_records = dropped;
|
|
160
|
+
// Keep the recovery hint compact enough that a zero-record production
|
|
161
|
+
// envelope can still fit the minimum byte budget after shared metadata is
|
|
162
|
+
// added. The structured pagination object carries the same retry/resume
|
|
163
|
+
// distinction for machine clients.
|
|
164
|
+
out.hint =
|
|
165
|
+
`Dropped ${dropped}/${fetched}` +
|
|
166
|
+
(total !== undefined ? ` (${total} total)` : "") +
|
|
167
|
+
(keep === 0 ? "; row too large" : "") +
|
|
168
|
+
`; recover offset=${offset} with ${shrinkAdvice}/max_response_bytes` +
|
|
169
|
+
(keep === 0 ? "/sn_get" : "") +
|
|
170
|
+
(upstreamHasMore
|
|
171
|
+
? `; resume offset=${upstreamNextOffset} limit=${args.limit}.`
|
|
172
|
+
: "; no post-window continuation.");
|
|
173
|
+
out.results = results.slice(0, keep);
|
|
174
|
+
return out;
|
|
175
|
+
};
|
|
176
|
+
// Estimate the largest prefix that fits via per-record sizes, then walk
|
|
177
|
+
// down until the exact serialization is within budget (the hint's digits
|
|
178
|
+
// shift the envelope size slightly as `keep` changes).
|
|
179
|
+
const envelope = (0, utils_js_1.serializedBytes)(build(0));
|
|
180
|
+
let keep = 0;
|
|
181
|
+
let used = envelope;
|
|
182
|
+
for (let i = 0; i < fetched; i++) {
|
|
183
|
+
used += (0, utils_js_1.serializedBytes)(results[i]) + 1; // +1 for the array comma
|
|
184
|
+
if (used > maxBytes)
|
|
185
|
+
break;
|
|
186
|
+
keep = i + 1;
|
|
187
|
+
}
|
|
188
|
+
keep = Math.min(keep, fetched - 1); // over budget => at least one record goes
|
|
189
|
+
let out = build(keep);
|
|
190
|
+
while (keep > 0 && (0, utils_js_1.serializedBytes)(out) > maxBytes) {
|
|
191
|
+
keep -= 1;
|
|
192
|
+
out = build(keep);
|
|
193
|
+
}
|
|
194
|
+
return out;
|
|
195
|
+
}
|
|
196
|
+
/** Accept only one canonical non-negative safe-integer count header. */
|
|
197
|
+
function parseTotalCountHeader(value) {
|
|
198
|
+
if (value === null || !/^(?:0|[1-9]\d*)$/u.test(value))
|
|
199
|
+
return undefined;
|
|
200
|
+
const parsed = Number(value);
|
|
201
|
+
return Number.isSafeInteger(parsed) ? parsed : undefined;
|
|
202
|
+
}
|
|
203
|
+
async function handler(args, client, config, _context) {
|
|
204
|
+
return executeQuery(args, client, config, _context);
|
|
205
|
+
}
|
|
206
|
+
async function executeQuery(args, client, config, context) {
|
|
207
|
+
try {
|
|
208
|
+
const readableFields = (0, field_policy_js_1.preparedReadableFields)(args, args.table) ??
|
|
209
|
+
(0, field_policy_js_1.resolveReadableFields)(args.table, {
|
|
210
|
+
fields: args.fields,
|
|
211
|
+
responseFormat: args.response_format,
|
|
212
|
+
});
|
|
213
|
+
if (args.structured_query !== undefined &&
|
|
214
|
+
(args.query !== undefined || args.orderby !== undefined)) {
|
|
215
|
+
throw new structured_query_js_1.StructuredQueryError("invalid_shape");
|
|
216
|
+
}
|
|
217
|
+
// A wildcard selection would drop sysparm_fields and pull every column,
|
|
218
|
+
// which errors on a wide table rather than returning a trimmed record.
|
|
219
|
+
const bounded = (0, field_policy_js_1.isAllFieldSelection)(readableFields)
|
|
220
|
+
? await (0, all_fields_cap_js_1.boundedAllFields)(client, args.table, (0, field_policy_js_1.resolveReadableFields)(args.table), args.force_recache === true)
|
|
221
|
+
: undefined;
|
|
222
|
+
const effectiveFields = bounded ? bounded.fields : readableFields;
|
|
223
|
+
const structuredPlan = args.structured_query === undefined
|
|
224
|
+
? undefined
|
|
225
|
+
: (0, structured_query_js_1.compileStructuredQuery)(args.structured_query, (0, field_policy_js_1.resolveReadableFields)(args.table, { fields: "all" }));
|
|
226
|
+
const rawPlan = args.query === undefined
|
|
227
|
+
? undefined
|
|
228
|
+
: (0, encoded_query_policy_js_1.authorizeRawEncodedRead)(context?.effectivePolicy.encodedQueryAccess, {
|
|
229
|
+
tool: "sn_query",
|
|
230
|
+
table: args.table,
|
|
231
|
+
query: args.query,
|
|
232
|
+
limit: args.limit,
|
|
233
|
+
offset: args.offset ?? 0,
|
|
234
|
+
maxResponseBytes: args.max_response_bytes,
|
|
235
|
+
orderBy: args.orderby,
|
|
236
|
+
outputFields: readableFields,
|
|
237
|
+
});
|
|
238
|
+
if (args.orderby) {
|
|
239
|
+
const orderField = args.orderby.startsWith("-")
|
|
240
|
+
? args.orderby.slice(1)
|
|
241
|
+
: args.orderby;
|
|
242
|
+
(0, field_policy_js_1.resolveReadableFields)(args.table, { fields: orderField });
|
|
243
|
+
}
|
|
244
|
+
const queryWithStableOrder = stableOrderQuery(structuredPlan?.encodedQuery ?? rawPlan?.query, structuredPlan ? undefined : args.orderby, structuredPlan?.structuredQuery.order_by);
|
|
245
|
+
const params = (0, utils_js_1.buildTableParams)({
|
|
246
|
+
query: queryWithStableOrder,
|
|
247
|
+
fields: rawPlan?.outputFields
|
|
248
|
+
? rawPlan.outputFields.join(",")
|
|
249
|
+
: (0, field_policy_js_1.fieldSelectionToSysparmFields)(effectiveFields),
|
|
250
|
+
// Fetch one bounded sentinel row so a missing total-count header never
|
|
251
|
+
// turns an exactly full final page into speculative continuation.
|
|
252
|
+
limit: args.limit + 1,
|
|
253
|
+
offset: args.offset,
|
|
254
|
+
orderby: undefined,
|
|
255
|
+
displayValue: args.display_value ?? config.displayValue,
|
|
256
|
+
noCount: true,
|
|
257
|
+
});
|
|
258
|
+
if (args.force_recache) {
|
|
259
|
+
params[metadata_cache_js_1.FORCE_RECACHE_PARAM] = "true";
|
|
260
|
+
}
|
|
261
|
+
const resp = await client.getWithMeta(`/api/now/table/${args.table}`, params);
|
|
262
|
+
const rawResults = Array.isArray(resp.data?.result) ? resp.data.result : [];
|
|
263
|
+
const hasSentinel = rawResults.length > args.limit;
|
|
264
|
+
const consumedRawResults = rawResults.slice(0, args.limit);
|
|
265
|
+
const policyFiltered = (0, field_policy_js_1.filterReadableRecord)(consumedRawResults, rawPlan?.outputFields ?? effectiveFields);
|
|
266
|
+
const results = (0, utils_js_1.stripEmpty)(Array.isArray(policyFiltered) ? policyFiltered : []);
|
|
267
|
+
const offset = args.offset ?? 0;
|
|
268
|
+
const recordCount = results.length;
|
|
269
|
+
const total = parseTotalCountHeader(resp.headers.get("x-total-count"));
|
|
270
|
+
// A valid total header is authoritative. Otherwise the bounded sentinel,
|
|
271
|
+
// not the post-policy returned count, decides continuation: policy/ACL
|
|
272
|
+
// filtering may remove every deliverable row from the consumed window.
|
|
273
|
+
const hasMore = total !== undefined
|
|
274
|
+
? offset + args.limit < total
|
|
275
|
+
: hasSentinel;
|
|
276
|
+
const payload = { record_count: recordCount };
|
|
277
|
+
if (total !== undefined)
|
|
278
|
+
payload.total = total;
|
|
279
|
+
payload.has_more = hasMore;
|
|
280
|
+
if (hasMore) {
|
|
281
|
+
// Advance by the requested limit, not the returned count: ACLs/domain
|
|
282
|
+
// separation can strip rows from a page AFTER the limit/offset window
|
|
283
|
+
// is applied, so record_count < limit does not mean the window was
|
|
284
|
+
// short -- offset + record_count would re-read (or infinitely repeat)
|
|
285
|
+
// the same window.
|
|
286
|
+
const nextOffset = offset + args.limit;
|
|
287
|
+
payload.next_offset = nextOffset;
|
|
288
|
+
payload.hint = `More records available. Call sn_query again with offset=${nextOffset}.`;
|
|
289
|
+
}
|
|
290
|
+
if (bounded?.capped === true) {
|
|
291
|
+
// The caller asked for every field and did not get every field. Without
|
|
292
|
+
// this they would conclude the missing columns do not exist.
|
|
293
|
+
const notice = (0, all_fields_cap_js_1.allFieldsCapNotice)(bounded, args.table);
|
|
294
|
+
payload.hint =
|
|
295
|
+
typeof payload.hint === "string" ? `${payload.hint} ${notice}` : notice;
|
|
296
|
+
}
|
|
297
|
+
payload.results = results;
|
|
298
|
+
return (0, utils_js_1.ok)(enforceByteBudget(payload, results, args, total));
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
throw error;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/** Dedicated contract-bearing module for production registration. */
|
|
305
|
+
exports.queryToolModule = (0, tool_module_js_1.defineServiceNowToolModule)({
|
|
306
|
+
runtime: "servicenow",
|
|
307
|
+
definition: exports.definition,
|
|
308
|
+
inputSchema: exports.moduleInputSchema,
|
|
309
|
+
outputSchema: result_envelope_js_1.productionToolOutputSchemas.sn_query,
|
|
310
|
+
requirements: {
|
|
311
|
+
permissions: ["read"],
|
|
312
|
+
tables: {
|
|
313
|
+
kind: "dynamic",
|
|
314
|
+
names: [],
|
|
315
|
+
description: "Caller-selected policy-approved table.",
|
|
316
|
+
},
|
|
317
|
+
apis: ["table"],
|
|
318
|
+
fieldPolicies: ["read"],
|
|
319
|
+
capabilities: ["records:query"],
|
|
320
|
+
},
|
|
321
|
+
resolveAccess: (args, policy) => (0, tool_table_access_js_1.resolveToolTableAccess)("sn_query", args, policy.encodedQueryAccess),
|
|
322
|
+
handler: async (args, services) => (0, result_envelope_js_1.envelopeCompatibilityResult)("sn_query", args, await executeQuery(args, services.serviceNow, services.settings, services.context)),
|
|
323
|
+
});
|
|
324
|
+
//# sourceMappingURL=query-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-module.js","sourceRoot":"","sources":["../../src/tools/query-module.ts"],"names":[],"mappings":";AAAA,kDAAkD;;;AAqQlD,0BAOC;AA1QD,2DAA2E;AAC3E,6BAAwB;AAGxB,4DAA2D;AAE3D,wEAGoC;AACpC,wDAM4B;AAC5B,gEAIgC;AAChC,kEAAiE;AACjE,0CAQqB;AACrB,6DAG8B;AAC9B,qDAI0B;AAEb,QAAA,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,qFAAqF;QACrF,oEAAoE;QACpE,0EAA0E;QAC1E,wDAAwD;QACxD,2EAA2E;QAC3E,mFAAmF;QACnF,6EAA6E;IAC/E,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,KAAK,EAAE,eAAe;QACtB,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,O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B,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,EAAE;YACT,WAAW,EAAE,wCAAwC;SACtD;QACD,IAAI,EAAE,CAAC,OAAO,CAAC;QACf,aAAa,EAAE,CAAC,MAAM,CAAC;QACvB,YAAY,EAAE,CAAC,eAAe,CAAC;KAChC;IACD,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAC9B,IAAA,6CAAsB,EAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,kBAAkB,CAAC;IACrE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAChC,IAAA,gDAA2B,EACzB,UAAU,EACV,IAAI,EACJ,MAAM,YAAY,CAChB,IAAyC,EACzC,QAAQ,CAAC,UAAU,EACnB,QAAQ,CAAC,QAAQ,EACjB,QAAQ,CAAC,OAAO,CACjB,CACF;CACJ,CAAC,CAAC"}
|
package/dist/tools/query.d.ts
CHANGED
|
@@ -1,73 +1,3 @@
|
|
|
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
|
-
query: {
|
|
15
|
-
type: string;
|
|
16
|
-
description: string;
|
|
17
|
-
};
|
|
18
|
-
fields: {
|
|
19
|
-
type: string;
|
|
20
|
-
description: string;
|
|
21
|
-
};
|
|
22
|
-
limit: {
|
|
23
|
-
type: string;
|
|
24
|
-
description: string;
|
|
25
|
-
};
|
|
26
|
-
offset: {
|
|
27
|
-
type: string;
|
|
28
|
-
description: string;
|
|
29
|
-
};
|
|
30
|
-
orderby: {
|
|
31
|
-
type: string;
|
|
32
|
-
description: string;
|
|
33
|
-
};
|
|
34
|
-
display_value: {
|
|
35
|
-
type: string;
|
|
36
|
-
description: string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
required: string[];
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export declare const schema: z.ZodObject<{
|
|
43
|
-
table: z.ZodString;
|
|
44
|
-
query: z.ZodOptional<z.ZodString>;
|
|
45
|
-
fields: z.ZodOptional<z.ZodString>;
|
|
46
|
-
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
47
|
-
offset: z.ZodOptional<z.ZodNumber>;
|
|
48
|
-
orderby: z.ZodOptional<z.ZodString>;
|
|
49
|
-
display_value: z.ZodOptional<z.ZodString>;
|
|
50
|
-
}, "strip", z.ZodTypeAny, {
|
|
51
|
-
table: string;
|
|
52
|
-
limit: number;
|
|
53
|
-
query?: string | undefined;
|
|
54
|
-
fields?: string | undefined;
|
|
55
|
-
offset?: number | undefined;
|
|
56
|
-
orderby?: string | undefined;
|
|
57
|
-
display_value?: string | undefined;
|
|
58
|
-
}, {
|
|
59
|
-
table: string;
|
|
60
|
-
query?: string | undefined;
|
|
61
|
-
fields?: string | undefined;
|
|
62
|
-
limit?: number | undefined;
|
|
63
|
-
offset?: number | undefined;
|
|
64
|
-
orderby?: string | undefined;
|
|
65
|
-
display_value?: string | undefined;
|
|
66
|
-
}>;
|
|
67
|
-
export declare function handler(args: z.infer<typeof schema>, client: ServiceNowClient, config: ServiceNowConfig): Promise<{
|
|
68
|
-
content: Array<{
|
|
69
|
-
type: "text";
|
|
70
|
-
text: string;
|
|
71
|
-
}>;
|
|
72
|
-
}>;
|
|
1
|
+
/** Compatibility facade for the canonical sn_query module. */
|
|
2
|
+
export { definition, handler, moduleInputSchema, queryToolModule, schema, } from "./query-module.js";
|
|
73
3
|
//# sourceMappingURL=query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAE9D,OAAO,EACL,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,MAAM,GACP,MAAM,mBAAmB,CAAC"}
|
package/dist/tools/query.js
CHANGED
|
@@ -1,75 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/** Compatibility facade for the canonical sn_query module. */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.schema = exports.definition = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
inputSchema: {
|
|
11
|
-
type: "object",
|
|
12
|
-
properties: {
|
|
13
|
-
table: {
|
|
14
|
-
type: "string",
|
|
15
|
-
description: "ServiceNow table name (e.g. incident, change_request, sys_user)",
|
|
16
|
-
},
|
|
17
|
-
query: {
|
|
18
|
-
type: "string",
|
|
19
|
-
description: "ServiceNow encoded query (e.g. active=true^priority=1). Use ^ for AND, ^OR for OR.",
|
|
20
|
-
},
|
|
21
|
-
fields: {
|
|
22
|
-
type: "string",
|
|
23
|
-
description: "Comma-separated list of fields to return",
|
|
24
|
-
},
|
|
25
|
-
limit: {
|
|
26
|
-
type: "number",
|
|
27
|
-
description: "Maximum records to return (default 20)",
|
|
28
|
-
},
|
|
29
|
-
offset: {
|
|
30
|
-
type: "number",
|
|
31
|
-
description: "Pagination offset",
|
|
32
|
-
},
|
|
33
|
-
orderby: {
|
|
34
|
-
type: "string",
|
|
35
|
-
description: "Sort field. Prefix with - for descending (e.g. -sys_created_on)",
|
|
36
|
-
},
|
|
37
|
-
display_value: {
|
|
38
|
-
type: "string",
|
|
39
|
-
description: "Display values mode: true, false, or all (default: true)",
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
required: ["table"],
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
exports.schema = zod_1.z.object({
|
|
46
|
-
table: zod_1.z.string(),
|
|
47
|
-
query: zod_1.z.string().optional(),
|
|
48
|
-
fields: zod_1.z.string().optional(),
|
|
49
|
-
limit: zod_1.z.number().optional().default(20),
|
|
50
|
-
offset: zod_1.z.number().optional(),
|
|
51
|
-
orderby: zod_1.z.string().optional(),
|
|
52
|
-
display_value: zod_1.z.string().optional(),
|
|
53
|
-
});
|
|
54
|
-
async function handler(args, client, config) {
|
|
55
|
-
try {
|
|
56
|
-
const params = (0, utils_js_1.buildTableParams)({
|
|
57
|
-
query: args.query,
|
|
58
|
-
fields: args.fields,
|
|
59
|
-
limit: args.limit,
|
|
60
|
-
offset: args.offset,
|
|
61
|
-
orderby: args.orderby,
|
|
62
|
-
displayValue: args.display_value ?? config.displayValue,
|
|
63
|
-
});
|
|
64
|
-
const resp = await client.get(`/api/now/table/${args.table}`, params);
|
|
65
|
-
const results = resp.result || [];
|
|
66
|
-
return (0, utils_js_1.ok)({
|
|
67
|
-
record_count: results.length,
|
|
68
|
-
results,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
return (0, utils_js_1.err)((0, utils_js_1.formatError)(error));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
4
|
+
exports.schema = exports.queryToolModule = exports.moduleInputSchema = exports.handler = exports.definition = void 0;
|
|
5
|
+
var query_module_js_1 = require("./query-module.js");
|
|
6
|
+
Object.defineProperty(exports, "definition", { enumerable: true, get: function () { return query_module_js_1.definition; } });
|
|
7
|
+
Object.defineProperty(exports, "handler", { enumerable: true, get: function () { return query_module_js_1.handler; } });
|
|
8
|
+
Object.defineProperty(exports, "moduleInputSchema", { enumerable: true, get: function () { return query_module_js_1.moduleInputSchema; } });
|
|
9
|
+
Object.defineProperty(exports, "queryToolModule", { enumerable: true, get: function () { return query_module_js_1.queryToolModule; } });
|
|
10
|
+
Object.defineProperty(exports, "schema", { enumerable: true, get: function () { return query_module_js_1.schema; } });
|
|
75
11
|
//# sourceMappingURL=query.js.map
|
package/dist/tools/query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":";AAAA,8DAA8D;;;AAE9D,qDAM2B;AALzB,6GAAA,UAAU,OAAA;AACV,0GAAA,OAAO,OAAA;AACP,oHAAA,iBAAiB,OAAA;AACjB,kHAAA,eAAe,OAAA;AACf,yGAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Shared response hardening for the dedicated ordinary write modules. */
|
|
2
|
+
import { type ToolErrorRetry } from "../tool-error.js";
|
|
3
|
+
export declare function filteredWriteRecord(args: Readonly<Record<string, unknown>>, response: unknown, retry: ToolErrorRetry): Record<string, unknown>;
|
|
4
|
+
export declare function requiredCreatedSysId(record: Record<string, unknown>): string;
|
|
5
|
+
/** Tables that carry no `number` column simply omit it. */
|
|
6
|
+
export declare function optionalRecordNumber(record: Record<string, unknown>): string | undefined;
|
|
7
|
+
//# sourceMappingURL=record-write-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-write-shared.d.ts","sourceRoot":"","sources":["../../src/tools/record-write-shared.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAU1E,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKxE,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACvC,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,cAAc,GACpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBzB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAM5E;AAED,2DAA2D;AAC3D,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,GAAG,SAAS,CAapB"}
|