iit-mcp-autotask 0.63.14 → 0.63.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +5 -0
- package/README.md +14 -3
- package/capabilities.json +1 -1
- package/dist/config/schema.d.ts +6 -0
- package/dist/config/schema.js +10 -0
- package/dist/tools/catalog-data.d.ts +1 -1
- package/dist/tools/catalog-data.js +2 -2
- package/dist/tools/composites.js +7 -1
- package/dist/tools/lists.d.ts +1 -0
- package/dist/tools/lists.js +47 -13
- package/dist/tools/query-budget.d.ts +16 -0
- package/dist/tools/query-budget.js +58 -0
- package/dist/tools/results/untrusted.d.ts +8 -0
- package/dist/tools/results/untrusted.js +11 -3
- package/dist/tools/schemas.d.ts +1 -0
- package/dist/tools/schemas.js +2 -1
- package/package.json +2 -2
- package/server.json +2 -2
- package/skills/asset-inventory.md +6 -6
- package/skills/slim-reads.md +5 -3
package/.env.example
CHANGED
|
@@ -104,6 +104,11 @@ AUTOTASK_CACHE=on
|
|
|
104
104
|
# symlink escape is refused BEFORE anything is created. See README, Query results.
|
|
105
105
|
# AUTOTASK_OUTPUT_DIR=/srv/autotask-output
|
|
106
106
|
|
|
107
|
+
# --- autotask_query response budget ---
|
|
108
|
+
# Rows answers (JSON or tsv) larger than this many bytes are cut to the longest whole-row prefix that
|
|
109
|
+
# fits (hasMore, bytesCapped). 16384 to 4194304; unset = 262144 (256 KiB).
|
|
110
|
+
# AUTOTASK_QUERY_MAX_BYTES=262144
|
|
111
|
+
|
|
107
112
|
# --- HTTP hardening (http transport only) ---
|
|
108
113
|
# Bind address (the --host flag): 127.0.0.1 by default. Off loopback, the two settings below are
|
|
109
114
|
# required or boot fails.
|
package/README.md
CHANGED
|
@@ -57,9 +57,10 @@ examples; `full: true` serves the complete record, `summary: true` about 2 KB),
|
|
|
57
57
|
refusal; no parent match is an empty result with a `relationNote`), in rows, counts and totals.
|
|
58
58
|
On a relation target itself (`ticket.<field>` on `tickets`, `task.<field>` on `tasks`,
|
|
59
59
|
`project.<field>` on `projects`) the prefix is dropped: the own field (0.38.1, #234). Rows on
|
|
60
|
-
`tickets` and `
|
|
61
|
-
`DEFAULT_COLUMNS` in `src/tools/lists.ts`; 0.38.1, #235
|
|
62
|
-
`resolution`, `internalNotes
|
|
60
|
+
`tickets`, `time_entries` and `configuration_items` without `include_fields` carry default columns
|
|
61
|
+
(18 / 13 / 14, `DEFAULT_COLUMNS` in `src/tools/lists.ts`; 0.38.1, #235; configuration items #451):
|
|
62
|
+
name any other field (`description`, `resolution`, `internalNotes`, a configuration item's `notes`
|
|
63
|
+
or RMM columns) in `include_fields`. `output_path` and `autotask_read` of
|
|
63
64
|
`<resource>.query` keep the full row.
|
|
64
65
|
The separate `autotask_aggregate` and `autotask_fetch_many` tools are removed (#228, 0.37.0); a
|
|
65
66
|
mixed-resource batch by id is `autotask_read` `operations.fetchByIds`. The served filter
|
|
@@ -324,6 +325,15 @@ A supported per-call `names: false` disables them; composite `max_name_reads` st
|
|
|
324
325
|
query, or the `output_path` 10,000-row cap — and `pagesWalked` counts the pages fetched. `count` is never served — the vendor documents it as the CURRENT page's
|
|
325
326
|
count, so a total rides `<resource>.count`.
|
|
326
327
|
|
|
328
|
+
**Response byte budget** (#451): a rows answer (JSON or `format: 'tsv'`) is at most
|
|
329
|
+
`AUTOTASK_QUERY_MAX_BYTES` (default 256 KiB), measured on the finished tool result the client receives
|
|
330
|
+
(the envelope and its mirrored text block, after the untrusted marking). A larger answer is cut to the
|
|
331
|
+
longest whole-row prefix that fits: `hasMore: true`, `fetched` (or the TSV `rowCount`) is the rows
|
|
332
|
+
served, and `bytesCapped: { maxBytes, rowsReturned, rowsFetched }` says so; the summary steers to
|
|
333
|
+
`count` / `group_by` for totals, `include_fields` for fewer columns and, on stdio with an output root (`AUTOTASK_OUTPUT_DIR` or `AUTOTASK_STATE_DIR`), `output_path` for
|
|
334
|
+
the full set. A row is never cut in half and the other envelope fields stay. An answer within the
|
|
335
|
+
budget is unchanged. Totals mode, `output_path` and `autotask_read` are not capped by it.
|
|
336
|
+
|
|
327
337
|
**Saved files are the host's job.** Unless you ask for `output_path` (below), this server never
|
|
328
338
|
writes a result file on its own: when a result is too large, the MCP host persists the oversized
|
|
329
339
|
tool result, and the file it writes holds this same envelope as JSON — so a saved result can be read
|
|
@@ -533,6 +543,7 @@ non-zero on an invalid config (fail-fast) instead of failing at the first tool c
|
|
|
533
543
|
| `AUTOTASK_ALLOW_ANY_BASE_HOST` | no | `false` | lab-only opt-in to boot with neither allow-list nor default origin; `warn`-logged at boot (decision D-4); refused with the operator profile. Not set in production. |
|
|
534
544
|
| `AUTOTASK_CACHE` | no | `on` | the single off switch for the SDK's per-tenant in-process caches (see [Per-tenant pool & cache](#per-tenant-pool--cache)): `on` (default) sends no cache block — the SDK's default-on caches apply to each pooled tenant client (read ~5 min + the reference tables at 1 h, field metadata ~5 min, plus the fuzzy company-name index below); `off` sends `cache: false` (every read re-dials the vendor) |
|
|
535
545
|
| `AUTOTASK_OUTPUT_DIR` | no | unset | the ONE directory the `output_path` option may write into (the bounded query tools and the invoice export; stdio transport only). Unset = defaults to `output/` under `AUTOTASK_STATE_DIR` (the feature refuses when neither is set); must be absolute, must already EXIST (the server never creates the root) and must not be the filesystem root. A caller path is relative to this root, and the root and target are canonically resolved (`realpath`) so a traversal or symlink escape is refused — with nothing created outside the root. See [Query results](#query-results-tsv-output_path-and-the-saved-file-shape) |
|
|
546
|
+
| `AUTOTASK_QUERY_MAX_BYTES` | no | 262144 (256 KiB) | the `autotask_query` rows-mode response budget in bytes (16384 to 4194304): a larger answer is cut to the longest whole-row prefix that fits, with `hasMore` and `bytesCapped` (see [Query results](#query-results-tsv-output_path-and-the-saved-file-shape)); totals, `output_path` and `autotask_read` are not capped |
|
|
536
547
|
| `AUTOTASK_RATE_LIMIT_PER_HOUR` | no | 8000 (agent profile) | override the SDK's local hourly allowance (at most 10,000; `null`/off is rejected at boot); the shared SDK origin ceiling remains enforced |
|
|
537
548
|
| `AUTOTASK_MAX_CONCURRENT` | no | 3 (agent profile) | override local aggregate concurrency across objects (1–10); the SDK still caps each object/tracking identifier at three active requests |
|
|
538
549
|
| `AUTOTASK_TIMEOUT_MS` | no | 20000 (agent profile) | whole-call budget |
|
package/capabilities.json
CHANGED
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
},
|
|
267
267
|
{
|
|
268
268
|
"id": "autotask.configuration_item.profile",
|
|
269
|
-
"description": "One configuration item (asset/device) with type, category, notes, related items and
|
|
269
|
+
"description": "One configuration item (asset/device) with type, category, product, notes, related items, billing products and its software or licence subscriptions. Product and subscriptions degrade to unavailable without read access.",
|
|
270
270
|
"mcpPrimitive": "tool",
|
|
271
271
|
"toolName": "autotask_configuration_item_profile",
|
|
272
272
|
"type": "read",
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -18,6 +18,10 @@ export declare const TOOLSETS: readonly ["service", "records", "finance"];
|
|
|
18
18
|
export type Toolset = (typeof TOOLSETS)[number];
|
|
19
19
|
/** The database-wide vendor hourly ceiling; the optional local quota must not exceed it. */
|
|
20
20
|
export declare const VENDOR_HOURLY_CAP = 10000;
|
|
21
|
+
/** `autotask_query` rows-mode response budget (#451): default 256 KiB, bounds 16 KiB to 4 MiB (the Billing Review response cap). */
|
|
22
|
+
export declare const QUERY_MAX_BYTES_DEFAULT: number;
|
|
23
|
+
export declare const QUERY_MAX_BYTES_MIN: number;
|
|
24
|
+
export declare const QUERY_MAX_BYTES_MAX: number;
|
|
21
25
|
/**
|
|
22
26
|
* A run scope: the companies one operator principal may write in this run. `{all: true}` means the
|
|
23
27
|
* policy's own scope; company ids are intersected with it, so a run scope can only narrow.
|
|
@@ -96,6 +100,7 @@ export declare const CONFIG_FIELDS: z.ZodObject<{
|
|
|
96
100
|
off: "off";
|
|
97
101
|
}>>;
|
|
98
102
|
AUTOTASK_OUTPUT_DIR: z.ZodOptional<z.ZodPreprocess<z.ZodString, unknown>>;
|
|
103
|
+
AUTOTASK_QUERY_MAX_BYTES: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
99
104
|
AUTOTASK_RATE_LIMIT_PER_HOUR: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
100
105
|
AUTOTASK_MAX_CONCURRENT: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
101
106
|
AUTOTASK_TIMEOUT_MS: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -154,6 +159,7 @@ export declare const schema: z.ZodObject<{
|
|
|
154
159
|
off: "off";
|
|
155
160
|
}>>;
|
|
156
161
|
AUTOTASK_OUTPUT_DIR: z.ZodOptional<z.ZodPreprocess<z.ZodString, unknown>>;
|
|
162
|
+
AUTOTASK_QUERY_MAX_BYTES: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
157
163
|
AUTOTASK_RATE_LIMIT_PER_HOUR: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
158
164
|
AUTOTASK_MAX_CONCURRENT: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
159
165
|
AUTOTASK_TIMEOUT_MS: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
package/dist/config/schema.js
CHANGED
|
@@ -16,6 +16,10 @@ export const PROFILES = ['readonly', 'operator'];
|
|
|
16
16
|
export const TOOLSETS = ['service', 'records', 'finance'];
|
|
17
17
|
/** The database-wide vendor hourly ceiling; the optional local quota must not exceed it. */
|
|
18
18
|
export const VENDOR_HOURLY_CAP = 10_000;
|
|
19
|
+
/** `autotask_query` rows-mode response budget (#451): default 256 KiB, bounds 16 KiB to 4 MiB (the Billing Review response cap). */
|
|
20
|
+
export const QUERY_MAX_BYTES_DEFAULT = 256 * 1024;
|
|
21
|
+
export const QUERY_MAX_BYTES_MIN = 16 * 1024;
|
|
22
|
+
export const QUERY_MAX_BYTES_MAX = 4 * 1024 * 1024;
|
|
19
23
|
/**
|
|
20
24
|
* A run scope: the companies one operator principal may write in this run. `{all: true}` means the
|
|
21
25
|
* policy's own scope; company ids are intersected with it, so a run scope can only narrow.
|
|
@@ -193,6 +197,12 @@ export const CONFIG_FIELDS = z
|
|
|
193
197
|
* escape is refused before the walk.
|
|
194
198
|
*/
|
|
195
199
|
AUTOTASK_OUTPUT_DIR: blankToUndefined.optional(),
|
|
200
|
+
/**
|
|
201
|
+
* The `autotask_query` rows-mode response budget in bytes (#451), measured on the finished result the
|
|
202
|
+
* client receives; a larger answer is cut to the longest whole-row prefix that fits (`bytesCapped`).
|
|
203
|
+
* Unset = {@link QUERY_MAX_BYTES_DEFAULT}. Totals mode, `output_path` and `autotask_read` are not capped.
|
|
204
|
+
*/
|
|
205
|
+
AUTOTASK_QUERY_MAX_BYTES: z.coerce.number().int().min(QUERY_MAX_BYTES_MIN).max(QUERY_MAX_BYTES_MAX).optional(),
|
|
196
206
|
/**
|
|
197
207
|
* The client-side hourly budget (vendor cap 10,000 req/hour; the `agent` profile default is
|
|
198
208
|
* 8,000). Positive integer only — `null`/off is rejected at boot to retain this lower local
|
|
@@ -108,7 +108,7 @@ export declare function sdkCacheOptions(cache: 'on' | 'off'): Pick<AutotaskConfi
|
|
|
108
108
|
* fails the boot (or the CI test) instead of quietly shipping a tool surface that no longer
|
|
109
109
|
* describes the SDK behind it.
|
|
110
110
|
*/
|
|
111
|
-
export declare const BUILT_AGAINST_PLAN_HASH = "
|
|
111
|
+
export declare const BUILT_AGAINST_PLAN_HASH = "9521525945b1306da363ce5fb38649e17c5526f2c0842da64c3bec7993e62735";
|
|
112
112
|
/**
|
|
113
113
|
* Fail fast when the installed SDK's plan has moved out from under this surface.
|
|
114
114
|
* Called at boot (main.ts) and safe to call repeatedly (pure comparison).
|
|
@@ -143,7 +143,7 @@ export const TOOL_DESCRIPTIONS = {
|
|
|
143
143
|
autotask_service_call_full_profile: 'One service call with its linked tickets, tasks and resource assignments, for on-site visit work. Missing parts degrade to typed absent.',
|
|
144
144
|
autotask_resource_workload: 'A resource\'s open tickets (primary or secondary, de-duplicated), assignments, time off. For "how many" use totals (exact; capped = link cap hit, not row capped; extra reads; totalsAbsent = failed). Missing parts: typed absent.',
|
|
145
145
|
autotask_contact_full_profile: 'One contact with their company and open tickets (closed set from the tenant status picklist). Contains personal data. Missing parts degrade to typed absent.',
|
|
146
|
-
autotask_configuration_item_profile: 'One configuration item (asset/device) with type, category, notes, related items and
|
|
146
|
+
autotask_configuration_item_profile: 'One configuration item (asset/device) with type, category, product, notes, related items, billing products and its software or licence subscriptions. Product and subscriptions degrade to unavailable without read access.',
|
|
147
147
|
autotask_contract_full_profile: 'One contract with services, billing rules, newest charges and service units. Monthly P&L: autotask_read (guide: contract-profitability).',
|
|
148
148
|
autotask_quote_get: 'One quote with its line items in one call. A list of quotes: autotask_read quotes.query.',
|
|
149
149
|
autotask_revenue_rollup: 'Revenue for recurring and fixed price contracts by vertical, company or month, with excluded amounts and coverage. One scope required; full-month windows in the user zone. May take 15-45 seconds. Finance playbook: revenue-rollup.',
|
|
@@ -190,7 +190,7 @@ export function sdkCacheOptions(cache) {
|
|
|
190
190
|
* fails the boot (or the CI test) instead of quietly shipping a tool surface that no longer
|
|
191
191
|
* describes the SDK behind it.
|
|
192
192
|
*/
|
|
193
|
-
export const BUILT_AGAINST_PLAN_HASH = '
|
|
193
|
+
export const BUILT_AGAINST_PLAN_HASH = '9521525945b1306da363ce5fb38649e17c5526f2c0842da64c3bec7993e62735';
|
|
194
194
|
/**
|
|
195
195
|
* Fail fast when the installed SDK's plan has moved out from under this surface.
|
|
196
196
|
* Called at boot (main.ts) and safe to call repeatedly (pure comparison).
|
package/dist/tools/composites.js
CHANGED
|
@@ -104,7 +104,13 @@ export function buildConfigurationItemProfile(ctx) {
|
|
|
104
104
|
operation: 'configuration_items.profile',
|
|
105
105
|
title: 'Get a configuration item with its bounded profile',
|
|
106
106
|
input: closedInput(CONFIGURATION_ITEM_PROFILE_INPUT),
|
|
107
|
-
opts: (a) => bagOf([
|
|
107
|
+
opts: (a) => bagOf([
|
|
108
|
+
['noteLimit', a.note_limit],
|
|
109
|
+
['relatedLimit', a.related_limit],
|
|
110
|
+
['subscriptionLimit', a.subscription_limit],
|
|
111
|
+
['names', a.names],
|
|
112
|
+
['maxNameReads', a.max_name_reads],
|
|
113
|
+
]),
|
|
108
114
|
});
|
|
109
115
|
}
|
|
110
116
|
/** #287: row caps of the phases and tasks parts (exact totals come from the count reads). */
|
package/dist/tools/lists.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { BuiltTool } from './surface.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* #235: the columns a tickets / time_entries row carries when include_fields is absent. A full row is
|
|
5
5
|
* about 4 KB (107 keys with labels) / 2 KB, so 12 tickets cost 50 KB; these cost about a quarter.
|
|
6
|
+
* #451: configuration_items too (a full row has over 100 model fields: Datto, RMM, SSL, domain, UDFs).
|
|
6
7
|
* output_path (a file, not context) and autotask_read of <resource>.query keep the full row.
|
|
7
8
|
*/
|
|
8
9
|
export declare const DEFAULT_COLUMNS: Readonly<Record<string, readonly string[]>>;
|
package/dist/tools/lists.js
CHANGED
|
@@ -13,7 +13,8 @@ import { QUERY_INPUT, QUERY_LIMIT, assertFilterShape, closedInput } from './sche
|
|
|
13
13
|
import { isDeletedActivityAuditResource } from './catalog-data.js';
|
|
14
14
|
import { abortedAnswer, InputInvalidError } from './dispatch.js';
|
|
15
15
|
import { runAggregate } from './aggregate.js';
|
|
16
|
-
import { markResult, markServerField, sanitiseVendorOutput } from './results/untrusted.js';
|
|
16
|
+
import { markResult, markServerField, PROVENANCE, sanitiseVendorOutput } from './results/untrusted.js';
|
|
17
|
+
import { bytesCappedNote, QUERY_MAX_BYTES, withinQueryBudget } from './query-budget.js';
|
|
17
18
|
import { ok } from './results/envelope.js';
|
|
18
19
|
import { toTsv } from './tsv.js';
|
|
19
20
|
import { exportQueryFile, QueryExportIncompleteError } from './query-export.js';
|
|
@@ -32,11 +33,13 @@ const NOUNS = {
|
|
|
32
33
|
/**
|
|
33
34
|
* #235: the columns a tickets / time_entries row carries when include_fields is absent. A full row is
|
|
34
35
|
* about 4 KB (107 keys with labels) / 2 KB, so 12 tickets cost 50 KB; these cost about a quarter.
|
|
36
|
+
* #451: configuration_items too (a full row has over 100 model fields: Datto, RMM, SSL, domain, UDFs).
|
|
35
37
|
* output_path (a file, not context) and autotask_read of <resource>.query keep the full row.
|
|
36
38
|
*/
|
|
37
39
|
export const DEFAULT_COLUMNS = {
|
|
38
40
|
tickets: ['id', 'ticketNumber', 'title', 'status', 'priority', 'issueType', 'subIssueType', 'ticketType', 'queueID', 'companyID', 'contactID', 'assignedResourceID', 'contractID', 'createDate', 'lastActivityDate', 'completedDate', 'dueDateTime', 'estimatedHours'],
|
|
39
41
|
time_entries: ['id', 'ticketID', 'taskID', 'resourceID', 'dateWorked', 'hoursWorked', 'hoursToBill', 'isNonBillable', 'billingCodeID', 'contractID', 'roleID', 'timeEntryType', 'summaryNotes'],
|
|
42
|
+
configuration_items: ['id', 'referenceTitle', 'referenceNumber', 'serialNumber', 'configurationItemType', 'configurationItemCategoryID', 'companyID', 'productID', 'vendorID', 'contractID', 'isActive', 'installDate', 'warrantyExpirationDate', 'parentConfigurationItemID'],
|
|
40
43
|
};
|
|
41
44
|
export function buildQuery(ctx) {
|
|
42
45
|
return {
|
|
@@ -82,7 +85,7 @@ export function buildQuery(ctx) {
|
|
|
82
85
|
if (args.filter !== undefined)
|
|
83
86
|
bag.filter = args.filter;
|
|
84
87
|
bag.limit = args.limit ?? QUERY_LIMIT.parse(undefined);
|
|
85
|
-
// #235: no include_fields on tickets / time_entries sends the default columns
|
|
88
|
+
// #235 / #451: no include_fields on tickets / time_entries / configuration_items sends the default columns
|
|
86
89
|
const defaults = args.include_fields === undefined ? DEFAULT_COLUMNS[args.resource] : undefined;
|
|
87
90
|
const includeFields = args.include_fields ?? defaults;
|
|
88
91
|
if (includeFields !== undefined)
|
|
@@ -101,8 +104,17 @@ export function buildQuery(ctx) {
|
|
|
101
104
|
const n = v.count ?? v.total ?? (Array.isArray(v.items) ? v.items.length : undefined);
|
|
102
105
|
const capped = result.noteCharsTruncated;
|
|
103
106
|
// #231: note_chars capping is reported here and by noteCharsTruncated, never as a top-level truncated flag (rows: hasMore)
|
|
104
|
-
const
|
|
107
|
+
const notes = `${typeof capped === 'number' ? ` ${capped} text field(s) cut by note_chars.` : ''}${defaults !== undefined ? ' Default columns: pass include_fields for any other field.' : ''}`;
|
|
108
|
+
// output_path is named only where resolveOutputTarget can accept it: stdio with a configured root (or a state dir to default it under)
|
|
109
|
+
// (both are blank-to-undefined at boot)
|
|
110
|
+
const fileForm = ctx.config.MCP_TRANSPORT === 'stdio' && (ctx.config.AUTOTASK_OUTPUT_DIR !== undefined || ctx.config.AUTOTASK_STATE_DIR !== undefined);
|
|
111
|
+
// #451: the full answer as today, or (over the byte budget) the cut answer of the first `rows` rows
|
|
112
|
+
const countText = (rows, cut) => cut === undefined
|
|
113
|
+
? `${typeof n === 'number' ? `${n} ${noun}` : noun} returned.${notes}`
|
|
114
|
+
: `${rows} of ${cut.rowsFetched} ${noun} returned.${notes}${bytesCappedNote(cut, fileForm)}`;
|
|
105
115
|
const marked = markResult(result, fields);
|
|
116
|
+
const markedItems = Array.isArray(marked.items) ? marked.items : [];
|
|
117
|
+
const maxBytes = ctx.config.AUTOTASK_QUERY_MAX_BYTES ?? QUERY_MAX_BYTES;
|
|
106
118
|
// #227: the server-side enrich is gone; the SDK labels every row by default (<fk>Name, <picklist>Label).
|
|
107
119
|
// #11 N4: format 'tsv' serves the table as result.tsv and OMITS items (the size saving). The
|
|
108
120
|
// TSV is built from the items AFTER the untrusted marking, so the markers survive in cells.
|
|
@@ -110,23 +122,45 @@ export function buildQuery(ctx) {
|
|
|
110
122
|
// The cells pass through the vendor-text choke point before the table is built (the table
|
|
111
123
|
// itself is then exempt from it, so the wrappers in its cells survive).
|
|
112
124
|
const itemList = Array.isArray(marked.items) ? sanitiseVendorOutput(marked.items) : [];
|
|
113
|
-
const { tsv, columns, rowCount } = toTsv(itemList);
|
|
114
125
|
const rest = { ...marked };
|
|
115
126
|
delete rest.items;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
return withinQueryBudget(itemList.length, maxBytes, ctx.correlationId, (rows, cut) => {
|
|
128
|
+
const { tsv, columns, rowCount } = toTsv(cut === undefined ? itemList : itemList.slice(0, rows));
|
|
129
|
+
// The table is built from cells that already passed the choke point: this exact object's
|
|
130
|
+
// `tsv` is recorded as server-built (by provenance, never by its key name).
|
|
131
|
+
const table = { ...rest, ...(cut === undefined ? {} : cutFields(rest, cut)), tsv, columns, rowCount };
|
|
132
|
+
markServerField(table, 'tsv', 'server');
|
|
133
|
+
markServerField(columns, '*', 'server');
|
|
134
|
+
return ok(`${countText(rows, cut)} Served as TSV: data.result.tsv (${rowCount} row(s), ${columns.length} column(s)); items omitted.`, {
|
|
135
|
+
resource: args.resource,
|
|
136
|
+
result: table,
|
|
137
|
+
});
|
|
124
138
|
});
|
|
125
139
|
}
|
|
126
|
-
return
|
|
140
|
+
return withinQueryBudget(markedItems.length, maxBytes, ctx.correlationId, (rows, cut) => {
|
|
141
|
+
if (cut === undefined)
|
|
142
|
+
return ok(countText(rows), { resource: args.resource, result: marked });
|
|
143
|
+
// The cut answer reuses the marked rows (their provenance rides the row objects) on a copy of
|
|
144
|
+
// the envelope that keeps every other field and the top-level provenance.
|
|
145
|
+
const items = markedItems.slice(0, rows);
|
|
146
|
+
copyProvenance(markedItems, items);
|
|
147
|
+
const page = { ...marked, items, ...cutFields(marked, cut) };
|
|
148
|
+
copyProvenance(marked, page);
|
|
149
|
+
return ok(countText(rows, cut), { resource: args.resource, result: page });
|
|
150
|
+
});
|
|
127
151
|
},
|
|
128
152
|
};
|
|
129
153
|
}
|
|
154
|
+
/** The fields a byte-budget cut changes on the envelope (#451): the rows served, hasMore and the marker. */
|
|
155
|
+
function cutFields(envelope, cut) {
|
|
156
|
+
return { ...(Object.prototype.hasOwnProperty.call(envelope, 'fetched') ? { fetched: cut.rowsReturned } : {}), hasMore: true, bytesCapped: { ...cut } };
|
|
157
|
+
}
|
|
158
|
+
/** Carry the untrusted provenance of `from` onto its copy `to` (the cut envelope and its row array). */
|
|
159
|
+
function copyProvenance(from, to) {
|
|
160
|
+
const fields = PROVENANCE.get(from);
|
|
161
|
+
if (fields !== undefined)
|
|
162
|
+
PROVENANCE.set(to, new Map(fields));
|
|
163
|
+
}
|
|
130
164
|
/**
|
|
131
165
|
* The `output_path` answer (issue #11 ruling N6): resolve + contain the target FIRST (a bad path
|
|
132
166
|
* never reaches the vendor), invoke the SDK's capped query walk, then
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ToolReturn } from './results/envelope.js';
|
|
2
|
+
/** The default budget (bytes) when `AUTOTASK_QUERY_MAX_BYTES` is unset. */
|
|
3
|
+
export declare const QUERY_MAX_BYTES: number;
|
|
4
|
+
/** The `bytesCapped` marker of a cut answer. */
|
|
5
|
+
export interface BytesCapped {
|
|
6
|
+
maxBytes: number;
|
|
7
|
+
rowsReturned: number;
|
|
8
|
+
rowsFetched: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Serve `build(rows)` within `maxBytes`. `build(rowsFetched)` is today's answer (no marker); `build(k,
|
|
12
|
+
* marker)` for `k < rowsFetched` is the cut answer of the first `k` rows. Returns the finished result.
|
|
13
|
+
*/
|
|
14
|
+
export declare function withinQueryBudget(rowsFetched: number, maxBytes: number, correlationId: string, build: (rows: number, capped?: BytesCapped) => ToolReturn): ToolReturn;
|
|
15
|
+
/** The one steer of a cut answer's human line; `fileForm`: output_path can serve here (stdio with an output root). */
|
|
16
|
+
export declare function bytesCappedNote(capped: BytesCapped, fileForm: boolean): string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tools/query-budget.ts — the response byte budget of `autotask_query` rows mode (#451).
|
|
3
|
+
*
|
|
4
|
+
* The budget is measured on the FINISHED result (the sanitised envelope and its mirrored text block,
|
|
5
|
+
* what the client receives), through the same response boundary as every vendor tool
|
|
6
|
+
* ({@link measuredVendorResult}). An answer within the budget is returned exactly as before. A larger
|
|
7
|
+
* one is replaced by the longest whole-row prefix that fits: every probe is rebuilt from the marked
|
|
8
|
+
* rows and passes the choke point again, so the untrusted marking is never bypassed and no row is cut.
|
|
9
|
+
*/
|
|
10
|
+
import { measuredVendorResult, finaliseVendorResult } from './results/untrusted.js';
|
|
11
|
+
import { QUERY_MAX_BYTES_DEFAULT } from '../config/schema.js';
|
|
12
|
+
/** The default budget (bytes) when `AUTOTASK_QUERY_MAX_BYTES` is unset. */
|
|
13
|
+
export const QUERY_MAX_BYTES = QUERY_MAX_BYTES_DEFAULT;
|
|
14
|
+
/**
|
|
15
|
+
* Serve `build(rows)` within `maxBytes`. `build(rowsFetched)` is today's answer (no marker); `build(k,
|
|
16
|
+
* marker)` for `k < rowsFetched` is the cut answer of the first `k` rows. Returns the finished result.
|
|
17
|
+
*/
|
|
18
|
+
export function withinQueryBudget(rowsFetched, maxBytes, correlationId, build) {
|
|
19
|
+
const full = measuredVendorResult(build(rowsFetched), maxBytes, correlationId);
|
|
20
|
+
if (full.result !== undefined || rowsFetched === 0)
|
|
21
|
+
return full.result ?? finaliseVendorResult(build(0), correlationId);
|
|
22
|
+
// Largest k known to fit (-1: none yet) and smallest k known not to fit.
|
|
23
|
+
let lo = -1;
|
|
24
|
+
let hi = rowsFetched;
|
|
25
|
+
let best;
|
|
26
|
+
const probe = (k) => {
|
|
27
|
+
const out = measuredVendorResult(build(k, { maxBytes, rowsReturned: k, rowsFetched }), maxBytes, correlationId).result;
|
|
28
|
+
if (out === undefined) {
|
|
29
|
+
hi = k;
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
lo = k;
|
|
33
|
+
best = out;
|
|
34
|
+
return true;
|
|
35
|
+
};
|
|
36
|
+
// Start from the proportional estimate, gallop to bracket the boundary, then bisect: each probe is
|
|
37
|
+
// about one budget's worth of rows, so a 2,500-row answer settles in a few probes.
|
|
38
|
+
const estimate = Math.min(rowsFetched - 1, Math.floor((rowsFetched * maxBytes) / full.bytes));
|
|
39
|
+
let step = 1;
|
|
40
|
+
if (probe(estimate)) {
|
|
41
|
+
while (lo + step < hi && probe(lo + step))
|
|
42
|
+
step *= 2;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
while (hi - step >= 0 && !probe(hi - step))
|
|
46
|
+
step *= 2;
|
|
47
|
+
}
|
|
48
|
+
while (hi - lo > 1)
|
|
49
|
+
probe(Math.floor((lo + hi) / 2));
|
|
50
|
+
// Even zero rows over the budget cannot happen at the boot bounds (the envelope alone is a few
|
|
51
|
+
// hundred bytes); answer the empty prefix rather than the oversized set.
|
|
52
|
+
return best ?? finaliseVendorResult(build(0, { maxBytes, rowsReturned: 0, rowsFetched }), correlationId);
|
|
53
|
+
}
|
|
54
|
+
/** The one steer of a cut answer's human line; `fileForm`: output_path can serve here (stdio with an output root). */
|
|
55
|
+
export function bytesCappedNote(capped, fileForm) {
|
|
56
|
+
return ` Cut at the ${capped.maxBytes}-byte response budget (bytesCapped; hasMore): count or group_by for totals, include_fields for fewer columns${fileForm ? ', output_path for the full set' : ''}.`;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=query-budget.js.map
|
|
@@ -115,6 +115,14 @@ export declare function sanitiseToolReturn(result: ToolReturn, serverCorrelation
|
|
|
115
115
|
export declare function finaliseVendorResult(result: ToolReturn, serverCorrelationId?: string): ToolReturn;
|
|
116
116
|
/** Measure the complete response and retain the exact safe result for the response boundary. */
|
|
117
117
|
export declare function boundedVendorResult(result: ToolReturn, maxBytes: number, serverCorrelationId?: string): ToolReturn | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* {@link boundedVendorResult} that also reports the measured size: the UTF-8 bytes of the finished,
|
|
120
|
+
* sanitised result (structured content and its mirrored text block), whether or not it fit.
|
|
121
|
+
*/
|
|
122
|
+
export declare function measuredVendorResult(result: ToolReturn, maxBytes: number, serverCorrelationId?: string): {
|
|
123
|
+
result: ToolReturn | undefined;
|
|
124
|
+
bytes: number;
|
|
125
|
+
};
|
|
118
126
|
/**
|
|
119
127
|
* Record the untrusted-content projection on a result: a copy in which the plan-derived field list
|
|
120
128
|
* (the registry stamp) and every user-defined field value (`userDefinedFields[].value`, review F3)
|
|
@@ -237,16 +237,24 @@ export function finaliseVendorResult(result, serverCorrelationId = '') {
|
|
|
237
237
|
}
|
|
238
238
|
/** Measure the complete response and retain the exact safe result for the response boundary. */
|
|
239
239
|
export function boundedVendorResult(result, maxBytes, serverCorrelationId = '') {
|
|
240
|
+
return measuredVendorResult(result, maxBytes, serverCorrelationId).result;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* {@link boundedVendorResult} that also reports the measured size: the UTF-8 bytes of the finished,
|
|
244
|
+
* sanitised result (structured content and its mirrored text block), whether or not it fit.
|
|
245
|
+
*/
|
|
246
|
+
export function measuredVendorResult(result, maxBytes, serverCorrelationId = '') {
|
|
240
247
|
const finished = finaliseVendorResult(result, serverCorrelationId);
|
|
241
248
|
const env = finished.structuredContent;
|
|
242
249
|
// A later correlation stamp would grow both copies after this byte check.
|
|
243
250
|
if (env.status !== 'ok' && !CORRELATION_ID.test(env.correlationId ?? ''))
|
|
244
251
|
throw new TypeError('Bounded vendor results require a finalized correlation id');
|
|
245
|
-
|
|
246
|
-
|
|
252
|
+
const bytes = Buffer.byteLength(JSON.stringify(finished), 'utf8');
|
|
253
|
+
if (bytes > maxBytes)
|
|
254
|
+
return { result: undefined, bytes };
|
|
247
255
|
if (ownsEnvelope(finished) && freezeJsonGraph(finished))
|
|
248
256
|
finishedResults.add(finished);
|
|
249
|
-
return finished;
|
|
257
|
+
return { result: finished, bytes };
|
|
250
258
|
}
|
|
251
259
|
/**
|
|
252
260
|
* Record the untrusted-content projection on a result: a copy in which the plan-derived field list
|
package/dist/tools/schemas.d.ts
CHANGED
|
@@ -436,6 +436,7 @@ export declare const CONFIGURATION_ITEM_PROFILE_INPUT: z.ZodObject<{
|
|
|
436
436
|
id: z.ZodNumber;
|
|
437
437
|
note_limit: z.ZodOptional<z.ZodNumber>;
|
|
438
438
|
related_limit: z.ZodOptional<z.ZodNumber>;
|
|
439
|
+
subscription_limit: z.ZodOptional<z.ZodNumber>;
|
|
439
440
|
}, z.core.$strip>;
|
|
440
441
|
export declare const CONTRACT_FULL_PROFILE_INPUT: z.ZodObject<{
|
|
441
442
|
id: z.ZodNumber;
|
package/dist/tools/schemas.js
CHANGED
|
@@ -265,7 +265,7 @@ export const QUERY_INPUT = z.object({
|
|
|
265
265
|
sum: z.array(z.string().min(1)).max(8).optional().describe('Numeric fields to total per group. Time: sum and report both hoursWorked (worked) and hoursToBill (billable; can differ).'),
|
|
266
266
|
count: z.boolean().optional().describe('true: count the matching rows, no rows returned.'),
|
|
267
267
|
top: z.number().int().min(1).max(100).optional().describe('Groups kept.'),
|
|
268
|
-
include_fields: z.array(z.string().min(1)).optional().describe('Exact vendor field names to return (id always included); an unknown name is a pre-query CONFIG_ERROR. Absent: tickets and
|
|
268
|
+
include_fields: z.array(z.string().min(1)).optional().describe('Exact vendor field names to return (id always included); an unknown name is a pre-query CONFIG_ERROR. Absent: tickets, time_entries and configuration_items return default columns, others the full row.'),
|
|
269
269
|
latest: z.number().int().min(1).max(QUERY_MAX_ROWS).optional().describe('N newest records (highest id). A filter is needed on this tool (a no-filter call is refused); to target the whole entity pass the tautology {field: id, op: exist}. Needs limit >= N.'),
|
|
270
270
|
note_chars: z.number().int().min(1).optional().describe('Cap each free-text field at N characters.'),
|
|
271
271
|
format: z.enum(['json', 'tsv']).optional().describe('tsv: the table as data.tsv, items omitted.'),
|
|
@@ -403,6 +403,7 @@ export const CONFIGURATION_ITEM_PROFILE_INPUT = z.object({
|
|
|
403
403
|
id: ID.describe('Numeric configuration item id.'),
|
|
404
404
|
note_limit: PART_LIMIT,
|
|
405
405
|
related_limit: PART_LIMIT,
|
|
406
|
+
subscription_limit: PART_LIMIT,
|
|
406
407
|
...COMPOSITE_NAME_KEYS,
|
|
407
408
|
});
|
|
408
409
|
export const CONTRACT_FULL_PROFILE_INPUT = z.object({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iit-mcp-autotask",
|
|
3
|
-
"version": "0.63.
|
|
3
|
+
"version": "0.63.15",
|
|
4
4
|
"description": "MCP server for the Autotask (Datto) PSA domain, built on the node-autotask SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Max Soukhomlinov",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@modelcontextprotocol/server": "^2.2.0",
|
|
57
|
-
"node-autotask": "0.
|
|
57
|
+
"node-autotask": "0.85.0",
|
|
58
58
|
"zod": "^4.6.7"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
package/server.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iit-mcp-autotask",
|
|
3
|
-
"version": "0.63.
|
|
3
|
+
"version": "0.63.15",
|
|
4
4
|
"description": "MCP server for the Autotask (Datto) PSA API, powered by the node-autotask SDK",
|
|
5
5
|
"mcpProtocolBaseline": "2026-07-28",
|
|
6
6
|
"legacyProtocolFallback": "2025-11-25",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"capabilitiesManifest": "capabilities.json",
|
|
63
63
|
"sdk": {
|
|
64
64
|
"package": "node-autotask",
|
|
65
|
-
"versionRange": "0.
|
|
65
|
+
"versionRange": "0.85.0"
|
|
66
66
|
},
|
|
67
67
|
"vendorExtensions": false,
|
|
68
68
|
"credentialModelNote": "per-request; server-held under stdio or, on HTTP, only behind AUTOTASK_HTTP_AUTH=tokens; operator plans and the ledger are keyed by principal and tenant id, never by credential, and an apply authenticates the request credential and restores the plan's per-write impersonation"
|
|
@@ -8,7 +8,7 @@ when_not_to_use: one customer's whole picture (company-360); contract or recurri
|
|
|
8
8
|
ops: ["autotask_resolve:companies.resolve", "autotask_resolve:configuration_items.findBySerial", "autotask_query:operations.aggregate", "autotask_query:configuration_items.query", "autotask_query:products.query", "autotask_query:companies.query", "autotask_query:subscriptions.query", "autotask_query:configuration_item_billing_product_associations.query", "autotask_query:configuration_item_types.query", "autotask_query:configuration_item_categories.query", "autotask_configuration_item_profile:configuration_items.profile"]
|
|
9
9
|
inputs: {"type": "object", "required": [], "properties": {"company": {"type": ["string", "integer"], "description": "Company name or numeric id whose assets to inventory"}, "product": {"type": "string", "description": "Product or manufacturer text to match"}, "vendor": {"type": ["string", "integer"], "description": "Vendor company name or numeric id"}}}
|
|
10
10
|
outcomes: ["ok", "needs_input", "ambiguous", "error"]
|
|
11
|
-
hazards: ["
|
|
11
|
+
hazards: ["without include_fields, configuration item rows carry 14 default columns (no notes, RMM or UDF fields; the full row has 100+); a rows answer over the response byte budget is cut to a prefix (bytesCapped, hasMore): name the columns you need", "referenceTitle contains misses items named differently from their product: match the product or vendor first", "an empty subscriptions answer is not proof of no licence terms: they may sit on CI expiry fields or contract services"]
|
|
12
12
|
related: ["company-360", "slim-reads", "filter-semantics"]
|
|
13
13
|
eval: evals/asset-inventory.json
|
|
14
14
|
---
|
|
@@ -25,16 +25,16 @@ Configuration items (CIs) are the assets. Count and group before listing; list o
|
|
|
25
25
|
|
|
26
26
|
1. Scope. Company: `autotask_resolve {identifier: "<company>", resource: "companies"}`; a vendor is a company too (the result id is the `vendorID`). One serial number: `autotask_resolve {identifier: "<serial>", resource: "configuration_items", by: "serial"}`, then go to step 7. Product text: `autotask_query {resource: "products", filter: [{field: "manufacturerName", op: "contains", value: "<text>"}], include_fields: ["id", "name", "manufacturerName", "manufacturerProductName", "sku", "defaultVendorID", "isActive"], limit: 50}` (or `name` contains). Keep the product ids.
|
|
27
27
|
2. Count: `autotask_query {resource: "configuration_items", filter: [<scope>, {field: "isActive", op: "eq", value: "true"}], count: true}`. `<scope>` is `{field: "companyID", op: "eq", value: "<id>"}`, `{field: "productID", op: "in", value: "<ids>"}` or `{field: "vendorID", op: "eq", value: "<id>"}`. Drop the isActive condition when retired assets count.
|
|
28
|
-
3. Group the same filter: `group_by: ["configurationItemType"]`, `["productID"]` or `["companyID"]`, `top: 50` (no `include_fields`, `limit` caps rows scanned). `groupsTruncated` or `hasMore` means partial: say so.
|
|
29
|
-
4.
|
|
28
|
+
3. Group the same filter: `group_by: ["configurationItemType"]`, `["productID"]`, `["vendorID"]` or `["companyID"]`, `top: 50` (no `include_fields`, `limit` caps rows scanned). `groupsTruncated` or `hasMore` means partial: say so. Product, vendor and company keys come named (`productIDName`, `vendorIDName`, `companyIDName`); a `null` name: `autotask_query {resource: "products", filter: [{field: "id", op: "in", value: "<ids>"}], include_fields: ["id", "name"], limit: 100}` (companies: `companyName`).
|
|
29
|
+
4. Type ids are not named: `autotask_query {resource: "configuration_item_types", filter: [{field: "id", op: "exist", value: ""}], include_fields: ["id", "name"], limit: 100}`. A `configurationItemCategoryID` column comes named.
|
|
30
30
|
5. List with the step-2 filter: `autotask_query {resource: "configuration_items", filter: [<scope>, {field: "isActive", op: "eq", value: "true"}], include_fields: ["id", "referenceTitle", "serialNumber", "productID", "configurationItemType", "companyID", "installDate", "warrantyExpirationDate", "isActive"], limit: 100}`. The CI name is `referenceTitle`; match vendor software by `productID in` (step 1) or `vendorID eq`, not by `referenceTitle contains`. Every row (a full export): `output_path` instead of a larger limit (stdio deployments only).
|
|
31
|
-
6. Licence terms: subscriptions carry
|
|
32
|
-
7. One item in depth, when served (`records` toolset): `autotask_configuration_item_profile {id: <CI id>}` (type, category, notes, related items, billing products).
|
|
31
|
+
6. Licence terms: subscriptions carry licence terms when the tenant records them there: `autotask_query {resource: "subscriptions", filter: [{field: "configurationItemID", op: "in", value: "<CI ids>"}], include_fields: ["id", "configurationItemID", "subscriptionName", "effectiveDate", "expirationDate", "periodType", "status", "vendorID"], limit: 100}`. Expiring soon: add `{field: "expirationDate", op: "gte", value: "<today>"}` and `{field: "expirationDate", op: "lte", value: "<date>"}`. None there: check the CI's own `warrantyExpirationDate`, `domainExpirationDateTime`, `sslValidUntilDateTime` and `userDefinedFields` (step 5 `include_fields`), or its contract service (`contractServiceID`). Billing products on CIs: `autotask_query {resource: "configuration_item_billing_product_associations", filter: [{field: "configurationItemID", op: "in", value: "<CI ids>"}], include_fields: ["id", "configurationItemID", "billingProductID", "effectiveDate", "expirationDate"], limit: 100}`.
|
|
32
|
+
7. One item in depth, when served (`records` toolset): `autotask_configuration_item_profile {id: <CI id>}` (type, category, product, notes, related items, billing products and its subscriptions; a part marked `unavailable` is a read-permission gap, not absence).
|
|
33
33
|
|
|
34
34
|
## Guardrails
|
|
35
35
|
|
|
36
36
|
- Read-only. Never list CI rows without `include_fields`, and never walk a tenant unscoped: scope by company, product or vendor ids.
|
|
37
|
-
- Licence dates are not on products or purchase orders.
|
|
37
|
+
- Licence dates are not on products or purchase orders. An empty subscriptions answer is not "no licence terms": check step 6's fallbacks first.
|
|
38
38
|
- Field names are vendor casing; check unknown ones with the scoped fieldCatalog call (`resources: ["configuration_items"]`; filter-semantics step 5), never guess.
|
|
39
39
|
|
|
40
40
|
## Verify
|
package/skills/slim-reads.md
CHANGED
|
@@ -5,17 +5,17 @@ version: 1
|
|
|
5
5
|
profile: readonly
|
|
6
6
|
description: Cheap reads for autotask_query: include_fields, note_chars and picklist labels instead of full vendor rows.
|
|
7
7
|
when_not_to_use: the filter behaviour (filter-semantics); records by id (autotask_query, filter id in)
|
|
8
|
-
ops: ["autotask_query:tickets.query", "autotask_query:time_entries.query", "autotask_query:service_calls.query", "autotask_query:contracts.query", "autotask_query:time_off_requests.query"]
|
|
8
|
+
ops: ["autotask_query:tickets.query", "autotask_query:time_entries.query", "autotask_query:configuration_items.query", "autotask_query:service_calls.query", "autotask_query:contracts.query", "autotask_query:time_off_requests.query"]
|
|
9
9
|
inputs: {"type": "object", "required": [], "properties": {}}
|
|
10
10
|
outcomes: ["ok", "error"]
|
|
11
|
-
hazards: ["without include_fields, tickets and
|
|
11
|
+
hazards: ["without include_fields, tickets, time_entries and configuration_items return default columns and other resources the full vendor row (~40 fields per contract, long notes)", "a rows answer over the response byte budget (default 256 KiB) is cut to a row prefix with hasMore and bytesCapped: count or group_by for totals, include_fields for fewer columns", "an unknown include_fields name is a zero-query-wire CONFIG_ERROR"]
|
|
12
12
|
related: ["filter-semantics"]
|
|
13
13
|
eval: evals/slim-reads.json
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
# Slim reads
|
|
17
17
|
|
|
18
|
-
Without include_fields, autotask_query on tickets and
|
|
18
|
+
Without include_fields, autotask_query on tickets, time_entries and configuration_items returns default columns (a full ticket row is ~4 KB, the default ~1 KB; a configuration item has over 100 model fields) and every other resource the FULL vendor row. A field outside the defaults (description, resolution, internalNotes, a configuration item's notes) needs include_fields. A rows answer larger than the response byte budget (default 256 KiB) is cut to the rows that fit, with hasMore: true and bytesCapped: { maxBytes, rowsReturned, rowsFetched }; do not re-query with the same shape. Use count or group_by for totals, include_fields for fewer columns, or output_path (stdio with an output root configured) for the full set.
|
|
19
19
|
|
|
20
20
|
## Inputs
|
|
21
21
|
|
|
@@ -37,6 +37,7 @@ No inputs: this is a reference page about autotask_query read cost, not a proced
|
|
|
37
37
|
## Verify
|
|
38
38
|
|
|
39
39
|
- The rows carry only the requested (or default) columns plus id.
|
|
40
|
+
- No bytesCapped on the answer; when present, the rows are a prefix and hasMore is true.
|
|
40
41
|
- Free-text fields end with the truncation marker when longer than note_chars.
|
|
41
42
|
|
|
42
43
|
## Failure and rollback
|
|
@@ -61,6 +62,7 @@ No inputs: this is a reference page about autotask_query read cost, not a proced
|
|
|
61
62
|
|---|---|---|---|
|
|
62
63
|
| autotask_query | tickets.query | read | - |
|
|
63
64
|
| autotask_query | time_entries.query | read | - |
|
|
65
|
+
| autotask_query | configuration_items.query | read | - |
|
|
64
66
|
| autotask_query | service_calls.query | read | - |
|
|
65
67
|
| autotask_query | contracts.query | read | - |
|
|
66
68
|
| autotask_query | time_off_requests.query | read | - |
|