@onlyflows/servicenow-mcp 2.3.0-dev.1 → 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 +447 -3
- package/README.md +241 -11
- package/dist/call-metrics.d.ts +42 -0
- package/dist/call-metrics.d.ts.map +1 -0
- package/dist/call-metrics.js +89 -0
- package/dist/call-metrics.js.map +1 -0
- package/dist/client.d.ts +18 -14
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +51 -36
- 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/encoded-query-policy.d.ts +9 -0
- package/dist/encoded-query-policy.d.ts.map +1 -1
- package/dist/encoded-query-policy.js +19 -1
- package/dist/encoded-query-policy.js.map +1 -1
- 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/http-runtime.js +16 -0
- package/dist/http-runtime.js.map +1 -1
- package/dist/metadata-cache.d.ts +97 -7
- package/dist/metadata-cache.d.ts.map +1 -1
- package/dist/metadata-cache.js +284 -21
- 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-prompts.js +1 -1
- package/dist/setup-prompts.js.map +1 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +28 -4
- package/dist/setup.js.map +1 -1
- package/dist/structured-query.d.ts +61 -2
- package/dist/structured-query.d.ts.map +1 -1
- package/dist/structured-query.js +376 -35
- package/dist/structured-query.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 +536 -67
- package/dist/tools/codesearch.js.map +1 -1
- package/dist/tools/flow-view-contracts.d.ts +2 -2
- package/dist/tools/flow-view-module.js +1 -1
- package/dist/tools/flow-view-module.js.map +1 -1
- package/dist/tools/get-module.js +1 -1
- package/dist/tools/get-module.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +37 -13
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/query-module.d.ts.map +1 -1
- package/dist/tools/query-module.js +230 -63
- package/dist/tools/query-module.js.map +1 -1
- package/dist/tools/result-envelope.d.ts +313 -2
- package/dist/tools/result-envelope.d.ts.map +1 -1
- package/dist/tools/result-envelope.js +334 -33
- package/dist/tools/result-envelope.js.map +1 -1
- package/dist/tools/schema-module.d.ts.map +1 -1
- package/dist/tools/schema-module.js +1 -1
- package/dist/tools/schema-module.js.map +1 -1
- package/dist/tools/truncation-hint.d.ts +125 -0
- package/dist/tools/truncation-hint.d.ts.map +1 -0
- package/dist/tools/truncation-hint.js +298 -0
- package/dist/tools/truncation-hint.js.map +1 -0
- 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 +22 -1
- package/docs/PRODUCTION-SECURITY.md +21 -1
- package/docs/V2-MIGRATION.md +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,452 @@ 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
|
+
|
|
197
|
+
## [2.3.0-dev.2] — 2026-11-15
|
|
198
|
+
|
|
199
|
+
### Added
|
|
200
|
+
|
|
201
|
+
- **`sn_query` reads `structured_query.filter` given as a list as an implicit
|
|
202
|
+
AND.** `filter: [c1, c2]` means `{type: "group", operator: "and",
|
|
203
|
+
conditions: [c1, c2]}`, and a one-element list means that element. The
|
|
204
|
+
existing limit of 3 nested group levels is unchanged: a list of two or more
|
|
205
|
+
takes one level, so a list that holds a 3-level group is rejected, and the
|
|
206
|
+
error says so. An empty list is rejected with its own message. A list is read
|
|
207
|
+
this way only as the top-level `filter` and only by `sn_query`: `sn_batch`
|
|
208
|
+
write filters stay one object, so a mutation never selects records through a
|
|
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`.**
|
|
211
|
+
`sn_query`'s `filter` says a list is read as AND and shows one, and the
|
|
212
|
+
`sn_query` description gains a one-line example with the OR group form.
|
|
213
|
+
`sn_batch`'s `filter` has its own text: one condition or group, and a list is
|
|
214
|
+
not accepted, because a mutation never selects records through a list. Its
|
|
215
|
+
example filters on `sys_id`, a field every table has: an example on a field
|
|
216
|
+
such as `name` would match every row of a table without that column, since
|
|
217
|
+
ServiceNow drops a condition on a field the table lacks. Costs 605 characters
|
|
218
|
+
in `tools/list` (`sn_query` +459, `sn_batch` +146).
|
|
219
|
+
- **Responses say whether the metadata cache was used and where the time went.** `structuredContent.metadata` gains two optional fields. `cache` is
|
|
220
|
+
`hit`, `miss`, `bypass` (a `force_recache` refresh) or `mixed` (several
|
|
221
|
+
cacheable reads with different outcomes, such as an `sn_codesearch` with no
|
|
222
|
+
`table`), and is absent when the call read no cacheable table. `timing` is
|
|
223
|
+
`{ total_ms, upstream_ms, watermark_ms }` in whole milliseconds, wall-clock:
|
|
224
|
+
`upstream_ms` and `watermark_ms` are the time at least one request of that
|
|
225
|
+
kind was in flight, so overlapping requests count once. Only the server sets
|
|
226
|
+
them (a value a tool supplies is discarded), and they are not counted
|
|
227
|
+
against the result's byte limit, so they never cost a record and are never
|
|
228
|
+
dropped (see the entry on truncated responses below). Every tool's
|
|
229
|
+
`outputSchema` grows by 322 characters (7,728 in `tools/list`). Cache
|
|
230
|
+
behaviour is unchanged.
|
|
231
|
+
|
|
232
|
+
### Fixed
|
|
233
|
+
|
|
234
|
+
- **`sn_query` no longer fails with an internal error at the smallest byte
|
|
235
|
+
budgets (a regression from the labelled hint).** A truncated read
|
|
236
|
+
at `max_response_bytes` 1000 with a wide row (eight fields including a long
|
|
237
|
+
`description`, limit 50) returned `The operation failed unexpectedly` every
|
|
238
|
+
time: the envelope's metadata leaves room for little beside the counts at
|
|
239
|
+
that budget, and the fuller labelled hint no longer fitted even with no row.
|
|
240
|
+
When no row fits beside the whole hint, the fit now leaves out the
|
|
241
|
+
whole-page figure and then the field advice, keeping the next-row figure, so
|
|
242
|
+
the result is a normal truncated one (`has_more: true`, no `next_offset`,
|
|
243
|
+
`recovery` set, a hint that parses and equals `dropped_records`). The hint
|
|
244
|
+
never names a value above the effective maximum.
|
|
245
|
+
- **A truncation hint says which `max_response_bytes` is for the next row and
|
|
246
|
+
which for the whole page.** The hint's budget was measured for the
|
|
247
|
+
next row only, but a bare `max_response_bytes=1500` read as a value for the
|
|
248
|
+
page: live, a 50-row read at 1000 bytes said 1500 and following it returned
|
|
249
|
+
one row. The hint now reads `... or max_response_bytes=1500 (fits the next
|
|
250
|
+
row) or max_response_bytes=15400 (fits all 50)`. The page figure is measured
|
|
251
|
+
the same way as the next-row one, is never smaller than it, and is left out
|
|
252
|
+
when the page would exceed the effective maximum (1,000,000, or a raw-read
|
|
253
|
+
rule's `maxResponseBytes`) and when one row was dropped (the next row is then
|
|
254
|
+
the rest of the page). The bare figure is gone, so a client that matched
|
|
255
|
+
`max_response_bytes=<n>.` at the end of the hint must match the labelled
|
|
256
|
+
form; the count still equals `dropped_records`, and the hint stays within its
|
|
257
|
+
600 characters. `sn_schema`'s `fields_only` text now says it lists the
|
|
258
|
+
table's own fields only, and that inherited fields need the full schema; it
|
|
259
|
+
costs 68 characters in `tools/list` (`sn_schema` 3518 to 3586, total 128190
|
|
260
|
+
to 128258).
|
|
261
|
+
- **The list form of `structured_query.filter` is in the published `tools/list`
|
|
262
|
+
schema, and `tools/list` is smaller.** `sn_query` read a list filter,
|
|
263
|
+
and its descriptions tell clients to send one, but the schema it published
|
|
264
|
+
had no array option, so a client that validates arguments against it (ajv)
|
|
265
|
+
rejected the documented example. The list is now an explicit branch of the
|
|
266
|
+
schema, 1 to 32 conditions. The filter union and the leaf-condition union
|
|
267
|
+
are published once per tool, under `definitions`, and referred to with
|
|
268
|
+
`$ref`, where each use used to be written out again; every `$ref` resolves
|
|
269
|
+
inside the same tool's `inputSchema`; the definitions are named
|
|
270
|
+
`StructuredQueryFilter` and `StructuredQueryCondition`, so clients that merge
|
|
271
|
+
`definitions` across tools or servers do not collide. `sn_batch` shares them
|
|
272
|
+
and still publishes no array option, and a list is still rejected there.
|
|
273
|
+
Behaviour is unchanged: the error messages (including the specific one
|
|
274
|
+
for a bad field name, a control character or an over-long value inside a
|
|
275
|
+
list element, which now names the caller's own position, `filter[1].field`,
|
|
276
|
+
and not a position inside the wrapper group) and the nesting rule (a list of
|
|
277
|
+
two or more takes one group level) are as before. One difference stays between the
|
|
278
|
+
schema and the server: the schema cannot say that a list of two or more
|
|
279
|
+
takes a level, so it accepts a list that holds a 3-level group, which the
|
|
280
|
+
server rejects. `tools/list`: `sn_query` 16,574 to 10,183 characters,
|
|
281
|
+
`sn_batch` 14,818 to 8,328, the whole list 140,887 to 128,006 (the part a
|
|
282
|
+
model reads, without output schemas, 52,641 to 39,760). This delivers most of
|
|
283
|
+
the filter dedupe that was asked for; stripping the bounds the server enforces
|
|
284
|
+
anyway, and sharing the scalar value union, are not done. Clients that do not
|
|
285
|
+
resolve `$ref` to `definitions` are not served by this form, and a client that
|
|
286
|
+
dereferences `$ref` before it validates or shows the schema sees `sn_query` at
|
|
287
|
+
about 22.8k characters (the list option written out), against about 13.7k
|
|
288
|
+
before this change.
|
|
289
|
+
- **Truncated responses keep `metadata.cache` and `metadata.timing`.**
|
|
290
|
+
The two fields were added only when the finished response still fit
|
|
291
|
+
`max_response_bytes`, so a response fitted to within about 90 bytes of its
|
|
292
|
+
limit lost them, on exactly the calls where the timing helps most. They are
|
|
293
|
+
no longer counted against the limit: the fit and the truncation hint's numbers
|
|
294
|
+
(see the entries on `has_more` and on the hint's values) are unchanged, and a successful response always carries both. It
|
|
295
|
+
can exceed `max_response_bytes` by their size, under 100 bytes. The
|
|
296
|
+
`max_response_bytes` description of `sn_query`, `sn_get` and `sn_flow_view`
|
|
297
|
+
says so (about 61 characters each in `tools/list`).
|
|
298
|
+
- **A rejected `structured_query.filter` names the mistake.** A bad
|
|
299
|
+
operator, an unknown or missing `type`, a bad group, a missing key, a value of
|
|
300
|
+
the wrong kind or a group nested too deep used to get the same shape message,
|
|
301
|
+
even when the condition sat inside a group. The message now says the first
|
|
302
|
+
thing wrong, in fixed words, with an index path, for example `filter.conditions[1]:
|
|
303
|
+
a "text" condition needs operator one of contains, not_contains, starts_with,
|
|
304
|
+
ends_with`, `type must be one of equality, set, range, text, null, group` and
|
|
305
|
+
`a group needs operator and or or, and a non-empty conditions list`, followed
|
|
306
|
+
by the working example. A list filter on `sn_query` is reported at the
|
|
307
|
+
caller's own position (`filter[1]`); `sn_batch` gives the same text and still
|
|
308
|
+
says a list is not accepted. Nothing the caller sent is repeated, and a
|
|
309
|
+
condition type is quoted only when it is one of the known type names. The
|
|
310
|
+
shape message remains for anything the walk cannot name. `tools/list` is
|
|
311
|
+
byte-identical.
|
|
312
|
+
- **The `sn_query` truncation hint gives values to use.** The
|
|
313
|
+
`max_response_bytes` description promised exact follow-up arguments, but the
|
|
314
|
+
hint said "a lower limit" and "a higher max_response_bytes" with no numbers,
|
|
315
|
+
and a caller who chose their own `fields` got no field advice. The hint now
|
|
316
|
+
reads like `Dropped 14/22; continue offset=8 limit=8; retry offset=0 with
|
|
317
|
+
fields="sys_id,name" or max_response_bytes=31500.` The `limit` is the number
|
|
318
|
+
of rows that fit. The `max_response_bytes` is measured where the envelope
|
|
319
|
+
refits the result, with its own cost in it, and holds at least the next row;
|
|
320
|
+
if no budget up to 1,000,000 (or up to the `maxResponseBytes` of the raw-read
|
|
321
|
+
rule that approved a raw `query`, when that is lower) could, the hint says
|
|
322
|
+
the next row exceeds that maximum, names it, and offers fields and `sn_get`. A caller's own `fields` list is offered back without its large
|
|
323
|
+
fields (such as `script`); a list with none gets the `limit` and the budget,
|
|
324
|
+
and a read of `fields=all` gets the table's short default list. Only fields
|
|
325
|
+
the profile may read are named, never a sensitive one. The count still equals
|
|
326
|
+
`dropped_records` and the hint stays within 600 characters. The
|
|
327
|
+
`max_response_bytes` description now names what the hint carries (5
|
|
328
|
+
characters shorter; `tools/list` `sn_query` 16,579 to 16,574).
|
|
329
|
+
- **`sn_query` no longer stops paging after page 2.** The tool sends
|
|
330
|
+
`sysparm_no_count`, so ServiceNow's `X-Total-Count` header holds the size of
|
|
331
|
+
the response (the page plus the one sentinel row), not the table. The handler
|
|
332
|
+
trusted it: `total` echoed the rows fetched, and `has_more` turned false from
|
|
333
|
+
page 2 on, with thousands of rows unread. `has_more` and `next_offset` now
|
|
334
|
+
come from the sentinel row alone, so they stay true until the last page.
|
|
335
|
+
**`total` is no longer returned by `sn_query`** (the output schema already
|
|
336
|
+
made it optional); counting would need a COUNT query on every call, which
|
|
337
|
+
`sysparm_no_count` exists to avoid. Page on `has_more` and `next_offset`, or
|
|
338
|
+
call `sn_aggregate` with `COUNT` when the table size matters. If ServiceNow
|
|
339
|
+
ACLs strip rows from a page, `has_more` can read false early; cross-check
|
|
340
|
+
with `sn_aggregate` `COUNT`.
|
|
341
|
+
- **A read grant now allows code search.** `servicenow-mcp-setup grant
|
|
342
|
+
--read <table>` binds `sn_codesearch` along with `sn_query`, `sn_get`,
|
|
343
|
+
`sn_aggregate` and `sn_schema`, so `--read sys_script_include` is enough to
|
|
344
|
+
search script includes; before, every code search on such a profile was
|
|
345
|
+
denied unless `--tools sn_codesearch` was passed. It is checked per code
|
|
346
|
+
table (`sys_script`, `sys_script_include`, `sys_ui_script`,
|
|
347
|
+
`sys_script_client`, `sys_ws_operation`), does nothing on other tables, and
|
|
348
|
+
field policy still decides the script field exactly as it does for
|
|
349
|
+
`sn_query`. **Profiles saved before this change are not rewritten:** a target
|
|
350
|
+
keeps the tool list it was saved with, so run `servicenow-mcp-setup grant
|
|
351
|
+
--profile <name> --read <code table>` again to add the default tools, or add
|
|
352
|
+
just this one with `--tools sn_codesearch`. Neither removes a tool.
|
|
353
|
+
- **A truncation hint on `sn_query` no longer disagrees with `dropped_records`,
|
|
354
|
+
and suggests fields the table has.** A read cut to fit
|
|
355
|
+
`max_response_bytes` is trimmed in two steps, and the second could drop more
|
|
356
|
+
rows than the hint's "Dropped n/m" said. The hint is now restated from the
|
|
357
|
+
final result, so its count, its empty-result advice and its continuation
|
|
358
|
+
match `dropped_records`, `has_more` and `next_offset`. The suggested
|
|
359
|
+
projection was always `fields="sys_id,number"`, wrong for any table without
|
|
360
|
+
a `number` column. It is now the table's default fields without large ones
|
|
361
|
+
such as `script`, at most three; if that leaves only `sys_id`, `sys_id` and a
|
|
362
|
+
display field the profile's field policy names, else `sys_id` alone. A call
|
|
363
|
+
that passed its own `fields` is told to lower `limit` or raise
|
|
364
|
+
`max_response_bytes` instead of being given a field list.
|
|
365
|
+
- **A rejected `structured_query.filter` now says what is accepted.**
|
|
366
|
+
Every mistake used to read "Invalid input at structured_query.filter". The
|
|
367
|
+
message now says the filter is one condition or group object, gives a working
|
|
368
|
+
example, shows how to combine conditions with a group, and states the limit
|
|
369
|
+
of 3 nested group levels. It adds nothing to `tools/list`.
|
|
370
|
+
|
|
371
|
+
### Changed
|
|
372
|
+
|
|
373
|
+
- **A repeated read of a small cached-table response is one request, not a
|
|
374
|
+
watermark and a read.** A cache hit costs one watermark round trip, so
|
|
375
|
+
for a small response a hit cost about what a plain read did and a miss cost
|
|
376
|
+
two requests. A read of a cacheable table whose response is under 32 KiB is
|
|
377
|
+
no longer kept: the selector is remembered as small, per credential scope,
|
|
378
|
+
for one cache TTL (at most 512 selectors, least recently used out), and its
|
|
379
|
+
later reads go straight to ServiceNow with no watermark. `metadata.cache`
|
|
380
|
+
says `miss` for them; `bypass` stays for `force_recache`. A direct read that
|
|
381
|
+
comes back at 32 KiB or more forgets the mark, so the selector is cached
|
|
382
|
+
from the next read. Responses of 32 KiB and up are cached, checked and
|
|
383
|
+
bounded as before. Measured on a dev instance: a 6 KB read 490 ms before (a
|
|
384
|
+
hit), 81 ms after; a 17 KB read 489 ms before, 98 ms. The threshold is a
|
|
385
|
+
size, not a time: `sys_dictionary` there has a watermark of about 0.5 s, and
|
|
386
|
+
even a 66 KB read was faster uncached. `metadataCache.smallReadBytes` sets
|
|
387
|
+
the threshold per profile (0 keeps every response).
|
|
388
|
+
- **`has_more` and `next_offset` count rows dropped for size. Contract
|
|
389
|
+
change for truncated pages.** A page cut to fit `max_response_bytes` kept
|
|
390
|
+
`has_more` and `next_offset` for the rows beyond the page, so a client that
|
|
391
|
+
followed `next_offset` skipped every dropped row, and a cut last page said
|
|
392
|
+
`has_more: false` with `record_count: 0`. Now `record_count`, `truncated` and
|
|
393
|
+
`dropped_records` keep their meaning, and:
|
|
394
|
+
- `has_more` is true when rows were dropped for size **or** rows exist past
|
|
395
|
+
the page: rows exist that the response did not contain.
|
|
396
|
+
- `next_offset` is `offset + record_count` when at least one row came back:
|
|
397
|
+
the first row not returned. A client that only follows it re-reads the
|
|
398
|
+
dropped rows and loses nothing.
|
|
399
|
+
- When no row fit, `next_offset` is omitted and `metadata.pagination.recovery`
|
|
400
|
+
is `adjust_request_and_retry_same_offset`: `has_more: true` with no
|
|
401
|
+
`next_offset` means the request must change (fewer `fields`, a lower
|
|
402
|
+
`limit`, or a higher `max_response_bytes`). The pagination output schema
|
|
403
|
+
accepts `has_more` without `next_offset` only with `recovery`.
|
|
404
|
+
- The old post-page continuation is gone from the hint; `next_offset` covers
|
|
405
|
+
it. A page that lost no rows to size is unchanged.
|
|
406
|
+
|
|
407
|
+
Applies to every list tool that fits through the shared envelope:
|
|
408
|
+
`sn_query`, `sn_syslog`, `sn_schema`, `sn_relationships`, `sn_codesearch`,
|
|
409
|
+
`sn_discover`, `sn_attach` (list) and `sn_atf` continue at `offset + rows
|
|
410
|
+
returned`; any other cut collection (for example `sn_aggregate`) reports
|
|
411
|
+
`has_more: true` with no `next_offset`. This also stops a byte drop made only
|
|
412
|
+
by the envelope from skipping the dropped row when `next_offset` is
|
|
413
|
+
followed, and the tool's "More records available. Call sn_query again with
|
|
414
|
+
offset=N." hint is restated at `next_offset` (or says no row fit), so it never
|
|
415
|
+
contradicts it; the envelope's `truncated`/`dropped_records` flags in `data` are not
|
|
416
|
+
added here. See the README, "Paging when a response is cut to size".
|
|
417
|
+
- **Code tables are in the default metadata cache.** `sys_script`,
|
|
418
|
+
`sys_script_include`, `sys_ui_script`, `sys_script_client` and
|
|
419
|
+
`sys_ws_operation` now cache like the other system-level metadata tables,
|
|
420
|
+
under the same per-credential scope and watermark freshness, so a repeated
|
|
421
|
+
`sn_codesearch` or `sn_query` of them skips the payload while the table is
|
|
422
|
+
unchanged (one watermark read still runs per call). A profile that sets its
|
|
423
|
+
own `metadataCache.tables` or `SN_METADATA_CACHE_TABLES` replaces the default
|
|
424
|
+
list and must name these tables to cache them. `sn_codesearch` has no
|
|
425
|
+
`force_recache` flag. `sn_get` of a record in these tables is cached too, and
|
|
426
|
+
a cold one costs 2 requests (a watermark read, then the record); `sn_batch`
|
|
427
|
+
and `sn_aggregate` reads are not cached. The cache is also bounded by bytes
|
|
428
|
+
now: a response over 512 KiB is not kept, each credential scope holds at most
|
|
429
|
+
32 MiB and the whole cache 128 MiB (least recently used out first), and
|
|
430
|
+
expired entries are dropped as new ones are stored. A no-table
|
|
431
|
+
`sn_codesearch` reads its five tables concurrently, within the client's
|
|
432
|
+
existing request limit. Cached code-table entries hold full script bodies,
|
|
433
|
+
which can contain hard-coded credentials, in process memory (never on disk)
|
|
434
|
+
for up to the TTL; to keep them out, set `metadataCache.tables` or
|
|
435
|
+
`SN_METADATA_CACHE_TABLES` to
|
|
436
|
+
`sys_glide_object,sys_dictionary,sys_db_object,sys_app,sys_plugins,sys_metadata*,sys_flow*`.
|
|
437
|
+
|
|
438
|
+
### Security
|
|
439
|
+
|
|
440
|
+
- **HTTP transport rejects a backslash in the request path.** A request whose
|
|
441
|
+
raw path (the part before `?` or `#`) contains a literal `\` now gets
|
|
442
|
+
`400 Bad Request`, on every route including the health paths. The WHATWG URL
|
|
443
|
+
parser reads `\` as `/` and resolves `..`, so `/x/..\mcp` or `//h\mcp` would
|
|
444
|
+
otherwise pass our path check as `/mcp`; until now only the
|
|
445
|
+
`@hono/node-server` dependency inside the MCP SDK transport refused the ones
|
|
446
|
+
that reached `/mcp`, and the health paths answered them. Backslashes in the
|
|
447
|
+
query string and a percent-encoded `%5C` behave as before.
|
|
448
|
+
|
|
449
|
+
## [2.3.0-rc.1] — 2026-11-14
|
|
450
|
+
|
|
451
|
+
Release candidate for 2.3.0, published to the `next` dist-tag. It contains the
|
|
452
|
+
changes listed under 2.3.0-dev.1 below and nothing else.
|
|
453
|
+
|
|
8
454
|
## [2.3.0-dev.1] — 2026-11-14
|
|
9
455
|
|
|
10
456
|
### Added
|
|
@@ -201,9 +647,7 @@ parentheses are the pull requests that made each change.
|
|
|
201
647
|
`io.github.onlyflowstech/servicenow-mcp`, and the package ships the
|
|
202
648
|
`server.json` manifest for the official MCP Registry. (#14)
|
|
203
649
|
- The README leads with what the server controls and what it does not, lists
|
|
204
|
-
the tools by area, and documents per-profile field policy.
|
|
205
|
-
describes how contributors' AI agents work in this repository. (#11, #13,
|
|
206
|
-
#14)
|
|
650
|
+
the tools by area, and documents per-profile field policy. (#11, #13, #14)
|
|
207
651
|
- From the 2.2.0 dev builds: the ATF tools `sn_atf_author`, `sn_atf_run`,
|
|
208
652
|
`sn_atf_results` and `sn_atf_readiness`, with `setup grant --atf`;
|
|
209
653
|
Windows support in `servicenow-mcp-setup`; and the npm `dev` channel for
|