@onlyflows/servicenow-mcp 2.3.0-dev.2 → 2.3.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +212 -26
- package/README.md +108 -12
- package/dist/client.d.ts +5 -13
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +11 -26
- package/dist/client.js.map +1 -1
- package/dist/code-search-snippet.d.ts +25 -0
- package/dist/code-search-snippet.d.ts.map +1 -0
- package/dist/code-search-snippet.js +67 -0
- package/dist/code-search-snippet.js.map +1 -0
- package/dist/code-search-targets.d.ts +66 -0
- package/dist/code-search-targets.d.ts.map +1 -0
- package/dist/code-search-targets.js +82 -0
- package/dist/code-search-targets.js.map +1 -0
- package/dist/field-policy.d.ts.map +1 -1
- package/dist/field-policy.js +17 -5
- package/dist/field-policy.js.map +1 -1
- package/dist/http-observability.js +1 -0
- package/dist/http-observability.js.map +1 -1
- package/dist/metadata-cache.d.ts +2 -2
- package/dist/metadata-cache.d.ts.map +1 -1
- package/dist/metadata-cache.js +3 -2
- package/dist/metadata-cache.js.map +1 -1
- package/dist/policy-card.js +1 -1
- package/dist/policy-card.js.map +1 -1
- package/dist/response-too-large.d.ts +23 -0
- package/dist/response-too-large.d.ts.map +1 -0
- package/dist/response-too-large.js +42 -0
- package/dist/response-too-large.js.map +1 -0
- package/dist/risky-grants.d.ts.map +1 -1
- package/dist/risky-grants.js +1 -0
- package/dist/risky-grants.js.map +1 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +22 -7
- package/dist/setup.js.map +1 -1
- package/dist/table-policy.d.ts +42 -2
- package/dist/table-policy.d.ts.map +1 -1
- package/dist/table-policy.js +90 -6
- package/dist/table-policy.js.map +1 -1
- package/dist/tool-error.d.ts +40 -4
- package/dist/tool-error.d.ts.map +1 -1
- package/dist/tool-error.js +81 -4
- package/dist/tool-error.js.map +1 -1
- package/dist/tool-table-access.d.ts +9 -2
- package/dist/tool-table-access.d.ts.map +1 -1
- package/dist/tool-table-access.js +93 -30
- package/dist/tool-table-access.js.map +1 -1
- package/dist/tools/batch.d.ts.map +1 -1
- package/dist/tools/batch.js +21 -5
- package/dist/tools/batch.js.map +1 -1
- package/dist/tools/catalog.d.ts.map +1 -1
- package/dist/tools/catalog.js +2 -1
- package/dist/tools/catalog.js.map +1 -1
- package/dist/tools/codesearch.d.ts +2 -2
- package/dist/tools/codesearch.d.ts.map +1 -1
- package/dist/tools/codesearch.js +535 -86
- package/dist/tools/codesearch.js.map +1 -1
- package/dist/tools/flow-view-contracts.d.ts +2 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +13 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/query-module.d.ts.map +1 -1
- package/dist/tools/query-module.js +25 -4
- package/dist/tools/query-module.js.map +1 -1
- package/dist/tools/result-envelope.d.ts +2 -2
- package/dist/tools/result-envelope.d.ts.map +1 -1
- package/dist/tools/result-envelope.js +20 -2
- package/dist/tools/result-envelope.js.map +1 -1
- package/dist/unknown-filter-fields.d.ts +52 -0
- package/dist/unknown-filter-fields.d.ts.map +1 -0
- package/dist/unknown-filter-fields.js +87 -0
- package/dist/unknown-filter-fields.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/CLIENT-SETUP.md +15 -4
- package/docs/PRODUCTION-SECURITY.md +10 -6
- package/docs/V2-MIGRATION.md +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,20 +5,209 @@ All notable changes to this project are documented here.
|
|
|
5
5
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.3.0-dev.3] — 2026-11-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`sn_codesearch` searches ES modules.** `table: "sys_module"` searches the
|
|
13
|
+
`content` column and names each row by its `path` (the table has no `name`);
|
|
14
|
+
with no `table` it takes its turn after the other code tables, labelled "ES
|
|
15
|
+
Modules" (a search that names the table labels rows with the table name, as for
|
|
16
|
+
the others). `sys_module` follows the same rules as the other code tables: a
|
|
17
|
+
plain `--read sys_module` binds `sn_codesearch` to it with the other default
|
|
18
|
+
read tools, `content` goes through the field policy and the sensitive-name
|
|
19
|
+
rules, it is in the default metadata cache list, and a write grant on it is
|
|
20
|
+
flagged as code execution. It also becomes a built-in system table, which
|
|
21
|
+
changes who can read its fields: see Changed.
|
|
22
|
+
|
|
23
|
+
- **`sn_codesearch` searches ATF step scripts.** `table: "sys_atf_step"` finds
|
|
24
|
+
the script inputs of ATF steps: rows of `sys_variable_value` whose `document`
|
|
25
|
+
is `sys_atf_step` and whose `variable` ends with `script`, a condition fixed in
|
|
26
|
+
the server that no argument can widen (a `field` is refused, and the search
|
|
27
|
+
term cannot add a clause). Each result is the step, named `<test> > step
|
|
28
|
+
<order>`; the steps and then their tests are read by id to name them. The
|
|
29
|
+
profile needs read on `sys_variable_value`, `sys_atf_step` and `sys_atf_test`,
|
|
30
|
+
each bound to `sn_codesearch`; a denial names the missing table, and in a
|
|
31
|
+
search with no `table` the target is left out, and named, unless all three are
|
|
32
|
+
held. `grant --atf` binds those tables to `sn_atf_author` only, so add `grant
|
|
33
|
+
--read sys_variable_value,sys_atf_step,sys_atf_test --tools sn_codesearch` for
|
|
34
|
+
this search. The tables are not in the default metadata cache list.
|
|
35
|
+
- **`tools/list` grows by 129 characters.** The `sn_codesearch` entry goes from
|
|
36
|
+
3,655 to 3,784 characters (model-visible total 40,012 to 40,141), for the new
|
|
37
|
+
description and parameter text. The published `inputSchema` shape is
|
|
38
|
+
unchanged.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- **`sys_module` is now a built-in system table, so a `"*"` field entry no longer
|
|
43
|
+
narrows it.** Before, `sys_module` was like any table without a built-in entry:
|
|
44
|
+
a profile whose field policy has a `"*"` entry that narrows `readable` (for
|
|
45
|
+
example `"*": { "readable": ["sys_id", "path"] }`) could not read its `content`
|
|
46
|
+
or `sys_scope`, and `fields=all` returned only the listed fields. It is now one
|
|
47
|
+
of the 24 system tables, which keep their own built-in entry and are never
|
|
48
|
+
covered by a `"*"` field entry, as for `sys_script` and the other code tables.
|
|
49
|
+
A profile that reads `sys_module` (granted by name, or by a `"*"` table read
|
|
50
|
+
grant, which still covers it) and narrowed fields with `"*"` now reads
|
|
51
|
+
`content` and its other non-sensitive fields, and gets no warning. To keep it
|
|
52
|
+
narrowed, name `sys_module` in `fieldPolicy`, for example
|
|
53
|
+
`"sys_module": { "readable": ["sys_id", "path"] }`; a named entry still
|
|
54
|
+
narrows it. The sensitive-field-name rules apply as before.
|
|
55
|
+
- **A default read of a code table no longer returns the script.** `sn_query`
|
|
56
|
+
and `sn_get` on `sys_script`, `sys_script_include`, `sys_ui_script`,
|
|
57
|
+
`sys_script_client` and `sys_ws_operation` return, with no `fields`,
|
|
58
|
+
identifiers and metadata instead of the script body: for `sys_script_include`
|
|
59
|
+
that is `sys_id`, `name`, `api_name`, `active` and `sys_updated_on` (the other
|
|
60
|
+
tables add what identifies a row, such as `collection` and `when` for a
|
|
61
|
+
business rule). A default read of 87 script includes used to keep 9 rows
|
|
62
|
+
before the response budget cut it; it now returns all 87. **This changes the
|
|
63
|
+
default output:** a caller that relied on the body appearing by default must
|
|
64
|
+
name it, for example `fields: "sys_id,name,script"`. `fields=all` and
|
|
65
|
+
`response_format: "detailed"` still include it, and a profile that states its
|
|
66
|
+
own `defaults` for one of these tables keeps them.
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- **A code search with no `table` searches the code tables the profile may read.**
|
|
71
|
+
It needed a read grant on all five (and `sn_codesearch` bound to each), so a
|
|
72
|
+
profile that held only `sys_script_include` was denied outright while the same
|
|
73
|
+
call with `table: "sys_script_include"` worked. It now decides each table on
|
|
74
|
+
its own, by the table policy and by the field policy of its script field,
|
|
75
|
+
searches the ones it may read, and adds a warning that names the others and
|
|
76
|
+
the `grant` command that includes one. It fails only when none can be read: the
|
|
77
|
+
error names the tool and the grant, or, when the tables are granted but their
|
|
78
|
+
script field is not readable, the field and the key to change. The dispatcher
|
|
79
|
+
still authorizes the narrowed plan, so this never widens access.
|
|
80
|
+
- **A large code search returns results instead of failing.** `sn_codesearch`
|
|
81
|
+
read the full script of `limit + 1` rows from every table it searched, so
|
|
82
|
+
above about 100 rows (150, 200 and 300 failed every time on an instance of
|
|
83
|
+
6,500 script includes) it passed the 1 MiB response cap, and with no `table`
|
|
84
|
+
the five tables shared one budget. It now reads the rows without their
|
|
85
|
+
scripts and then the scripts of the rows it returns only, 50 at a time, each
|
|
86
|
+
batch in its own response scope; a batch that is still too large is halved,
|
|
87
|
+
and a script too large to read on its own leaves that row with an empty
|
|
88
|
+
snippet and `note: "script too large to preview"`. A search of one table with
|
|
89
|
+
`limit` 49 or less still reads the scripts with the rows, in one request.
|
|
90
|
+
Reads also send `sysparm_no_count`, so the instance skips a row count it never
|
|
91
|
+
used. If the rows alone pass the cap, the error is the too-large message.
|
|
92
|
+
- **The script reads of one code search are bounded.** Scripts for the rows of a
|
|
93
|
+
page are read by id in batches of 50, and a call spends at most 12 such
|
|
94
|
+
requests and 8 MiB on them, however large the scripts are (a batch that passes
|
|
95
|
+
the response cap is retried smaller, and what it learns sizes the later
|
|
96
|
+
batches). Scripts are read only for the rows the response can hold, in page
|
|
97
|
+
order. When the budget is spent the remaining rows keep their place with an
|
|
98
|
+
empty snippet, and a warning says how many and to lower `limit`; the call does
|
|
99
|
+
not fail. A search across all code tables makes more requests than before but
|
|
100
|
+
transfers less data.
|
|
101
|
+
- **A code search with no `table` no longer fills page 1 with one table.**
|
|
102
|
+
Results were sorted by table name, so the first table (business rules)
|
|
103
|
+
filled the page whenever it had `limit` or more matches and script includes
|
|
104
|
+
appeared only after paging past every one of them. The tables now take turns:
|
|
105
|
+
each table's first match (script includes first, then business rules, UI
|
|
106
|
+
scripts, client scripts, scripted REST operations), then each table's second,
|
|
107
|
+
and so on, each in `sys_id` order. The order depends only on the data, and
|
|
108
|
+
`offset` pages through it without skipping or repeating a row. The result
|
|
109
|
+
metadata's `order_by` is `["round", "table", "sys_id"]` for this search and
|
|
110
|
+
`["sys_id"]` for a search of one table.
|
|
111
|
+
- **A code search snippet shows the text around the match.** It was the first
|
|
112
|
+
200 characters of the script, which rarely showed why the record matched. It
|
|
113
|
+
is now about 200 characters centred on the first case-insensitive match, with
|
|
114
|
+
`...` where text was cut, and each row gains `line`, the line the match is on.
|
|
115
|
+
When the text holds no literal match (the instance's comparison can be looser
|
|
116
|
+
than a literal one) the snippet is the head of the script, as before, with no
|
|
117
|
+
`line`.
|
|
118
|
+
- **`sn_codesearch` accepts `field: "name"` and `field: "sys_id"`.** The search
|
|
119
|
+
appended its field to a fixed `sys_id,name,<field>` list, so a field already in
|
|
120
|
+
the list became a duplicate and the policy check refused it with
|
|
121
|
+
`invalid_field_selection` before any request. The projection now lists each
|
|
122
|
+
field once, in the access check and in the read. A `field` that names more
|
|
123
|
+
than one field (`"name,script"`) is refused instead of silently searching the
|
|
124
|
+
first.
|
|
125
|
+
- **`sn_codesearch` pages in a stable order.** It sent `sysparm_orderby`, which
|
|
126
|
+
is not a Table API parameter, so the order of its windows was not guaranteed
|
|
127
|
+
and an offset could skip or repeat a record. The order is now part of the
|
|
128
|
+
encoded query (`^ORDERBYsys_id`), as `sn_query` does it.
|
|
129
|
+
- **A response that passes the byte cap is reported as too large, with the
|
|
130
|
+
remedy, by every tool.** A read that went over the 1 MiB response limit, or
|
|
131
|
+
over the call's cumulative upstream budget, used to reach the caller as "The
|
|
132
|
+
operation failed unexpectedly. Error category: internal. Retry unchanged is
|
|
133
|
+
not recommended." It now reads "The response was too large to return in one
|
|
134
|
+
call. Lower limit, request fewer fields, or narrow the query, then retry.
|
|
135
|
+
Error category: too_large. Retry after correcting the request or
|
|
136
|
+
configuration." The new `too_large` category is also what audit records and
|
|
137
|
+
the HTTP tool-call metrics report as `errorCategory`. The mapping is made once,
|
|
138
|
+
where an error becomes the caller's message, so it covers every tool that
|
|
139
|
+
reads through the client. A write whose response is over the cap is still
|
|
140
|
+
treated as an unknown outcome, as before.
|
|
141
|
+
|
|
142
|
+
- **A table-policy denial names the table, the tool and the grant that lifts it.**
|
|
143
|
+
It used to say only "Table access was denied by policy." Now, for example,
|
|
144
|
+
`Table access was denied by policy: "sys_script_include" is granted to this
|
|
145
|
+
profile, but not for sn_codesearch. To allow it, run: servicenow-mcp-setup
|
|
146
|
+
grant --profile <profile> --read sys_script_include --tools sn_codesearch,
|
|
147
|
+
then restart the MCP client.` The text says whether the table is missing from
|
|
148
|
+
the profile or only the tool is, and uses `--write` for a write. It carries
|
|
149
|
+
the table and tool of that one call and nothing else of the profile's rules;
|
|
150
|
+
a table name that is not a valid identifier still gets the fixed sentence.
|
|
151
|
+
`grant --help` now says `--tools` adds to a table's tools.
|
|
152
|
+
- **A page with more results no longer reports truncation.** `sn_codesearch`,
|
|
153
|
+
`sn_discover` and `sn_aggregate` (with `group_by`) read one row past the page
|
|
154
|
+
to learn whether another page exists. That row is not part of the result, but
|
|
155
|
+
the response counted it as a dropped record, so every page that had a next
|
|
156
|
+
page also said `metadata.truncation: {truncated: true, reason:
|
|
157
|
+
"record_limit", dropped_records: 1}`, which reads as data loss when none was
|
|
158
|
+
lost. `has_more` and `next_offset` are unchanged (`next_offset` is still
|
|
159
|
+
`offset + record_count`), and `metadata.truncation` is now `{truncated:
|
|
160
|
+
false}` for such a page. It still reports rows dropped to fit the response
|
|
161
|
+
size (`byte_limit`), now counting only the rows of the page that were dropped,
|
|
162
|
+
not the extra one, and rows a tool itself cut.
|
|
163
|
+
|
|
164
|
+
### Removed
|
|
165
|
+
|
|
166
|
+
- Planning documents that were not part of the published package are no longer
|
|
167
|
+
in the repository.
|
|
168
|
+
|
|
169
|
+
### Fixed
|
|
170
|
+
|
|
171
|
+
- **A 401 on a basic-auth profile now explains the Basic Auth restriction.**
|
|
172
|
+
Current ServiceNow instances reject REST Basic auth unless the user has the
|
|
173
|
+
role `snc_basic_auth_api_access` (or is a web-service-access-only account),
|
|
174
|
+
and the rejection is a bare 401. The setup wizard's credential check now says
|
|
175
|
+
so after "check the username and password", and recommends OAuth client
|
|
176
|
+
credentials, because ServiceNow is retiring Basic auth. A tool call that gets
|
|
177
|
+
a 401 on a basic-auth profile returns the same guidance as fixed text: the
|
|
178
|
+
error never contains the response body, the credential or the instance URL.
|
|
179
|
+
OAuth and API-key profiles are unchanged. The README already said the error
|
|
180
|
+
explained the restriction; now it does. The wizard still defaults to `basic`.
|
|
181
|
+
- **`sn_query` refuses a `structured_query` filter or order on a field the
|
|
182
|
+
table does not have.** ServiceNow ignores a condition on a field it does not
|
|
183
|
+
know, so a misspelt field returned unrelated rows with no error. The call now
|
|
184
|
+
fails and says the field "was not found on the table, or is not readable by
|
|
185
|
+
this user" (a field hidden by an ACL looks the same as a missing one). No
|
|
186
|
+
extra request is made: the fields a filter or order uses are added to the
|
|
187
|
+
read's `sysparm_fields` and looked for in the rows that come back, then left
|
|
188
|
+
out of the result. A field counts as present when any returned row carries
|
|
189
|
+
it, an existing column with no value is still returned, and a read that
|
|
190
|
+
returns no rows is returned as before, since there is nothing to check. A raw
|
|
191
|
+
encoded `query` is not checked; it is only accepted through a policy rule
|
|
192
|
+
that already pins the query and its fields. The extra columns add bytes to
|
|
193
|
+
each fetched row, and a filter on a very large text field that is not in
|
|
194
|
+
`fields` can take a wide read past the 1 MiB upstream response limit: the
|
|
195
|
+
call then says so and asks for a lower `limit`.
|
|
196
|
+
|
|
8
197
|
## [2.3.0-dev.2] — 2026-11-15
|
|
9
198
|
|
|
10
199
|
### Added
|
|
11
200
|
|
|
12
201
|
- **`sn_query` reads `structured_query.filter` given as a list as an implicit
|
|
13
|
-
AND
|
|
202
|
+
AND.** `filter: [c1, c2]` means `{type: "group", operator: "and",
|
|
14
203
|
conditions: [c1, c2]}`, and a one-element list means that element. The
|
|
15
204
|
existing limit of 3 nested group levels is unchanged: a list of two or more
|
|
16
205
|
takes one level, so a list that holds a 3-level group is rejected, and the
|
|
17
206
|
error says so. An empty list is rejected with its own message. A list is read
|
|
18
207
|
this way only as the top-level `filter` and only by `sn_query`: `sn_batch`
|
|
19
208
|
write filters stay one object, so a mutation never selects records through a
|
|
20
|
-
list. The list is part of the published `tools/list` schema (
|
|
21
|
-
- **`structured_query.filter` shows a working example in `tools/list
|
|
209
|
+
list. The list is part of the published `tools/list` schema (see the schema entry below).
|
|
210
|
+
- **`structured_query.filter` shows a working example in `tools/list`.**
|
|
22
211
|
`sn_query`'s `filter` says a list is read as AND and shows one, and the
|
|
23
212
|
`sn_query` description gains a one-line example with the OR group form.
|
|
24
213
|
`sn_batch`'s `filter` has its own text: one condition or group, and a list is
|
|
@@ -27,8 +216,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
27
216
|
such as `name` would match every row of a table without that column, since
|
|
28
217
|
ServiceNow drops a condition on a field the table lacks. Costs 605 characters
|
|
29
218
|
in `tools/list` (`sn_query` +459, `sn_batch` +146).
|
|
30
|
-
- **Responses say whether the metadata cache was used and where the time went
|
|
31
|
-
(#21).** `structuredContent.metadata` gains two optional fields. `cache` is
|
|
219
|
+
- **Responses say whether the metadata cache was used and where the time went.** `structuredContent.metadata` gains two optional fields. `cache` is
|
|
32
220
|
`hit`, `miss`, `bypass` (a `force_recache` refresh) or `mixed` (several
|
|
33
221
|
cacheable reads with different outcomes, such as an `sn_codesearch` with no
|
|
34
222
|
`table`), and is absent when the call read no cacheable table. `timing` is
|
|
@@ -37,14 +225,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
37
225
|
kind was in flight, so overlapping requests count once. Only the server sets
|
|
38
226
|
them (a value a tool supplies is discarded), and they are not counted
|
|
39
227
|
against the result's byte limit, so they never cost a record and are never
|
|
40
|
-
dropped (
|
|
228
|
+
dropped (see the entry on truncated responses below). Every tool's
|
|
41
229
|
`outputSchema` grows by 322 characters (7,728 in `tools/list`). Cache
|
|
42
230
|
behaviour is unchanged.
|
|
43
231
|
|
|
44
232
|
### Fixed
|
|
45
233
|
|
|
46
234
|
- **`sn_query` no longer fails with an internal error at the smallest byte
|
|
47
|
-
budgets (
|
|
235
|
+
budgets (a regression from the labelled hint).** A truncated read
|
|
48
236
|
at `max_response_bytes` 1000 with a wide row (eight fields including a long
|
|
49
237
|
`description`, limit 50) returned `The operation failed unexpectedly` every
|
|
50
238
|
time: the envelope's metadata leaves room for little beside the counts at
|
|
@@ -55,7 +243,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
55
243
|
`recovery` set, a hint that parses and equals `dropped_records`). The hint
|
|
56
244
|
never names a value above the effective maximum.
|
|
57
245
|
- **A truncation hint says which `max_response_bytes` is for the next row and
|
|
58
|
-
which for the whole page
|
|
246
|
+
which for the whole page.** The hint's budget was measured for the
|
|
59
247
|
next row only, but a bare `max_response_bytes=1500` read as a value for the
|
|
60
248
|
page: live, a 50-row read at 1000 bytes said 1500 and following it returned
|
|
61
249
|
one row. The hint now reads `... or max_response_bytes=1500 (fits the next
|
|
@@ -71,7 +259,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
71
259
|
costs 68 characters in `tools/list` (`sn_schema` 3518 to 3586, total 128190
|
|
72
260
|
to 128258).
|
|
73
261
|
- **The list form of `structured_query.filter` is in the published `tools/list`
|
|
74
|
-
schema, and `tools/list` is smaller
|
|
262
|
+
schema, and `tools/list` is smaller.** `sn_query` read a list filter,
|
|
75
263
|
and its descriptions tell clients to send one, but the schema it published
|
|
76
264
|
had no array option, so a client that validates arguments against it (ajv)
|
|
77
265
|
rejected the documented example. The list is now an explicit branch of the
|
|
@@ -82,7 +270,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
82
270
|
`StructuredQueryFilter` and `StructuredQueryCondition`, so clients that merge
|
|
83
271
|
`definitions` across tools or servers do not collide. `sn_batch` shares them
|
|
84
272
|
and still publishes no array option, and a list is still rejected there.
|
|
85
|
-
Behaviour is unchanged: the error messages (
|
|
273
|
+
Behaviour is unchanged: the error messages (including the specific one
|
|
86
274
|
for a bad field name, a control character or an over-long value inside a
|
|
87
275
|
list element, which now names the caller's own position, `filter[1].field`,
|
|
88
276
|
and not a position inside the wrapper group) and the nesting rule (a list of
|
|
@@ -92,22 +280,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
92
280
|
server rejects. `tools/list`: `sn_query` 16,574 to 10,183 characters,
|
|
93
281
|
`sn_batch` 14,818 to 8,328, the whole list 140,887 to 128,006 (the part a
|
|
94
282
|
model reads, without output schemas, 52,641 to 39,760). This delivers most of
|
|
95
|
-
the filter dedupe asked for
|
|
283
|
+
the filter dedupe that was asked for; stripping the bounds the server enforces
|
|
96
284
|
anyway, and sharing the scalar value union, are not done. Clients that do not
|
|
97
285
|
resolve `$ref` to `definitions` are not served by this form, and a client that
|
|
98
286
|
dereferences `$ref` before it validates or shows the schema sees `sn_query` at
|
|
99
287
|
about 22.8k characters (the list option written out), against about 13.7k
|
|
100
288
|
before this change.
|
|
101
|
-
- **Truncated responses keep `metadata.cache` and `metadata.timing
|
|
289
|
+
- **Truncated responses keep `metadata.cache` and `metadata.timing`.**
|
|
102
290
|
The two fields were added only when the finished response still fit
|
|
103
291
|
`max_response_bytes`, so a response fitted to within about 90 bytes of its
|
|
104
292
|
limit lost them, on exactly the calls where the timing helps most. They are
|
|
105
293
|
no longer counted against the limit: the fit and the truncation hint's numbers
|
|
106
|
-
(
|
|
294
|
+
(see the entries on `has_more` and on the hint's values) are unchanged, and a successful response always carries both. It
|
|
107
295
|
can exceed `max_response_bytes` by their size, under 100 bytes. The
|
|
108
296
|
`max_response_bytes` description of `sn_query`, `sn_get` and `sn_flow_view`
|
|
109
297
|
says so (about 61 characters each in `tools/list`).
|
|
110
|
-
- **A rejected `structured_query.filter` names the mistake
|
|
298
|
+
- **A rejected `structured_query.filter` names the mistake.** A bad
|
|
111
299
|
operator, an unknown or missing `type`, a bad group, a missing key, a value of
|
|
112
300
|
the wrong kind or a group nested too deep used to get the same shape message,
|
|
113
301
|
even when the condition sat inside a group. The message now says the first
|
|
@@ -121,7 +309,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
121
309
|
condition type is quoted only when it is one of the known type names. The
|
|
122
310
|
shape message remains for anything the walk cannot name. `tools/list` is
|
|
123
311
|
byte-identical.
|
|
124
|
-
- **The `sn_query` truncation hint gives values to use
|
|
312
|
+
- **The `sn_query` truncation hint gives values to use.** The
|
|
125
313
|
`max_response_bytes` description promised exact follow-up arguments, but the
|
|
126
314
|
hint said "a lower limit" and "a higher max_response_bytes" with no numbers,
|
|
127
315
|
and a caller who chose their own `fields` got no field advice. The hint now
|
|
@@ -138,7 +326,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
138
326
|
`dropped_records` and the hint stays within 600 characters. The
|
|
139
327
|
`max_response_bytes` description now names what the hint carries (5
|
|
140
328
|
characters shorter; `tools/list` `sn_query` 16,579 to 16,574).
|
|
141
|
-
- **`sn_query` no longer stops paging after page 2
|
|
329
|
+
- **`sn_query` no longer stops paging after page 2.** The tool sends
|
|
142
330
|
`sysparm_no_count`, so ServiceNow's `X-Total-Count` header holds the size of
|
|
143
331
|
the response (the page plus the one sentinel row), not the table. The handler
|
|
144
332
|
trusted it: `total` echoed the rows fetched, and `has_more` turned false from
|
|
@@ -150,7 +338,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
150
338
|
call `sn_aggregate` with `COUNT` when the table size matters. If ServiceNow
|
|
151
339
|
ACLs strip rows from a page, `has_more` can read false early; cross-check
|
|
152
340
|
with `sn_aggregate` `COUNT`.
|
|
153
|
-
- **A read grant now allows code search
|
|
341
|
+
- **A read grant now allows code search.** `servicenow-mcp-setup grant
|
|
154
342
|
--read <table>` binds `sn_codesearch` along with `sn_query`, `sn_get`,
|
|
155
343
|
`sn_aggregate` and `sn_schema`, so `--read sys_script_include` is enough to
|
|
156
344
|
search script includes; before, every code search on such a profile was
|
|
@@ -163,7 +351,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
163
351
|
--profile <name> --read <code table>` again to add the default tools, or add
|
|
164
352
|
just this one with `--tools sn_codesearch`. Neither removes a tool.
|
|
165
353
|
- **A truncation hint on `sn_query` no longer disagrees with `dropped_records`,
|
|
166
|
-
and suggests fields the table has
|
|
354
|
+
and suggests fields the table has.** A read cut to fit
|
|
167
355
|
`max_response_bytes` is trimmed in two steps, and the second could drop more
|
|
168
356
|
rows than the hint's "Dropped n/m" said. The hint is now restated from the
|
|
169
357
|
final result, so its count, its empty-result advice and its continuation
|
|
@@ -174,7 +362,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
174
362
|
display field the profile's field policy names, else `sys_id` alone. A call
|
|
175
363
|
that passed its own `fields` is told to lower `limit` or raise
|
|
176
364
|
`max_response_bytes` instead of being given a field list.
|
|
177
|
-
- **A rejected `structured_query.filter` now says what is accepted
|
|
365
|
+
- **A rejected `structured_query.filter` now says what is accepted.**
|
|
178
366
|
Every mistake used to read "Invalid input at structured_query.filter". The
|
|
179
367
|
message now says the filter is one condition or group object, gives a working
|
|
180
368
|
example, shows how to combine conditions with a group, and states the limit
|
|
@@ -183,7 +371,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
183
371
|
### Changed
|
|
184
372
|
|
|
185
373
|
- **A repeated read of a small cached-table response is one request, not a
|
|
186
|
-
watermark and a read
|
|
374
|
+
watermark and a read.** A cache hit costs one watermark round trip, so
|
|
187
375
|
for a small response a hit cost about what a plain read did and a miss cost
|
|
188
376
|
two requests. A read of a cacheable table whose response is under 32 KiB is
|
|
189
377
|
no longer kept: the selector is remembered as small, per credential scope,
|
|
@@ -197,7 +385,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
197
385
|
size, not a time: `sys_dictionary` there has a watermark of about 0.5 s, and
|
|
198
386
|
even a 66 KB read was faster uncached. `metadataCache.smallReadBytes` sets
|
|
199
387
|
the threshold per profile (0 keeps every response).
|
|
200
|
-
- **`has_more` and `next_offset` count rows dropped for size
|
|
388
|
+
- **`has_more` and `next_offset` count rows dropped for size. Contract
|
|
201
389
|
change for truncated pages.** A page cut to fit `max_response_bytes` kept
|
|
202
390
|
`has_more` and `next_offset` for the rows beyond the page, so a client that
|
|
203
391
|
followed `next_offset` skipped every dropped row, and a cut last page said
|
|
@@ -221,10 +409,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
221
409
|
`sn_discover`, `sn_attach` (list) and `sn_atf` continue at `offset + rows
|
|
222
410
|
returned`; any other cut collection (for example `sn_aggregate`) reports
|
|
223
411
|
`has_more: true` with no `next_offset`. This also stops a byte drop made only
|
|
224
|
-
by the envelope
|
|
412
|
+
by the envelope from skipping the dropped row when `next_offset` is
|
|
225
413
|
followed, and the tool's "More records available. Call sn_query again with
|
|
226
414
|
offset=N." hint is restated at `next_offset` (or says no row fit), so it never
|
|
227
|
-
contradicts it;
|
|
415
|
+
contradicts it; the envelope's `truncated`/`dropped_records` flags in `data` are not
|
|
228
416
|
added here. See the README, "Paging when a response is cut to size".
|
|
229
417
|
- **Code tables are in the default metadata cache.** `sys_script`,
|
|
230
418
|
`sys_script_include`, `sys_ui_script`, `sys_script_client` and
|
|
@@ -459,9 +647,7 @@ parentheses are the pull requests that made each change.
|
|
|
459
647
|
`io.github.onlyflowstech/servicenow-mcp`, and the package ships the
|
|
460
648
|
`server.json` manifest for the official MCP Registry. (#14)
|
|
461
649
|
- The README leads with what the server controls and what it does not, lists
|
|
462
|
-
the tools by area, and documents per-profile field policy.
|
|
463
|
-
describes how contributors' AI agents work in this repository. (#11, #13,
|
|
464
|
-
#14)
|
|
650
|
+
the tools by area, and documents per-profile field policy. (#11, #13, #14)
|
|
465
651
|
- From the 2.2.0 dev builds: the ATF tools `sn_atf_author`, `sn_atf_run`,
|
|
466
652
|
`sn_atf_results` and `sn_atf_readiness`, with `setup grant --atf`;
|
|
467
653
|
Windows support in `servicenow-mcp-setup`; and the npm `dev` channel for
|
package/README.md
CHANGED
|
@@ -563,7 +563,7 @@ For instances using Inbound Authentication Profiles with API keys. The header na
|
|
|
563
563
|
}
|
|
564
564
|
```
|
|
565
565
|
|
|
566
|
-
On a 401, the error explains the Basic Auth restriction program (KB3096078) and
|
|
566
|
+
On a 401 for a basic-auth profile, the error explains the Basic Auth restriction program (KB3096078): the role `snc_basic_auth_api_access` or a Web-Service-Access-Only account is needed, and OAuth is the recommended way to move off Basic Auth. The setup wizard gives the same explanation when it verifies the credential.
|
|
567
567
|
|
|
568
568
|
### Timeouts & retries
|
|
569
569
|
|
|
@@ -716,7 +716,7 @@ in this section is needed to use this server.
|
|
|
716
716
|
| `sn_relationships` | CMDB CI graph traversal — upstream/downstream/both, configurable depth |
|
|
717
717
|
| `sn_attach` | List attachments, return downloads as inline base64, and upload inline base64 content; never touches a host filesystem path |
|
|
718
718
|
| `sn_syslog` | Query system logs with severity/source/time filters |
|
|
719
|
-
| `sn_codesearch` | Search business rules, script includes, client scripts, etc. Part of the default read grant, so a plain read grant on a code table allows it |
|
|
719
|
+
| `sn_codesearch` | Search business rules, script includes, client scripts, etc., with a snippet around each match ([Code search](#code-search)). Part of the default read grant, so a plain read grant on a code table allows it |
|
|
720
720
|
| `sn_discover` | Discover tables, scoped apps, store apps, plugins |
|
|
721
721
|
|
|
722
722
|
### Testing & Automation
|
|
@@ -843,14 +843,86 @@ Two failure modes are worth knowing:
|
|
|
843
843
|
builds the request policy with only `allowedHosts` and `allowedOrigins`, so the
|
|
844
844
|
limit is always 1 MiB and no environment variable changes it.
|
|
845
845
|
|
|
846
|
+
### Code search
|
|
847
|
+
|
|
848
|
+
`sn_codesearch {search_term, table?, field?, limit?, offset?}` finds records
|
|
849
|
+
whose script contains the text, in the business rules, script includes, UI
|
|
850
|
+
scripts, client scripts, scripted REST operations, ES modules and ATF step
|
|
851
|
+
scripts of the instance. Each row
|
|
852
|
+
is `{table, table_label, sys_id, name, snippet, line}`: `snippet` is about 200
|
|
853
|
+
characters of the script centred on the first match (`...` marks a cut) and
|
|
854
|
+
`line` is the line that match is on. The comparison is the instance's
|
|
855
|
+
case-insensitive `LIKE`; if the text holds no literal match for the term, the
|
|
856
|
+
snippet is the head of the script and the row has no `line`.
|
|
857
|
+
|
|
858
|
+
- **One table or all.** With `table`, one table is searched (and `field` can
|
|
859
|
+
name another field of it, such as `name`). With none, every code table the
|
|
860
|
+
profile may read is searched, and the tables left out are named in a warning
|
|
861
|
+
(`Not searched, because this profile does not allow sn_codesearch to read
|
|
862
|
+
them: sys_script, sys_ws_operation. To include one, run servicenow-mcp-setup
|
|
863
|
+
grant --profile <profile> --read <table> --tools sn_codesearch.`). A table is
|
|
864
|
+
left out when the table policy does not bind `sn_codesearch` to it or the field
|
|
865
|
+
policy does not let the profile read its script field. The call fails only when
|
|
866
|
+
none can be read, and the error says why.
|
|
867
|
+
- **ES modules** are `sys_module`: the script is its `content` column and a row
|
|
868
|
+
is named by its `path`, because the table has no `name`. A profile reads it
|
|
869
|
+
once the table policy allows it: `servicenow-mcp-setup grant --profile dev
|
|
870
|
+
--read sys_module`, or a read wildcard. It is cached by default like the other
|
|
871
|
+
code tables, and `fields=all` reads `content`. A default `sn_query` of it lists
|
|
872
|
+
`sys_id`, `path` and `sys_updated_on`. `sys_module` is a built-in system table
|
|
873
|
+
(the 24th), so a `"*"` entry in the field policy does not narrow it: a profile
|
|
874
|
+
whose `"*"` entry limits `readable` and that can read `sys_module` now reads
|
|
875
|
+
`content`, where it did not before. To narrow it, name it in `fieldPolicy`
|
|
876
|
+
(`"sys_module": { "readable": ["sys_id", "path"] }`).
|
|
877
|
+
- **ATF step scripts** are searched with `table: "sys_atf_step"`. A step's script
|
|
878
|
+
is not a column of the step but the value of its script input, a row of
|
|
879
|
+
`sys_variable_value`. The search reads only the rows whose `document` is
|
|
880
|
+
`sys_atf_step` and whose `variable` ends with `script`, a condition fixed in
|
|
881
|
+
the server: no argument can widen it to another table's variables, and `field`
|
|
882
|
+
is refused. Each result is the step (`sys_id` is the step's), named
|
|
883
|
+
`<test name> > step <order>` where `order` is the step's own order value, and
|
|
884
|
+
the steps and then their tests are read by id to say so. Three tables are read,
|
|
885
|
+
so the profile needs read on `sys_variable_value`, `sys_atf_step` and
|
|
886
|
+
`sys_atf_test`, each bound to `sn_codesearch`:
|
|
887
|
+
`servicenow-mcp-setup grant --profile dev --read sys_variable_value,sys_atf_step,sys_atf_test`
|
|
888
|
+
(or `--tools sn_codesearch` to bind only this tool: `sys_variable_value` also
|
|
889
|
+
holds other tables' variable values, which that grant does not let this tool
|
|
890
|
+
search). `grant --atf` binds those tables to `sn_atf_author` only, so a profile
|
|
891
|
+
that has it adds this grant on top. A search with no `table` includes ATF
|
|
892
|
+
step scripts when all three are held and names `sys_atf_step` in the warning
|
|
893
|
+
when they are not. These tables are not in the default cache list: the reads go
|
|
894
|
+
straight to the instance.
|
|
895
|
+
- **A page is shared among the tables.** A search of several tables takes turns:
|
|
896
|
+
each table's first match (script includes first, then business rules, UI
|
|
897
|
+
scripts, client scripts, scripted REST operations, ES modules), then each
|
|
898
|
+
table's second,
|
|
899
|
+
and so on, each table in `sys_id` order. No table crowds the others off page
|
|
900
|
+
1, and the order depends only on the data, so `offset` and `next_offset` page
|
|
901
|
+
through it exactly. A table with few matches leaves its share to the others.
|
|
902
|
+
- **Large pages degrade, they do not fail.** A script can be hundreds of
|
|
903
|
+
kilobytes, so a page of them does not fit one response. A search of one table
|
|
904
|
+
with `limit` 49 or less reads the scripts with the rows, in one request (and
|
|
905
|
+
falls back to the two steps below if that page passes the cap). A larger page, or a search of several tables, first finds the rows without
|
|
906
|
+
their scripts and then reads the scripts of the rows it returns, 50 at a time,
|
|
907
|
+
narrowing a batch that is still too large. One search spends at most 12 such
|
|
908
|
+
requests and 8 MiB, and only for the rows one response can hold (about 280);
|
|
909
|
+
when that is spent, the remaining rows keep an empty `snippet` and a warning
|
|
910
|
+
says how many (lower `limit`). A script too large to read even on its own gives
|
|
911
|
+
its row an empty `snippet` and `note: "script too large to preview"`; read it
|
|
912
|
+
with `sn_get`. If the rows alone pass the response cap, the
|
|
913
|
+
error says the response was too large and to lower `limit` or `offset`.
|
|
914
|
+
- **The scripts are still field-policy readable fields.** The search reads the
|
|
915
|
+
identifier, the name and the searched field of each table, each subject to the
|
|
916
|
+
profile's field policy, and the sensitive-name rules apply to `field`.
|
|
917
|
+
|
|
846
918
|
### Metadata cache
|
|
847
919
|
|
|
848
920
|
Stable ServiceNow metadata reads are cached per instance and credential identity
|
|
849
921
|
for 24 hours by default. The default cached table patterns are
|
|
850
922
|
`sys_glide_object`, `sys_dictionary`, `sys_db_object`, `sys_app`, `sys_plugins`,
|
|
851
|
-
`sys_metadata*`, `sys_flow*`, and the
|
|
923
|
+
`sys_metadata*`, `sys_flow*`, and the six code tables `sn_codesearch`
|
|
852
924
|
searches: `sys_script`, `sys_script_include`, `sys_ui_script`,
|
|
853
|
-
`sys_script_client`, and `
|
|
925
|
+
`sys_script_client`, `sys_ws_operation`, and `sys_module`. A repeated code search or
|
|
854
926
|
`sn_query` page on those tables is served from the cache while the table's
|
|
855
927
|
watermark is unchanged. Set `metadataCache.ttlMs` and
|
|
856
928
|
`metadataCache.tables` on a file-backed profile, or `SN_METADATA_CACHE_TTL_MS`
|
|
@@ -908,7 +980,7 @@ reads were served: `hit` (all from the cache), `miss` (from ServiceNow: nothing
|
|
|
908
980
|
cached yet, the watermark moved, the entry expired, the table could not be
|
|
909
981
|
cached just then, or the response is small and not kept), `bypass` (a `force_recache: true` refresh), or `mixed` (the
|
|
910
982
|
call made several cacheable reads with different outcomes, such as an
|
|
911
|
-
`sn_codesearch` with no `table` over the
|
|
983
|
+
`sn_codesearch` with no `table` over the code tables). It is absent when
|
|
912
984
|
the call read no cache-eligible table. `timing` is `{ total_ms, upstream_ms,
|
|
913
985
|
watermark_ms }` in whole milliseconds, measured wall-clock: `total_ms` is the
|
|
914
986
|
whole tool call; `upstream_ms` is the time during which at least one request to
|
|
@@ -1109,16 +1181,27 @@ servicenow-mcp-setup grant --profile dev --flows # sn_flow_view's 15 tables, b
|
|
|
1109
1181
|
A read grant without `--tools` binds `sn_query`, `sn_get`, `sn_aggregate`,
|
|
1110
1182
|
`sn_schema` and `sn_codesearch` to each table it names. `sn_codesearch` is
|
|
1111
1183
|
authorized per code table it searches (`sys_script`, `sys_script_include`,
|
|
1112
|
-
`sys_ui_script`, `sys_script_client`, `sys_ws_operation`), so
|
|
1184
|
+
`sys_ui_script`, `sys_script_client`, `sys_ws_operation`, `sys_module`), so
|
|
1113
1185
|
`servicenow-mcp-setup grant --profile dev --read sys_script_include` lets that
|
|
1114
|
-
profile search script includes
|
|
1115
|
-
|
|
1186
|
+
profile search script includes. A search with no `table` searches the code tables
|
|
1187
|
+
the profile may read and names the others in a warning; it fails only when the
|
|
1188
|
+
profile may read none of them. On any other table the binding is inert. **A profile written before
|
|
1116
1189
|
`sn_codesearch` was a default keeps the tool list it was saved with** and is not
|
|
1117
1190
|
rewritten: re-run the same `grant --read <code table>` to add it, or pass
|
|
1118
1191
|
`--tools sn_codesearch` to add only that tool. Neither removes a tool. The
|
|
1119
1192
|
profile's field policy still decides the script field: `sn_codesearch` is
|
|
1120
1193
|
denied on a code table whose script field is not readable, exactly as `sn_query`
|
|
1121
|
-
is for that field
|
|
1194
|
+
is for that field (in a search with no `table` that table is left out and named
|
|
1195
|
+
in the warning instead).
|
|
1196
|
+
|
|
1197
|
+
A call the table policy refuses says which table and which tool were refused, and
|
|
1198
|
+
whether the table is missing from the profile or only the tool is, and it gives
|
|
1199
|
+
the command that lifts it: `Table access was denied by policy: "sys_script_include"
|
|
1200
|
+
is granted to this profile, but not for sn_codesearch. To allow it, run:
|
|
1201
|
+
servicenow-mcp-setup grant --profile <profile> --read sys_script_include --tools
|
|
1202
|
+
sn_codesearch`. `--tools` adds to the tools a table already has, so that command
|
|
1203
|
+
removes nothing. The message names only the table and the tool of that call,
|
|
1204
|
+
never the rest of the profile's rules.
|
|
1122
1205
|
|
|
1123
1206
|
Allowlist entries may be exact table names or the literal `*` to allow every
|
|
1124
1207
|
table for that operation. Table names are trimmed, lowercased, deduplicated,
|
|
@@ -1291,8 +1374,8 @@ The same policy in the list form:
|
|
|
1291
1374
|
`cmdb_ci_computer`, `kb_knowledge`.
|
|
1292
1375
|
- **Every table without a built-in entry:** `u_*` and `x_*` tables, and
|
|
1293
1376
|
platform tables such as `change_task` and `sys_properties`.
|
|
1294
|
-
- **The
|
|
1295
|
-
`sys_script_client`, `sys_ui_script`, `sys_ws_operation`, `sys_user`,
|
|
1377
|
+
- **The 24 system tables:** `sys_script`, `sys_script_include`,
|
|
1378
|
+
`sys_script_client`, `sys_ui_script`, `sys_ws_operation`, `sys_module`, `sys_user`,
|
|
1296
1379
|
`sys_user_group`, `sys_user_grmember`, `sys_db_object`, `sys_app`,
|
|
1297
1380
|
`sys_store_app`, `v_plugin`, `sys_atf_test`, `sys_atf_test_suite`,
|
|
1298
1381
|
`sys_atf_test_suite_test`, `sys_atf_test_result`, `sys_atf_step`,
|
|
@@ -1309,11 +1392,24 @@ projections, trimmed to the effective `readable` set.
|
|
|
1309
1392
|
A `"*"` entry never reaches a system table, named or not: each key comes from
|
|
1310
1393
|
the table's own entry, or else covers every field. The system tables include
|
|
1311
1394
|
the script tables (`sys_script`, `sys_script_include`, `sys_script_client`,
|
|
1312
|
-
`sys_ui_script`, `sys_ws_operation`), whose records hold server- or
|
|
1395
|
+
`sys_ui_script`, `sys_ws_operation`, `sys_module`), whose records hold server- or
|
|
1313
1396
|
client-side code, and the user and group tables (`sys_user`,
|
|
1314
1397
|
`sys_user_group`, `sys_user_grmember`). Name a system table to narrow it, and
|
|
1315
1398
|
grant it in `tableAccess` only deliberately.
|
|
1316
1399
|
|
|
1400
|
+
**Code tables list without their scripts.** A read of `sys_script`,
|
|
1401
|
+
`sys_script_include`, `sys_ui_script`, `sys_script_client` or `sys_ws_operation`
|
|
1402
|
+
that names no `fields` returns identifiers and metadata, not the script body, so
|
|
1403
|
+
a page of them is not cut short by a few large bodies. For `sys_script_include`
|
|
1404
|
+
that is `sys_id`, `name`, `api_name`, `active` and `sys_updated_on`; the others
|
|
1405
|
+
keep `sys_id`, `name`, `active`, `sys_updated_on` and what identifies them
|
|
1406
|
+
(`collection` and `when` for a business rule, `table` and `type` for a client
|
|
1407
|
+
script, `http_method` and `relative_path` for a scripted REST operation, `global`
|
|
1408
|
+
for a UI script). The body is one named field away, and `fields=all` and
|
|
1409
|
+
`response_format: "detailed"` still include it:
|
|
1410
|
+
`sn_query {table: "sys_script_include", fields: "sys_id,name,script"}`. A profile
|
|
1411
|
+
that states its own `defaults` for one of these tables keeps them.
|
|
1412
|
+
|
|
1317
1413
|
**Read-only profiles.** A `"*"` entry with `writable: []` does not make a
|
|
1318
1414
|
profile read-only, because it never reaches the system tables. To make a
|
|
1319
1415
|
profile read-only, grant no writes: `tableAccess.writeTables: []`, or
|
package/dist/client.d.ts
CHANGED
|
@@ -20,6 +20,9 @@ import { type AtfFormInput } from "./atf-form.js";
|
|
|
20
20
|
import { CallMetrics, type CacheOutcome } from "./call-metrics.js";
|
|
21
21
|
import { ServiceNowConfig } from "./config.js";
|
|
22
22
|
import { AuthProvider } from "./auth.js";
|
|
23
|
+
import { BASIC_AUTH_401_HINT } from "./tool-error.js";
|
|
24
|
+
import { ServiceNowResponseTooLargeError, isServiceNowResponseTooLarge } from "./response-too-large.js";
|
|
25
|
+
export { ServiceNowResponseTooLargeError, isServiceNowResponseTooLarge };
|
|
23
26
|
/** @deprecated Inspect trusted tool-error provenance instead of raw fields. */
|
|
24
27
|
export type ServiceNowError = Error;
|
|
25
28
|
type ParsedJson = Awaited<ReturnType<Response["json"]>>;
|
|
@@ -71,8 +74,8 @@ export declare const MAX_CUMULATIVE_UPSTREAM_JSON_BYTES: number;
|
|
|
71
74
|
export declare const MAX_CUMULATIVE_RAW_RESPONSE_BYTES: number;
|
|
72
75
|
export declare const DEFAULT_MAX_JSON_RESPONSE_BYTES: number;
|
|
73
76
|
export declare const MAX_ERROR_RESPONSE_BYTES: number;
|
|
74
|
-
/** Guidance
|
|
75
|
-
export
|
|
77
|
+
/** Guidance carried by 401 errors on basic-auth profiles (fixed text). */
|
|
78
|
+
export { BASIC_AUTH_401_HINT };
|
|
76
79
|
export declare const DEFAULT_MAX_CONCURRENT_REQUESTS = 4;
|
|
77
80
|
/**
|
|
78
81
|
* Bind one immutable execution-context signal and fresh atomic upstream byte
|
|
@@ -147,16 +150,6 @@ export declare class ServiceNowClient {
|
|
|
147
150
|
* {@link CallMetrics}); the timing never alters, delays or retries a request.
|
|
148
151
|
*/
|
|
149
152
|
export declare function createServiceNowOperations(client: ServiceNowOperations): ServiceNowOperations;
|
|
150
|
-
/**
|
|
151
|
-
* A response, or a request scope's cumulative upstream JSON, passed its byte
|
|
152
|
-
* limit. A RangeError, as before, so existing handling is unchanged; the
|
|
153
|
-
* class lets callers tell it apart from any other RangeError.
|
|
154
|
-
*/
|
|
155
|
-
export declare class ServiceNowResponseTooLargeError extends RangeError {
|
|
156
|
-
constructor(message: string);
|
|
157
|
-
}
|
|
158
|
-
/** True when a request failed because a response or its scope passed a byte limit. */
|
|
159
|
-
export declare function isServiceNowResponseTooLarge(error: unknown): boolean;
|
|
160
153
|
/** True when a request failed because its caller cancelled it. */
|
|
161
154
|
export declare function isServiceNowRequestCancellation(error: unknown): boolean;
|
|
162
155
|
/**
|
|
@@ -171,5 +164,4 @@ export declare function parseRetryAfterMs(value: string | null): number | undefi
|
|
|
171
164
|
* MAX_RETRY_DELAY_MS either way.
|
|
172
165
|
*/
|
|
173
166
|
export declare function retryDelayMs(retryAfter: string | null, attempt: number, baseDelayMs: number): number;
|
|
174
|
-
export {};
|
|
175
167
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAsD,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAoB,MAAM,mBAAmB,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAsB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAsD,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAoB,MAAM,mBAAmB,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAsB,MAAM,WAAW,CAAC;AAE7D,OAAO,EAKL,mBAAmB,EAIpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC7B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,+BAA+B,EAAE,4BAA4B,EAAE,CAAC;AAEzE,+EAA+E;AAC/E,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC;AAEpC,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAExD,4EAA4E;AAC5E,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,UAAU;IAC3C,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,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