iit-mcp-autotask 0.61.1 → 0.61.2
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/README.md +16 -2
- package/capabilities.json +4 -4
- package/dist/tools/catalog-data.d.ts +1 -1
- package/dist/tools/catalog-data.js +3 -2
- package/dist/tools/meta.js +1 -1
- package/dist/tools/resolves.js +36 -7
- package/dist/tools/schemas.d.ts +2 -0
- package/dist/tools/schemas.js +9 -8
- package/package.json +2 -2
- package/server.json +2 -2
- package/skills/company-360.md +6 -4
package/README.md
CHANGED
|
@@ -29,7 +29,16 @@ examples; `full: true` serves the complete record, `summary: true` about 2 KB),
|
|
|
29
29
|
`"serial"` or `"email"`, in one `resource` or swept across the five workflow resources;
|
|
30
30
|
the default `match: "auto"` tries exact, then contains on a miss for companies, tickets (title) or a
|
|
31
31
|
sweep (one hit: `ok` with `matched: "contains"`; several: `ambiguous`), `match: "exact"` has no
|
|
32
|
-
fallback, `match: "contains"` searches only. `resource: "
|
|
32
|
+
fallback, `match: "contains"` searches only. Explicit `resource: "companies"` also falls back
|
|
33
|
+
to fuzzy after a contains miss; `match: "fuzzy"` goes directly to company candidates (by
|
|
34
|
+
`id_or_name` only, at most 10, lower with `limit`). Every fuzzy hit is `ambiguous` /
|
|
35
|
+
`choose_candidate`, even one at distance zero. Candidates carry `ref`, `record`, `distance`,
|
|
36
|
+
`matchedTerms`, `coverage`, `source`; `data` carries `tier`, `truncated`, `pieces`, `index.state`
|
|
37
|
+
and optional `index.builtAt`. Empty fuzzy results are `needs_input`, never proof of absence:
|
|
38
|
+
cold/building indexes suggest retry; warm/off searches suggest narrowing or a known id.
|
|
39
|
+
`include_family` also applies to fuzzy. `include_inactive: true` applies only to fuzzy candidates
|
|
40
|
+
with companies + fuzzy/auto (default false: active-only fuzzy candidates); exact and contains
|
|
41
|
+
keep their existing activity behavior. Sweeps and other resources never use fuzzy. `resource: "resources"` finds staff by
|
|
33
42
|
email, user name or name (active only; API users, which carry their owner's email, are excluded unless
|
|
34
43
|
`include_api_users: true`; `by: "email"` narrows to the email field; a numeric identifier is looked up
|
|
35
44
|
as a Resource id); compact rows carry `apiUser` and the licence label when the tenant's labels tell it, never an email. Every match carries `ref`, its human reference, as safe text: control and markup characters (`< > { } [ ] \` " | \\`) dropped, whitespace collapsed, at most 80 characters (a cut ends with `…`), never wrapped; still vendor-authored data (#230). A sweep returns compact matches (`resource`, `ref`, `id`, the human fields) unless `expand: true` (the record under `record`, without its `[REDACTED]`, null and empty fields; `expand: "full"` keeps them); `limit` caps the TOTAL matches across resources (resource order, then the SDK's order) and a contains sweep reports `truncated` and per-resource `counts {returned, found}`.
|
|
@@ -494,7 +503,7 @@ non-zero on an invalid config (fail-fast) instead of failing at the first tool c
|
|
|
494
503
|
| `AUTOTASK_BASE_URL` | stdio: yes · http: no (default origin) | — | the zone origin, e.g. `https://webservices6.autotask.net` (zone lives in the host; base path `/atservicesrest` is fixed — never configurable) |
|
|
495
504
|
| `AUTOTASK_ALLOWED_BASE_HOSTS` | http: unless `AUTOTASK_ALLOW_ANY_BASE_HOST=true` | — | comma-separated exact hostnames or `*.suffix` subdomain suffixes a caller may name in `X-Autotask-Base-Url` (no scheme/port/path). Unset + default origin set → only that origin accepted. Unset + no default → boot refused unless the lab-only flag. **Recommended production value: `*.autotask.net`**. Literal private-IP origins are always refused. |
|
|
496
505
|
| `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. |
|
|
497
|
-
| `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); `off` sends `cache: false` (every read re-dials the vendor) |
|
|
506
|
+
| `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) |
|
|
498
507
|
| `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) |
|
|
499
508
|
| `AUTOTASK_RATE_LIMIT_PER_HOUR` | no | 8000 (agent profile) | override the SDK's local hourly budget (never above the vendor cap; `null`/off is rejected at boot — it would void the budget guard) |
|
|
500
509
|
| `AUTOTASK_MAX_CONCURRENT` | no | 3 (agent profile) | override the SDK's local concurrency bound |
|
|
@@ -687,6 +696,11 @@ guards (rate limiter, 429 cooldown) — a worse security posture, not a safer on
|
|
|
687
696
|
tables ~1 h, field metadata ~5 min). Repeated reads of the same record are served from that
|
|
688
697
|
tenant's cache until TTL expiry; composites de-duplicate their 3–8 fan-out reads through it.
|
|
689
698
|
`off` sends `cache: false` (every read re-dials the vendor).
|
|
699
|
+
Fuzzy company search always performs an uncached live fragment query (at most 500 rows).
|
|
700
|
+
Separately, the SDK lazily builds a slim company-name index in the background, refreshes it
|
|
701
|
+
every 30 minutes and clears it after company writes (rebuild debounced for one second).
|
|
702
|
+
`AUTOTASK_CACHE=off` disables that index; results remain live-only with `index.state: "off"`.
|
|
703
|
+
Cold/building indexes and capped live searches can miss companies: inspect the returned metadata.
|
|
690
704
|
- **Boundaries — never relaxed:** in-process only (never on disk), **per-tenant** (one tenant's
|
|
691
705
|
cached records or limiter state can never answer another tenant's request), TTL-bounded, cleared
|
|
692
706
|
on eviction and on `401`. The same boundary covers the limiter/cooldown state.
|
package/capabilities.json
CHANGED
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
"id": "autotask.platform.catalog",
|
|
77
|
-
"description": "Find the exact operation key for anything without a dedicated tool: ranked search (q) over the 1,
|
|
77
|
+
"description": "Find the exact operation key for anything without a dedicated tool: ranked search (q) over the 1,248 registry operations, with effect and whether this deployment serves it. No vendor call.",
|
|
78
78
|
"mcpPrimitive": "tool",
|
|
79
79
|
"toolName": "autotask_catalog",
|
|
80
80
|
"type": "read",
|
|
@@ -122,13 +122,13 @@
|
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
"id": "autotask.discovery.resolve",
|
|
125
|
-
"description": "Find the record for an identifier: id or name, ticket number, CI serial, contact email (by), staff by email, user name or name (resource resources, include_api_users); one resource or a sweep. Exact, then contains
|
|
125
|
+
"description": "Find the record for an identifier: id or name, ticket number, CI serial, contact email (by), staff by email, user name or name (resource resources, include_api_users); one resource or a sweep. Exact, then contains; companies add fuzzy candidates.",
|
|
126
126
|
"mcpPrimitive": "tool",
|
|
127
127
|
"toolName": "autotask_resolve",
|
|
128
128
|
"type": "read",
|
|
129
129
|
"toolset": "core",
|
|
130
130
|
"profile": "readonly",
|
|
131
|
-
"backingOperation": "operations.resolveAny | operations.resolveStaff | operations.searchAcrossResources | companies.resolve | companies.search | configuration_items.resolve | contacts.resolve | projects.resolve | tickets.resolve | tickets.findByTicketNumber | configuration_items.findBySerial | contacts.findByEmail | tickets.search | resources.query | resources.get | operations.fieldCatalog",
|
|
131
|
+
"backingOperation": "operations.resolveAny | operations.resolveStaff | operations.searchAcrossResources | companies.resolve | companies.search | companies.searchFuzzy | configuration_items.resolve | contacts.resolve | projects.resolve | tickets.resolve | tickets.findByTicketNumber | configuration_items.findBySerial | contacts.findByEmail | tickets.search | resources.query | resources.get | operations.fieldCatalog",
|
|
132
132
|
"annotations": {
|
|
133
133
|
"readOnly": true,
|
|
134
134
|
"idempotent": true,
|
|
@@ -480,7 +480,7 @@
|
|
|
480
480
|
"autotask_describe",
|
|
481
481
|
"autotask_read"
|
|
482
482
|
],
|
|
483
|
-
"backingRegistryOperations":
|
|
483
|
+
"backingRegistryOperations": 1248,
|
|
484
484
|
"note": "autotask_catalog finds the exact operation key (ranked search), autotask_describe serves its contract, autotask_read runs any effect=read key. Writes go through the operator profile (autotask_write then autotask_apply); authenticate.* is never served."
|
|
485
485
|
},
|
|
486
486
|
"schemas": {}
|
|
@@ -107,7 +107,7 @@ export declare function sdkCacheOptions(cache: 'on' | 'off'): Pick<AutotaskConfi
|
|
|
107
107
|
* fails the boot (or the CI test) instead of quietly shipping a tool surface that no longer
|
|
108
108
|
* describes the SDK behind it.
|
|
109
109
|
*/
|
|
110
|
-
export declare const BUILT_AGAINST_PLAN_HASH = "
|
|
110
|
+
export declare const BUILT_AGAINST_PLAN_HASH = "04fb614dcdd035a01636e51cf38d8178aeef7c9a1b45faf4af6187875800bd70";
|
|
111
111
|
/**
|
|
112
112
|
* Fail fast when the installed SDK's plan has moved out from under this surface.
|
|
113
113
|
* Called at boot (main.ts) and safe to call repeatedly (pure comparison).
|
|
@@ -55,6 +55,7 @@ export const TOOL_NAME_BY_OP = {
|
|
|
55
55
|
'operations.relationshipMap': 'autotask_describe',
|
|
56
56
|
'companies.resolve': 'autotask_resolve',
|
|
57
57
|
'companies.search': 'autotask_resolve',
|
|
58
|
+
'companies.searchFuzzy': 'autotask_resolve',
|
|
58
59
|
'configuration_items.resolve': 'autotask_resolve',
|
|
59
60
|
'contacts.resolve': 'autotask_resolve',
|
|
60
61
|
'projects.resolve': 'autotask_resolve',
|
|
@@ -130,7 +131,7 @@ export const TOOL_DESCRIPTIONS = {
|
|
|
130
131
|
autotask_catalog: `Find the exact operation key for anything without a dedicated tool: ranked search (q) over the ${RECORDS.length.toLocaleString('en-US')} registry operations, with effect and whether this deployment serves it. No vendor call.`,
|
|
131
132
|
autotask_describe: 'One operation\'s (registry key or tool name) exact input/output contract, examples, errors, policy verdict and playbooks (operation), or one resource\'s relationship map: parent, children, lookup keys (resource). No vendor call.',
|
|
132
133
|
autotask_read: 'Run one or several reads in one call by exact registry key: unbilled work, profitability and margin, SLA health. Scope by company/contract ids (unscoped = tenant walk); totals: autotask_query group_by; slim: includeFields, noteChars.',
|
|
133
|
-
autotask_resolve: 'Find the record for an identifier: id or name, ticket number, CI serial, contact email (by), staff by email, user name or name (resource resources, include_api_users); one resource or a sweep. Exact, then contains
|
|
134
|
+
autotask_resolve: 'Find the record for an identifier: id or name, ticket number, CI serial, contact email (by), staff by email, user name or name (resource resources, include_api_users); one resource or a sweep. Exact, then contains; companies add fuzzy candidates.',
|
|
134
135
|
autotask_query: 'List records or totals with a filter: tickets, time entries, service calls, contracts, time off, more. Totals, no rows: group_by, sum, count (hours logged by ticket, how many match). By id: id in. Scope by company ids (unscoped = tenant walk).',
|
|
135
136
|
autotask_tenant_status: 'Identity (API user + impersonated user), Autotask API version, this server\'s package/SDK version and profile (server), request thresholds, and the time zone of the people asking, with local and UTC time (time). Use it first to check credentials.',
|
|
136
137
|
autotask_ticket_full_context: 'One ticket with its company, contact, assigned resource, project, notes, time entries and attachment metadata. Missing parts degrade to typed absent; a missing ticket is not found.',
|
|
@@ -186,7 +187,7 @@ export function sdkCacheOptions(cache) {
|
|
|
186
187
|
* fails the boot (or the CI test) instead of quietly shipping a tool surface that no longer
|
|
187
188
|
* describes the SDK behind it.
|
|
188
189
|
*/
|
|
189
|
-
export const BUILT_AGAINST_PLAN_HASH = '
|
|
190
|
+
export const BUILT_AGAINST_PLAN_HASH = '04fb614dcdd035a01636e51cf38d8178aeef7c9a1b45faf4af6187875800bd70';
|
|
190
191
|
/**
|
|
191
192
|
* Fail fast when the installed SDK's plan has moved out from under this surface.
|
|
192
193
|
* Called at boot (main.ts) and safe to call repeatedly (pure comparison).
|
package/dist/tools/meta.js
CHANGED
|
@@ -128,7 +128,7 @@ const TOOL_INPUT = {
|
|
|
128
128
|
};
|
|
129
129
|
/** Tools whose argument SHAPE (not just casing) differs from the SDK call. */
|
|
130
130
|
const SHAPE_NOTES = {
|
|
131
|
-
autotask_resolve: 'flat args, not the SDK identifier + opts bag: identifier -> identifier (positional in every key); by picks the key (ticket_number -> tickets.findByTicketNumber, serial -> configuration_items.findBySerial, email -> contacts.findByEmail, id_or_name -> <resource>.resolve); no resource -> operations.resolveAny (match exact) or operations.searchAcrossResources (match contains), resource companies + match contains -> companies.search; resource tickets + match contains -> tickets.search (title contains; company_id -> companyID); the opts bag is built from expand, include_family (includeFamily), limit and resources',
|
|
131
|
+
autotask_resolve: 'flat args, not the SDK identifier + opts bag: identifier -> identifier (positional in every key); by picks the key (ticket_number -> tickets.findByTicketNumber, serial -> configuration_items.findBySerial, email -> contacts.findByEmail, id_or_name -> <resource>.resolve); no resource -> operations.resolveAny (match exact) or operations.searchAcrossResources (match contains), resource companies + match contains -> companies.search, match fuzzy -> companies.searchFuzzy (always candidates); auto companies: exact -> contains -> fuzzy on misses; include_inactive -> includeInactive only for fuzzy candidates (default false), never an exact/contains filter; resource tickets + match contains -> tickets.search (title contains; company_id -> companyID); the opts bag is built from expand, include_family (includeFamily), limit and resources',
|
|
132
132
|
autotask_tenant_status: 'parts [identity, version, thresholds, server, time] picks which of resources.whoAmI, version.get, threshold_information.get run, plus zero-wire server and time parts (default all); identity also returns impersonationResourceId; none takes args',
|
|
133
133
|
autotask_contact_full_profile: 'takes only id (+ ticket_limit), no parentId: the tool resolves the contact by id alone',
|
|
134
134
|
autotask_invoice_get: 'format selects the key: record -> invoices.get, html -> invoices.markupHtml, xml -> invoices.markupXml, pdf -> invoices.pdf; output_path is tool-only (writes the export to a file)',
|
package/dist/tools/resolves.js
CHANGED
|
@@ -7,16 +7,17 @@
|
|
|
7
7
|
* - typed exact (`resource`, `by: id_or_name`): `<resource>.resolve` — numeric id first, else the
|
|
8
8
|
* resource's exact primary text field;
|
|
9
9
|
* - typed natural key (`by: ticket_number | serial | email`): the matching `findBy*` lookup;
|
|
10
|
-
* - companies contains (`resource: companies`, `match: contains`):
|
|
11
|
-
*
|
|
10
|
+
* - companies contains/fuzzy (`resource: companies`, `match: contains | fuzzy`): SDK-owned searches
|
|
11
|
+
* with the family block on request (#9, #398);
|
|
12
12
|
* - staff (`resource: resources`): `operations.resolveStaff` owns matching, active/API-user
|
|
13
13
|
* exclusions and tenant metadata; this tool presents its result;
|
|
14
14
|
* - sweep (no `resource`): `resolveAny` (exact/auto) or `searchAcrossResources` (contains) over the
|
|
15
15
|
* five workflow resources or `resources`.
|
|
16
16
|
*
|
|
17
17
|
* `match: auto` (the default, #225): exact first; on an exact miss companies, tickets (title) and a
|
|
18
|
-
* sweep fall back to contains
|
|
19
|
-
* `ambiguous
|
|
18
|
+
* sweep fall back to contains. One contains hit answers `ok` with `matched: "contains"`, several
|
|
19
|
+
* answer `ambiguous`. Explicit companies then fall back to fuzzy candidates (#398): always
|
|
20
|
+
* `ambiguous` on a hit; empty searches keep metadata and qualified retry/input guidance. `match: exact` keeps the exact-only miss.
|
|
20
21
|
*
|
|
21
22
|
* Records drop `[REDACTED]`, null and empty fields unless `expand: "full"` (#225).
|
|
22
23
|
*
|
|
@@ -147,6 +148,10 @@ function resolveText(resource, identifier, record) {
|
|
|
147
148
|
}
|
|
148
149
|
/** Refuse the invalid argument combinations before any request (INPUT_INVALID, zero wire). */
|
|
149
150
|
function validateCombination(a) {
|
|
151
|
+
if (a.match === 'fuzzy' && (a.resource !== 'companies' || a.by !== 'id_or_name'))
|
|
152
|
+
throw new InputInvalidError('resolve: match "fuzzy" needs resource "companies" and by "id_or_name"', 'match');
|
|
153
|
+
if (a.include_inactive && !(a.resource === 'companies' && a.by === 'id_or_name' && (a.match === 'auto' || a.match === 'fuzzy')))
|
|
154
|
+
throw new InputInvalidError('resolve: include_inactive applies to companies fuzzy candidates only (match "fuzzy" or "auto")', 'include_inactive');
|
|
150
155
|
if (a.resource !== undefined && a.resources !== undefined)
|
|
151
156
|
throw new InputInvalidError('resolve: resources is for a sweep only — omit it when resource is set', 'resources');
|
|
152
157
|
// #172: by email on resources narrows the staff match to the email field.
|
|
@@ -169,10 +174,10 @@ function validateCombination(a) {
|
|
|
169
174
|
if (a.include_api_users && a.resource !== 'resources')
|
|
170
175
|
throw new InputInvalidError('resolve: include_api_users applies to resource "resources" only', 'include_api_users');
|
|
171
176
|
if (a.include_family && !(a.match !== 'exact' && a.resource === 'companies')) {
|
|
172
|
-
throw new InputInvalidError('resolve: include_family applies to resource "companies" with match "contains" or "auto" only', 'include_family');
|
|
177
|
+
throw new InputInvalidError('resolve: include_family applies to resource "companies" with match "contains", "fuzzy" or "auto" only', 'include_family');
|
|
173
178
|
}
|
|
174
|
-
if (a.match === 'contains' && a.resource === 'companies' && a.limit > COMPANY_CONTAINS_MAX_LIMIT) {
|
|
175
|
-
throw new InputInvalidError(`resolve: limit ${a.limit} exceeds the companies
|
|
179
|
+
if ((a.match === 'contains' || a.match === 'fuzzy') && a.resource === 'companies' && a.limit > COMPANY_CONTAINS_MAX_LIMIT) {
|
|
180
|
+
throw new InputInvalidError(`resolve: limit ${a.limit} exceeds the companies search cap of ${COMPANY_CONTAINS_MAX_LIMIT} — it may be lowered, never raised`, 'limit');
|
|
176
181
|
}
|
|
177
182
|
}
|
|
178
183
|
const STAFF_NOTES = {
|
|
@@ -219,6 +224,26 @@ export function buildResolve(ctx) {
|
|
|
219
224
|
const found = await ctx.ops.invokeRead(ctx.client, 'tickets.search', [String(a.identifier), opts], undefined, signal);
|
|
220
225
|
return found === undefined ? undefined : Array.isArray(found) ? found : [];
|
|
221
226
|
};
|
|
227
|
+
/** Fuzzy rows are suggestions, including a single distance-zero hit; the caller always chooses. */
|
|
228
|
+
const searchFuzzy = async () => {
|
|
229
|
+
gate('companies.searchFuzzy');
|
|
230
|
+
const opts = { limit: Math.min(a.limit, COMPANY_CONTAINS_MAX_LIMIT), includeFamily: a.include_family, includeInactive: a.include_inactive };
|
|
231
|
+
const value = await ctx.ops.invokeRead(ctx.client, 'companies.searchFuzzy', [String(a.identifier), opts], undefined, signal);
|
|
232
|
+
if (value === undefined)
|
|
233
|
+
return abortedAnswer(ctx.correlationId);
|
|
234
|
+
const found = value;
|
|
235
|
+
const data = { resource: 'companies', ...how(a.match, 'fuzzy'), count: found.items.length, tier: found.tier, truncated: found.truncated, pieces: found.pieces, index: found.index };
|
|
236
|
+
if (found.items.length > 0) {
|
|
237
|
+
const candidates = found.items.map(({ record, distance, matchedTerms, coverage, source }) => ({ ref: refOf('companies', record), record: slimRecord(record, a.expand), distance, matchedTerms, coverage, source }));
|
|
238
|
+
const detail = `${found.items.length} fuzzy company candidate(s); choose one by id, even when distance is zero.${found.truncated ? ' Results capped; narrow the name if needed.' : ''}`;
|
|
239
|
+
return outcome('ambiguous', 'choose_candidate', { code: 'AMBIGUOUS_MATCH', detail, field: 'identifier' }, data, { candidates: markResult(candidates, [...ctx.untrustedFields('companies.searchFuzzy'), 'matchedTerms']), summary: detail });
|
|
240
|
+
}
|
|
241
|
+
const building = found.index.state === 'cold' || found.index.state === 'building';
|
|
242
|
+
const detail = `No fuzzy company candidates in this bounded search; this is not proof of absence. ${building ? 'The name index is not ready; retry after it builds, narrow the name or supply a known company id.' : 'Narrow the name or supply a known company id.'}${found.truncated ? ' Live results were capped.' : ''}`;
|
|
243
|
+
const result = outcome('needs_input', building ? 'retry' : 'supply_input', { code: found.truncated ? 'RESULT_TRUNCATED' : 'TARGET_NOT_FOUND', detail, field: 'identifier' }, data, { summary: detail });
|
|
244
|
+
result.structuredContent.retryable = building;
|
|
245
|
+
return result;
|
|
246
|
+
};
|
|
222
247
|
// ---- sweep: no resource ----
|
|
223
248
|
if (a.resource === undefined) {
|
|
224
249
|
const resources = a.resources;
|
|
@@ -337,6 +362,8 @@ export function buildResolve(ctx) {
|
|
|
337
362
|
matches: markResult(rows, fields),
|
|
338
363
|
});
|
|
339
364
|
}
|
|
365
|
+
if (a.match === 'fuzzy')
|
|
366
|
+
return searchFuzzy();
|
|
340
367
|
// ---- companies contains (issue #9) ----
|
|
341
368
|
if (a.match === 'contains') {
|
|
342
369
|
const found = await searchContains(resource);
|
|
@@ -380,6 +407,8 @@ export function buildResolve(ctx) {
|
|
|
380
407
|
const found = await searchContains(resource);
|
|
381
408
|
if (found === undefined)
|
|
382
409
|
return abortedAnswer(ctx.correlationId);
|
|
410
|
+
if (found.length === 0 && resource === 'companies')
|
|
411
|
+
return searchFuzzy();
|
|
383
412
|
if (found.length === 0)
|
|
384
413
|
throw new NotFoundError(`resolve: no visible ${RESOURCES[resource].noun} matches "${a.identifier}" — tried EXACT then contains`, { operation });
|
|
385
414
|
if (found.length === 1) {
|
package/dist/tools/schemas.d.ts
CHANGED
|
@@ -257,10 +257,12 @@ export declare const RESOLVE_INPUT: z.ZodObject<{
|
|
|
257
257
|
exact: "exact";
|
|
258
258
|
auto: "auto";
|
|
259
259
|
contains: "contains";
|
|
260
|
+
fuzzy: "fuzzy";
|
|
260
261
|
}>>;
|
|
261
262
|
company_id: z.ZodOptional<z.ZodNumber>;
|
|
262
263
|
expand: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"full">]>>;
|
|
263
264
|
include_family: z.ZodDefault<z.ZodBoolean>;
|
|
265
|
+
include_inactive: z.ZodDefault<z.ZodBoolean>;
|
|
264
266
|
include_api_users: z.ZodDefault<z.ZodBoolean>;
|
|
265
267
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
266
268
|
}, z.core.$strip>;
|
package/dist/tools/schemas.js
CHANGED
|
@@ -242,16 +242,17 @@ export const READ_INPUT = z.object({
|
|
|
242
242
|
expectedReadRuntime: z.string().regex(/^[a-f0-9]{64}$/).optional().describe('Require server.readRuntime.sha256 from autotask_tenant_status; changed or unavailable runtime refuses before any vendor dispatch.'),
|
|
243
243
|
}).transform(v => v.projection === 'billing_review_entry_v1' ? v : numericQueryBag(v));
|
|
244
244
|
export const RESOLVE_INPUT = z.object({
|
|
245
|
-
identifier: z.union([z.number().int().nonnegative(), z.string().min(1).max(200)]).describe('
|
|
246
|
-
resource: RESOLVE_RESOURCE.optional().describe('
|
|
245
|
+
identifier: z.union([z.number().int().nonnegative(), z.string().min(1).max(200)]).describe('Id/name, ticket number, serial, email. resources: numeric = id.'),
|
|
246
|
+
resource: RESOLVE_RESOURCE.optional().describe('Omit to sweep. resources: staff by email/user name/name; active, API users excluded.'),
|
|
247
247
|
resources: z.array(WF).min(1).optional().describe('Sweep only: resources to try (default all five).'),
|
|
248
|
-
by: z.enum(['id_or_name', 'ticket_number', 'serial', 'email']).default('id_or_name').describe('
|
|
249
|
-
match: z.enum(['auto', 'exact', 'contains']).default('auto').describe('auto: exact, then
|
|
250
|
-
company_id: z.number().int().positive().optional().describe('tickets
|
|
251
|
-
expand: z.union([z.boolean(), z.literal('full')]).default(false).describe('
|
|
248
|
+
by: z.enum(['id_or_name', 'ticket_number', 'serial', 'email']).default('id_or_name').describe('Kind; non-default needs resource (resources: email only).'),
|
|
249
|
+
match: z.enum(['auto', 'exact', 'contains', 'fuzzy']).default('auto').describe('auto: exact, contains, then fuzzy for companies. fuzzy: companies + id_or_name, always candidates. contains: companies/tickets title/sweep.'),
|
|
250
|
+
company_id: z.number().int().positive().optional().describe('tickets contains/auto: scope title search by company.'),
|
|
251
|
+
expand: z.union([z.boolean(), z.literal('full')]).default(false).describe('true: record, drop empty fields; "full": keep all.'),
|
|
252
252
|
include_family: z.boolean().default(false).describe('Companies: parent and child ids per match.'),
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
include_inactive: z.boolean().default(false).describe('Companies fuzzy/auto: inactive fuzzy candidates too (default false). Exact/contains unchanged.'),
|
|
254
|
+
include_api_users: z.boolean().default(false).describe('resources only: include API users (default excluded).'),
|
|
255
|
+
limit: z.number().int().min(1).max(50).default(10).describe('Matches; companies/staff cap 10.'),
|
|
255
256
|
});
|
|
256
257
|
export const QUERY_INPUT = z.object({
|
|
257
258
|
resource: z
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iit-mcp-autotask",
|
|
3
|
-
"version": "0.61.
|
|
3
|
+
"version": "0.61.2",
|
|
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.68.1",
|
|
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.61.
|
|
3
|
+
"version": "0.61.2",
|
|
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.68.1"
|
|
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"
|
package/skills/company-360.md
CHANGED
|
@@ -5,7 +5,7 @@ version: 1
|
|
|
5
5
|
profile: readonly
|
|
6
6
|
description: One customer's picture: profile and configuration items, or tickets and hours in a period.
|
|
7
7
|
when_not_to_use: billing questions (unbilled-work-review, contract-profitability); many companies at once (autotask_query or autotask_read companies.query)
|
|
8
|
-
ops: ["autotask_resolve:companies.resolve", "autotask_resolve:companies.search", "autotask_company_full_profile:companies.fullProfile", "autotask_read:configuration_items.query", "autotask_query:tickets.query", "autotask_query:operations.aggregate"]
|
|
8
|
+
ops: ["autotask_resolve:companies.resolve", "autotask_resolve:companies.search", "autotask_resolve:companies.searchFuzzy", "autotask_company_full_profile:companies.fullProfile", "autotask_read:configuration_items.query", "autotask_query:tickets.query", "autotask_query:operations.aggregate"]
|
|
9
9
|
inputs: {"type": "object", "required": ["company"], "properties": {"company": {"type": ["string", "integer"], "description": "Company name or numeric company id"}}}
|
|
10
10
|
outcomes: ["ok", "needs_input", "ambiguous", "error"]
|
|
11
11
|
hazards: ["companies are a blind surface: a miss is not proof of absence"]
|
|
@@ -21,7 +21,7 @@ eval: evals/company-360.json
|
|
|
21
21
|
|
|
22
22
|
## Steps
|
|
23
23
|
|
|
24
|
-
1. `autotask_resolve {identifier: "<company>", resource: "companies"}` (name or id): exact first, then contains on
|
|
24
|
+
1. `autotask_resolve {identifier: "<company>", resource: "companies"}` (name or id): exact first, then contains, then fuzzy on misses. One exact/contains match continues with it (`matched` says how); fuzzy always returns `ambiguous`, including one distance-zero hit. Present candidates with their ids, `ref`, distance, matched terms, coverage and source; the caller chooses. `match: "fuzzy"` searches directly, at most 10 candidates (lower with `limit`); `include_family` adds family data. `include_inactive: true` includes inactive fuzzy candidates only (default false); exact/contains keep their existing activity behavior. Inspect `tier`, `truncated`, `pieces` and `index.state` before interpreting a miss.
|
|
25
25
|
2. `autotask_company_full_profile {id: <id>}`: locations, contacts, notes, open tickets, projects. Each list part is capped at 10 rows by default (`contact_limit`, `note_limit`, `ticket_limit`, `project_limit`, 1-500; locations stay at 50, `location_limit`). To cut context further pass `fields: {contacts: ["firstName", "emailAddress"]}` (parts: locations, contacts, notes, projects, openTickets; unlisted parts keep every field). A part with `capped: true` has more rows: re-call with a higher limit for that part only if the task needs them.
|
|
26
26
|
3. Configuration items: `autotask_read {operation: "configuration_items.query", args: [{filter: [{field: "companyID", op: "eq", value: <id>}], limit: 50}]}`. The answer is `data.results[0].result`.
|
|
27
27
|
|
|
@@ -33,7 +33,7 @@ Company activity in a period ("tickets for <company> created in the last 4 weeks
|
|
|
33
33
|
## Guardrails
|
|
34
34
|
|
|
35
35
|
- Read-only. Contacts carry personal data: report names and roles, not more than the task needs.
|
|
36
|
-
- Never pick one of several contains matches on your own.
|
|
36
|
+
- Never pick one of several contains matches or any fuzzy candidate on your own.
|
|
37
37
|
|
|
38
38
|
## Verify
|
|
39
39
|
|
|
@@ -42,7 +42,8 @@ The summary names the company by its `ref` (the `companyName` as safe text, capp
|
|
|
42
42
|
## Failure and rollback
|
|
43
43
|
|
|
44
44
|
- `ambiguous` in step 1: return it with the candidate ids and names; the caller chooses.
|
|
45
|
-
- `
|
|
45
|
+
- Empty fuzzy search: return its `needs_input` and metadata; it is not proof of absence. For cold/building indexes follow `next: retry` after the index builds; otherwise ask for a narrower name or known id. Capped results are partial.
|
|
46
|
+
- `TARGET_NOT_FOUND` on exact-only lookups: return `needs_input` for `company`.
|
|
46
47
|
- A part with `absent` in step 2: report it as missing and continue.
|
|
47
48
|
- Other `error`: return it unchanged.
|
|
48
49
|
|
|
@@ -62,6 +63,7 @@ The summary names the company by its `ref` (the `companyName` as safe text, capp
|
|
|
62
63
|
|---|---|---|---|
|
|
63
64
|
| autotask_resolve | companies.resolve | read | identifier |
|
|
64
65
|
| autotask_resolve | companies.search | read | query |
|
|
66
|
+
| autotask_resolve | companies.searchFuzzy | read | query |
|
|
65
67
|
| autotask_company_full_profile | companies.fullProfile | read | id |
|
|
66
68
|
| autotask_read | configuration_items.query | read | - |
|
|
67
69
|
| autotask_query | tickets.query | read | - |
|