@teamnetwork-nz/teamlink-mcp-server 0.5.6 → 0.5.8
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/build/index.js +128 -30
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -41,6 +41,12 @@ const http = axios.create({
|
|
|
41
41
|
function ok(data) {
|
|
42
42
|
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
43
43
|
}
|
|
44
|
+
function usageError(message, details) {
|
|
45
|
+
return {
|
|
46
|
+
content: [{ type: 'text', text: `Tool argument error: ${JSON.stringify({ message, ...details })}` }],
|
|
47
|
+
isError: true,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
44
50
|
function fail(err) {
|
|
45
51
|
if (!API_KEY) {
|
|
46
52
|
return {
|
|
@@ -57,6 +63,16 @@ function fail(err) {
|
|
|
57
63
|
};
|
|
58
64
|
}
|
|
59
65
|
async function get(path, params) {
|
|
66
|
+
const allowedParams = allowedQueryParams[path];
|
|
67
|
+
if (allowedParams && params) {
|
|
68
|
+
const unknownParams = Object.keys(params).filter((key) => !allowedParams.has(key));
|
|
69
|
+
if (unknownParams.length) {
|
|
70
|
+
return usageError(`Unknown query parameter(s): ${unknownParams.join(', ')}`, {
|
|
71
|
+
unknownParams,
|
|
72
|
+
allowedParams: [...allowedParams].sort(),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
60
76
|
try {
|
|
61
77
|
const r = await http.get(path, { params });
|
|
62
78
|
return ok(r.data);
|
|
@@ -84,28 +100,67 @@ async function put(path, body) {
|
|
|
84
100
|
}
|
|
85
101
|
}
|
|
86
102
|
const server = new McpServer({ name: 'teamlink-mcp', version: pkgVersion() });
|
|
103
|
+
function strictTool(name, description, inputSchema, callback) {
|
|
104
|
+
return server.registerTool(name, {
|
|
105
|
+
description,
|
|
106
|
+
inputSchema: z.object(inputSchema).strict(),
|
|
107
|
+
}, callback);
|
|
108
|
+
}
|
|
109
|
+
const allowedQueryParams = {
|
|
110
|
+
'/accounts/search': new Set([
|
|
111
|
+
'mode', 'q', 'csaId', 'accountId', 'alphaId', 'name', 'address', 'phone', 'website',
|
|
112
|
+
'exactWebsite', 'isActive', 'isCustomer', 'isProspect', 'isSupplier', 'isBranch',
|
|
113
|
+
'branchId', 'teamId', 'page', 'pageSize',
|
|
114
|
+
]),
|
|
115
|
+
'/accounts': new Set(['search', 'isActive', 'isCustomer', 'isProspect', 'isSupplier', 'isBranch', 'branchId', 'teamId', 'page', 'pageSize']),
|
|
116
|
+
'/contacts/search': new Set([
|
|
117
|
+
'mode', 'q', 'cscId', 'contactId', 'firstName', 'lastName', 'fullName', 'shortName',
|
|
118
|
+
'csaId', 'accountId', 'email', 'mobile', 'businessPhone', 'isActive', 'role', 'page', 'pageSize',
|
|
119
|
+
]),
|
|
120
|
+
'/tasks/time-entries/search': new Set(['taskId', 'accountId', 'personId', 'type', 'q', 'dateFrom', 'dateTo', 'page', 'pageSize']),
|
|
121
|
+
'/tasks/search': new Set(['q', 'accountId', 'loggedForUserId', 'assignedToUserId', 'enteredByUserId', 'callType', 'priority', 'status', 'dateFrom', 'dateTo', 'page', 'pageSize']),
|
|
122
|
+
'/crm/activities/search': new Set(['q', 'accountId', 'assignedToUserId', 'targetContactId', 'enteredByUserId', 'completed', 'dateDueFrom', 'dateDueTo', 'page', 'pageSize']),
|
|
123
|
+
'/crm/activities/time-entries/search': new Set(['activityId', 'accountId', 'personId', 'q', 'dateFrom', 'dateTo', 'page', 'pageSize']),
|
|
124
|
+
'/orders/search': new Set(['q', 'advanced', 'accountId', 'branchId', 'enteredByUserId', 'authorisedByUserId', 'vendorId', 'receivedByUserId', 'approvedByUserId', 'invoicedByUserId', 'returnAuthorisedByUserId', 'creditedByUserId', 'orderType', 'dateFrom', 'dateTo', 'received', 'invoiced', 'returned', 'page', 'pageSize']),
|
|
125
|
+
'/orders/products/search': new Set(['q', 'supplierId', 'vendorId', 'manufacturer', 'category', 'inStock', 'page', 'pageSize']),
|
|
126
|
+
};
|
|
87
127
|
// --- Identity ---
|
|
88
|
-
|
|
128
|
+
strictTool('teamlink_whoami', 'Return the authenticated TEAMlink user context for the configured API key, including `roleClass` (CSCClass) and `homeAccountId` (CSAID — the identity key scoping staff vs customer visibility).', {}, async () => get('/me'));
|
|
89
129
|
// --- CRM: accounts ---
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
130
|
+
strictTool('crm_search_accounts', 'Search customer accounts. `csaId` is canonical for CSAccount.CSAID; `accountId` is accepted as a compatibility alias. Default mode is standard: exact case-insensitive matches. Fuzzy mode performs partial text/phone matching and name DIFFERENCE() matching. `isActive` defaults true unless explicitly set.', {
|
|
131
|
+
mode: z.enum(['standard', 'fuzzy']).optional().describe('Search mode. standard=exact case-insensitive matching; fuzzy=partial matching plus DIFFERENCE() for names. Defaults to standard.'),
|
|
132
|
+
q: z.string().optional().describe('General search value matched against csaId, alphaId, name, address, phone, and website.'),
|
|
133
|
+
csaId: z.number().optional().describe('Canonical account primary key (CSAccount.CSAID).'),
|
|
134
|
+
accountId: z.number().optional().describe('Compatibility alias for csaId. Prefer csaId.'),
|
|
135
|
+
alphaId: z.string().optional(),
|
|
136
|
+
name: z.string().optional(),
|
|
137
|
+
address: z.string().optional(),
|
|
138
|
+
phone: z.string().optional().describe('Phone search; punctuation/spaces are ignored.'),
|
|
139
|
+
website: z.string().optional(),
|
|
140
|
+
exactWebsite: z.string().optional().describe('Compatibility alias for website. Prefer website.'),
|
|
141
|
+
isActive: z.boolean().optional().describe('Defaults to true if omitted.'),
|
|
142
|
+
isCustomer: z.boolean().optional(),
|
|
143
|
+
isProspect: z.boolean().optional(),
|
|
144
|
+
isSupplier: z.boolean().optional(),
|
|
145
|
+
isBranch: z.boolean().optional(),
|
|
146
|
+
branchId: z.string().optional(),
|
|
147
|
+
teamId: z.number().optional(),
|
|
94
148
|
page: z.number().optional(),
|
|
95
149
|
pageSize: z.number().optional(),
|
|
96
150
|
}, async (args) => get('/accounts/search', args));
|
|
97
|
-
|
|
151
|
+
strictTool('crm_list_accounts', 'Deprecated compatibility wrapper for listing/filtering accounts. Prefer crm_search_accounts for new work. `isActive` filters on CSAActive — only active accounts are eligible for transactional activity (orders/tasks).', {
|
|
98
152
|
search: z.string().optional(), isActive: z.boolean().optional(), isCustomer: z.boolean().optional(), isProspect: z.boolean().optional(),
|
|
99
|
-
isSupplier: z.boolean().optional(),
|
|
153
|
+
isSupplier: z.boolean().optional(), isBranch: z.boolean().optional(), branchId: z.string().optional(), teamId: z.number().optional(),
|
|
154
|
+
page: z.number().optional(), pageSize: z.number().optional(),
|
|
100
155
|
}, async (args) => get('/accounts', args));
|
|
101
156
|
// `accountId` (CSAID) is the absolute source-of-truth identity key for this account
|
|
102
157
|
// and everything linked to it (contacts, orders, tasks, ...) — see lookup_selectors
|
|
103
158
|
// and crm_search_accounts for how to resolve one. Response `isActive` = CSAActive:
|
|
104
159
|
// only active accounts are eligible for transactional activity (orders/tasks).
|
|
105
|
-
|
|
106
|
-
|
|
160
|
+
strictTool('crm_get_account', 'Get one account by id (CSAID). Response `isActive` (CSAActive) gates transactional eligibility for orders/tasks. Lookup-backed fields include industry/source/salesStatus {code,label}, team {teamId,name}, and accountManager/preferredEngineer/backupEngineer/bizDevManager {userId,name}.', { accountId: z.number() }, async ({ accountId }) => get(`/accounts/${accountId}`));
|
|
161
|
+
strictTool('crm_list_account_contacts', 'List contacts linked to an account. Defaults to active-only (CSPCA_Active); pass includeInactive=true to also return deactivated contacts for historical/reporting purposes — inactive does not mean deleted.', { accountId: z.number(), includeInactive: z.boolean().optional() }, async ({ accountId, includeInactive }) => get(`/accounts/${accountId}/contacts`, { includeInactive }));
|
|
107
162
|
if (READWRITE) {
|
|
108
|
-
|
|
163
|
+
strictTool('crm_create_account', 'Create an account. Returns duplicate-candidate warnings unless createAnyway=true.', {
|
|
109
164
|
name: z.string(), alphaId: z.string().optional(), website: z.string().optional(), phone: z.string().optional(),
|
|
110
165
|
isCustomer: z.boolean().optional(), isProspect: z.boolean().optional(), createAnyway: z.boolean().optional(),
|
|
111
166
|
}, async (args) => post('/accounts', args));
|
|
@@ -118,47 +173,87 @@ if (READWRITE) {
|
|
|
118
173
|
// TYPE) — typeFlags.isAdminContact means a client-side admin/accounts contact,
|
|
119
174
|
// NOT the application admin role (role="A").
|
|
120
175
|
const roleDescription = 'CSCClass web-app role: A=Administrator, C=Customer, E=Engineer, M=Business Manager, P=Partner, S=Sales, T=Account Manager.';
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
176
|
+
strictTool('crm_search_contacts', 'Search contacts. `cscId` is canonical for CSContact.CSCID; `contactId` is accepted as a compatibility alias. `csaId` is canonical for account linkage; `accountId` is accepted as a compatibility alias. Default mode is standard: exact case-insensitive matches. Fuzzy mode performs partial matching.', {
|
|
177
|
+
mode: z.enum(['standard', 'fuzzy']).optional().describe('Search mode. standard=exact case-insensitive matching; fuzzy=partial matching. Defaults to standard.'),
|
|
178
|
+
q: z.string().optional().describe('General search value matched against cscId/contactId, names, email, mobile, and business phone.'),
|
|
179
|
+
cscId: z.number().optional().describe('Canonical contact primary key (CSContact.CSCID).'),
|
|
180
|
+
contactId: z.number().optional().describe('Compatibility alias for cscId. Prefer cscId.'),
|
|
181
|
+
firstName: z.string().optional(),
|
|
182
|
+
lastName: z.string().optional(),
|
|
183
|
+
fullName: z.string().optional(),
|
|
184
|
+
shortName: z.string().optional(),
|
|
185
|
+
csaId: z.number().optional().describe('Canonical linked account primary key (CSAccount.CSAID / CSPivotContactAccount.CSPCA_CSAID).'),
|
|
186
|
+
accountId: z.number().optional().describe('Compatibility alias for csaId. Prefer csaId.'),
|
|
187
|
+
email: z.string().optional(),
|
|
188
|
+
mobile: z.string().optional().describe('Mobile phone search; punctuation/spaces are ignored.'),
|
|
189
|
+
businessPhone: z.string().optional().describe('Business/DDI phone search; punctuation/spaces are ignored.'),
|
|
125
190
|
isActive: z.boolean().optional().describe('Filter by CSPivotContactAccount.CSPCA_Active when pivot context is joined.'),
|
|
126
191
|
role: z.string().optional().describe(roleDescription),
|
|
127
192
|
page: z.number().optional(), pageSize: z.number().optional(),
|
|
128
193
|
}, async (args) => get('/contacts/search', args));
|
|
129
|
-
|
|
194
|
+
strictTool('crm_get_contact', 'Get one contact by id. Response includes `role` (CSCClass) and `typeFlags` (contact type, distinct from role), `homeAccountId` (the CSAID this contact belongs to), and `isActive` — sourced from the CSPivotContactAccount pivot (CSPCA_Active), NOT the legacy/unused CSCActive column. An inactive contact may still be returned for historical/reporting purposes.', { contactId: z.number() }, async ({ contactId }) => get(`/contacts/${contactId}`));
|
|
130
195
|
if (READWRITE) {
|
|
131
|
-
|
|
196
|
+
strictTool('crm_create_contact', 'Create a contact under an account (also creates the active account link).', {
|
|
132
197
|
accountId: z.number(), firstName: z.string(), lastName: z.string(), email: z.string(),
|
|
133
198
|
mobile: z.string().optional(), businessPhone: z.string().optional(),
|
|
134
199
|
role: z.string().optional().describe(roleDescription + ' Only settable for branch accounts; forced to C otherwise.'),
|
|
135
200
|
}, async ({ accountId, ...body }) => post(`/accounts/${accountId}/contacts`, body));
|
|
136
|
-
|
|
201
|
+
strictTool('crm_update_contact', 'Update a contact. Password only applied if supplied. `active` sets CSPivotContactAccount.CSPCA_Active for the account context (the legacy CSCActive column is never written).', {
|
|
137
202
|
contactId: z.number(), firstName: z.string(), lastName: z.string(), email: z.string(), mobile: z.string().optional(),
|
|
138
203
|
role: z.string().optional().describe(roleDescription),
|
|
139
204
|
active: z.boolean().optional().describe('Sets CSPCA_Active (pivot) for the account context, not CSCActive.'),
|
|
140
205
|
}, async ({ contactId, ...body }) => put(`/contacts/${contactId}`, body));
|
|
141
206
|
}
|
|
142
207
|
// --- Lookups ---
|
|
143
|
-
|
|
144
|
-
|
|
208
|
+
strictTool('lookup_selectors', 'Get options for a CSSelectors list (Industry, Source, SalesStatus, OrderType, IncomeCat, City, Country, ...).', { selectorClass: z.string() }, async ({ selectorClass }) => get(`/lookups/selectors/${encodeURIComponent(selectorClass)}`));
|
|
209
|
+
strictTool('lookup_branches', 'List branches.', {}, async () => get('/lookups/branches'));
|
|
210
|
+
// --- CRM: sales activities / time (read) ---
|
|
211
|
+
strictTool('crm_activity_get', 'Get one CRM sales activity by id (CRMActivity.CRMAID). Returns account, enteredBy, assignedTo, targetContact, type/subType selector labels, due/completed dates, and completed boolean.', { activityId: z.number().describe('CRM activity ID (CRMActivity.CRMAID).') }, async ({ activityId }) => get(`/crm/activities/${activityId}`));
|
|
212
|
+
strictTool('crm_activity_search', 'Search/filter CRM sales activities (CRMActivity). Supports customer/account, assigned-to staff, targeted-at contact, entered-by staff, completed/open state, due-date range, and free text. `completed=true` means CRMADateCompleted is not null; `completed=false` means open.', {
|
|
213
|
+
q: z.string().optional().describe('Free text: exact activity ID match, or partial match on description/type/subtype labels.'),
|
|
214
|
+
accountId: z.number().optional().describe('Filter by customer/account/company (CSAID). Maps to CRMActivity.CRMA_CSAID.'),
|
|
215
|
+
assignedToUserId: z.number().optional().describe('Filter by assigned staff/contact (CRMActivity.CRMAAssignedTo_CSCID).'),
|
|
216
|
+
targetContactId: z.number().optional().describe('Filter by targeted-at contact (CRMActivity.CRMA_CSCID_Target).'),
|
|
217
|
+
enteredByUserId: z.number().optional().describe('Filter by staff/contact who entered the activity (CRMActivity.CRMA_CSCID).'),
|
|
218
|
+
completed: z.boolean().optional().describe('true = CRMADateCompleted is not null; false = CRMADateCompleted is null; omitted = all.'),
|
|
219
|
+
dateDueFrom: z.string().optional().describe('Due-date range start (CRMActivity.CRMADateDue), e.g. 2026-01-01.'),
|
|
220
|
+
dateDueTo: z.string().optional().describe('Due-date range end (CRMActivity.CRMADateDue).'),
|
|
221
|
+
page: z.number().optional(),
|
|
222
|
+
pageSize: z.number().optional(),
|
|
223
|
+
}, async (args) => get('/crm/activities/search', args));
|
|
224
|
+
strictTool('crm_activity_list_time_entries', 'List time entries + totals for a CRM sales activity. CRM activity time is TMActivity with TMAType=A and TMA_CRMAID=CRMActivity.CRMAID.', {
|
|
225
|
+
activityId: z.number().describe('CRM activity ID (CRMActivity.CRMAID / TMActivity.TMA_CRMAID).'),
|
|
226
|
+
personId: z.number().optional().describe('Filter by staff person who performed the work (TMActivity.TMA_CSCID).'),
|
|
227
|
+
}, async ({ activityId, personId }) => get(`/crm/activities/${activityId}/time-entries`, { personId }));
|
|
228
|
+
strictTool('crm_activity_search_time_entries', 'Search CRM sales activity time entries across activities. Supports filtering by activityId, account/customer (CRMActivity.CRMA_CSAID), staff performer (TMActivity.TMA_CSCID), date range, and text in time-entry or activity descriptions.', {
|
|
229
|
+
activityId: z.number().optional().describe('Filter by CRM activity ID (TMActivity.TMA_CRMAID).'),
|
|
230
|
+
accountId: z.number().optional().describe('Filter by customer/account/company (CSAID). Maps through CRMActivity.CRMA_CSAID.'),
|
|
231
|
+
personId: z.number().optional().describe('Filter by staff person who performed the work (TMActivity.TMA_CSCID).'),
|
|
232
|
+
q: z.string().optional().describe('Partial text match against TMActivity.TMADescription, TMActivity.TMAInternal, or CRMActivity.CRMADescription.'),
|
|
233
|
+
dateFrom: z.string().optional().describe('Activity time-entry date range start (TMActivity.TMADate), e.g. 2026-01-01.'),
|
|
234
|
+
dateTo: z.string().optional().describe('Activity time-entry date range end (TMActivity.TMADate).'),
|
|
235
|
+
page: z.number().optional(),
|
|
236
|
+
pageSize: z.number().optional(),
|
|
237
|
+
}, async (args) => get('/crm/activities/time-entries/search', args));
|
|
145
238
|
// --- Tasks / time (read) ---
|
|
146
|
-
|
|
147
|
-
|
|
239
|
+
strictTool('task_get', 'Get a task by id. Returns account/bill-to and contact actor fields as objects with IDs and names, while retaining raw ID fields.', { taskId: z.number() }, async ({ taskId }) => get(`/tasks/${taskId}`));
|
|
240
|
+
strictTool('task_list_time_entries', 'List time/incidental entries + totals for a task. Can filter by staff person who performed the work (TMActivity.TMA_CSCID).', {
|
|
148
241
|
taskId: z.number().describe('Task ID (TMTask.TMTID / TMActivity.TMA_TMTID).'),
|
|
149
242
|
personId: z.number().optional().describe('Filter by staff person who performed the work (TMActivity.TMA_CSCID).'),
|
|
150
243
|
type: z.enum(['time', 'incidentals', 'all']).optional().describe('Entry kind based on TMActivity.TMACost: time = TMACost 0, incidentals = TMACost non-zero.'),
|
|
151
244
|
}, async ({ taskId, personId, type }) => get(`/tasks/${taskId}/time-entries`, { personId, type }));
|
|
152
|
-
|
|
245
|
+
strictTool('task_search_time_entries', 'Search task activity/time and incidentals across tasks. Supports filtering by account/customer (TMTask.TMT_CSAID), taskId, staff performer (TMActivity.TMA_CSCID), date range, entry kind, and text in public/internal descriptions. Date filters are `dateFrom`/`dateTo` only; do not use `fromDate`/`toDate`.', {
|
|
153
246
|
taskId: z.number().optional().describe('Filter by task ID (TMActivity.TMA_TMTID).'),
|
|
247
|
+
accountId: z.number().optional().describe('Filter by customer/account/company (CSAID). Maps through TMTask.TMT_CSAID for the task the entry belongs to.'),
|
|
154
248
|
personId: z.number().optional().describe('Filter by staff person who performed the work (TMActivity.TMA_CSCID).'),
|
|
155
249
|
type: z.enum(['time', 'incidentals', 'all']).optional().describe('Entry kind based on TMActivity.TMACost: time = TMACost 0, incidentals = TMACost non-zero.'),
|
|
156
|
-
|
|
157
|
-
|
|
250
|
+
q: z.string().optional().describe('Partial text match against TMActivity.TMADescription and TMActivity.TMAInternal.'),
|
|
251
|
+
dateFrom: z.string().optional().describe('Activity date range start (TMActivity.TMADate), e.g. 2026-01-01. Use this exact parameter name, not fromDate.'),
|
|
252
|
+
dateTo: z.string().optional().describe('Activity date range end (TMActivity.TMADate). Use this exact parameter name, not toDate.'),
|
|
158
253
|
page: z.number().optional(),
|
|
159
254
|
pageSize: z.number().optional(),
|
|
160
255
|
}, async (args) => get('/tasks/time-entries/search', args));
|
|
161
|
-
|
|
256
|
+
strictTool('task_search', 'Search/filter tasks. Supports filtering by customer/account, logged-for contact, assigned staff member, entered-by staff member, call type, priority/severity, open/closed status, a date-logged range, and/or free text. Defaults to open tasks only unless status is set. Every filter is optional and combinable. Results include account/loggedFor/assignedTo/enteredBy objects with names, plus raw IDs.', {
|
|
162
257
|
q: z.string().optional().describe('Free text: exact task ID match, or partial match on task name/description.'),
|
|
163
258
|
accountId: z.number().optional().describe('Filter by customer/account/company (CSAID). Maps to TMTask.TMT_CSAID — the account the task was logged for.'),
|
|
164
259
|
loggedForUserId: z.number().optional().describe('Filter by the customer contact who requested/is authorising the task (TMTask.TMTLoggedBy_CSCID).'),
|
|
@@ -172,9 +267,9 @@ server.tool('task_search', 'Search/filter tasks. Supports filtering by customer/
|
|
|
172
267
|
page: z.number().optional(), pageSize: z.number().optional(),
|
|
173
268
|
}, async (args) => get('/tasks/search', args));
|
|
174
269
|
// --- Orders / PM (read) ---
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
270
|
+
strictTool('order_get', 'Get an order header + totals. Returns account/bill-to and contact actor fields as objects with IDs and names, while retaining raw ID fields. `orderType` is returned as { code, label } from CSSelectors/OrderType.', { orderId: z.number() }, async ({ orderId }) => get(`/orders/${orderId}`));
|
|
271
|
+
strictTool('order_list_items', 'List order line items.', { orderId: z.number() }, async ({ orderId }) => get(`/orders/${orderId}/items`));
|
|
272
|
+
strictTool('order_search', 'Search/filter orders. Supports filtering by customer/account, branch, order type, a date-raised range, who entered or authorised the order, who received/approved/invoiced/returned/credited a line, received/invoiced/returned status, and/or free text (order id, invoice/credit/RA reference, or with advanced=true also notes and product codes/descriptions). Every filter is optional and combinable. Results include account/enteredBy/authorisedBy objects with names, plus raw IDs. Returned `orderType` is { code, label } resolved from CSSelectors/OrderType.', {
|
|
178
273
|
q: z.string().optional().describe('Free text search — order id (exact), invoice/credit/RA reference (partial); with advanced=true also order notes and line product code/OEM code/descriptions.'),
|
|
179
274
|
advanced: z.boolean().optional().describe('Widen `q` to also match order notes and line product code/OEM code/descriptions.'),
|
|
180
275
|
accountId: z.number().optional().describe('Filter by customer/account/company (CSAID). Maps to PMOrder.PMO_CSAID.'),
|
|
@@ -195,10 +290,13 @@ server.tool('order_search', 'Search/filter orders. Supports filtering by custome
|
|
|
195
290
|
returned: z.enum(['yes', 'no']).optional().describe('Whether at least one line has a return reason set. Same "at least one line" semantics as `received`.'),
|
|
196
291
|
page: z.number().optional(), pageSize: z.number().optional(),
|
|
197
292
|
}, async (args) => get('/orders/search', args));
|
|
198
|
-
|
|
199
|
-
q: z.string().optional(),
|
|
293
|
+
strictTool('product_search', 'Search the read-only product catalog. `q` splits on whitespace and requires every word to match as a substring in code, OEM code, description, manufacturer, or category. Filter by supplier/vendor and stock availability.', {
|
|
294
|
+
q: z.string().optional(),
|
|
295
|
+
supplierId: z.number().optional().describe('Canonical supplier/vendor account id (PMProduct.PMPVendor_CSAID).'),
|
|
296
|
+
vendorId: z.number().optional().describe('Compatibility alias for supplierId. Prefer supplierId.'),
|
|
200
297
|
manufacturer: z.string().optional().describe('Exact match on PMPManufacturer.'),
|
|
201
298
|
category: z.string().optional().describe('Exact match on PMPProductCategory_ID.'),
|
|
299
|
+
inStock: z.boolean().optional().describe('true = PMPOnHand > 0; false = no stock on hand.'),
|
|
202
300
|
page: z.number().optional(), pageSize: z.number().optional(),
|
|
203
301
|
}, async (args) => get('/orders/products/search', args));
|
|
204
302
|
async function main() {
|