@teamnetwork-nz/teamlink-mcp-server 0.6.2 → 0.6.5
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/dist/index.js +25 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -127,7 +127,7 @@ function strictTool(name, description, inputSchema, callback) {
|
|
|
127
127
|
}
|
|
128
128
|
const allowedQueryParams = {
|
|
129
129
|
'/accounts/search': new Set([
|
|
130
|
-
'mode', 'q', 'accountId', 'alphaId', 'name', 'address', 'phone', 'website',
|
|
130
|
+
'mode', 'q', 'accountId', 'alphaId', 'name', 'address', 'phone', 'website', 'emailDomain',
|
|
131
131
|
'exactWebsite', 'isActive', 'isCustomer', 'isProspect', 'isSupplier', 'isBranch',
|
|
132
132
|
'branchId', 'teamId', 'page', 'pageSize',
|
|
133
133
|
]),
|
|
@@ -140,21 +140,22 @@ const allowedQueryParams = {
|
|
|
140
140
|
'/tasks/search': new Set(['q', 'accountId', 'loggedForUserId', 'assignedToUserId', 'enteredByUserId', 'callType', 'priority', 'status', 'dateFrom', 'dateTo', 'page', 'pageSize']),
|
|
141
141
|
'/crm/activities/search': new Set(['q', 'accountId', 'assignedToUserId', 'targetContactId', 'enteredByUserId', 'completed', 'dateDueFrom', 'dateDueTo', 'page', 'pageSize']),
|
|
142
142
|
'/crm/activities/time-entries/search': new Set(['activityId', 'accountId', 'personId', 'q', 'dateFrom', 'dateTo', 'page', 'pageSize']),
|
|
143
|
-
'/orders/search': new Set(['q', 'advanced', 'accountId', 'branchId', 'enteredByUserId', 'authorisedByUserId', 'vendorId', 'receivedByUserId', 'approvedByUserId', 'invoicedByUserId', 'returnAuthorisedByUserId', 'creditedByUserId', 'orderType', 'dateFrom', 'dateTo', 'received', 'invoiced', 'returned', 'page', 'pageSize']),
|
|
143
|
+
'/orders/search': new Set(['q', 'advanced', 'invoiceNumber', 'creditReference', 'returnAuthorisationReference', 'customerOrderReference', 'accountId', 'branchId', 'enteredByUserId', 'authorisedByUserId', 'vendorId', 'receivedByUserId', 'approvedByUserId', 'invoicedByUserId', 'returnAuthorisedByUserId', 'creditedByUserId', 'orderType', 'dateFrom', 'dateTo', 'received', 'invoiced', 'returned', 'credited', 'page', 'pageSize']),
|
|
144
144
|
'/orders/products/search': new Set(['q', 'supplierId', 'vendorId', 'manufacturer', 'category', 'inStock', 'page', 'pageSize']),
|
|
145
145
|
};
|
|
146
146
|
// --- Identity ---
|
|
147
147
|
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'));
|
|
148
148
|
// --- CRM: accounts ---
|
|
149
|
-
strictTool('crm_search_accounts', 'Search
|
|
149
|
+
strictTool('crm_search_accounts', 'Search CRM accounts, including customers, prospects, and suppliers. `accountId` is the canonical public identity. Standard mode uses exact case-insensitive matching except `emailDomain`, which is always partial and domain-normalized. Fuzzy mode performs partial text/phone matching and name DIFFERENCE() matching. Boolean/account filters may be used without a text criterion. `isActive` defaults true unless explicitly set.', {
|
|
150
150
|
mode: z.enum(['standard', 'fuzzy']).optional().describe('Search mode. standard=exact case-insensitive matching; fuzzy=partial matching plus DIFFERENCE() for names. Defaults to standard.'),
|
|
151
|
-
q: z.string().optional().describe('General search value matched against accountId, alphaId, name, address, phone, and
|
|
151
|
+
q: z.string().optional().describe('General search value matched against accountId, alphaId, name, address, phone, website, and emailDomain.'),
|
|
152
152
|
accountId: z.number().optional().describe('Canonical public account identifier. Maps to CSAccount.CSAID in SQL.'),
|
|
153
153
|
alphaId: z.string().optional(),
|
|
154
154
|
name: z.string().optional(),
|
|
155
155
|
address: z.string().optional(),
|
|
156
156
|
phone: z.string().optional().describe('Phone search; punctuation/spaces are ignored.'),
|
|
157
157
|
website: z.string().optional(),
|
|
158
|
+
emailDomain: z.string().optional().describe('Partial, case-insensitive domain search across emailDomain and website. Accepts a domain, email address, or URL; scheme and leading www are ignored.'),
|
|
158
159
|
exactWebsite: z.string().optional().describe('Compatibility alias for website. Prefer website.'),
|
|
159
160
|
isActive: z.boolean().optional().describe('Defaults to true if omitted.'),
|
|
160
161
|
isCustomer: z.boolean().optional(),
|
|
@@ -233,6 +234,20 @@ if (READWRITE) {
|
|
|
233
234
|
// --- Lookups ---
|
|
234
235
|
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)}`));
|
|
235
236
|
strictTool('lookup_branches', 'List branches.', {}, async () => get('/lookups/branches'));
|
|
237
|
+
// --- Account fees (read) ---
|
|
238
|
+
strictTool('fee_get', 'Get one account fee record from vw_CSFee by feeId. Returns the account, logged-by and assigned-to people, task snapshot, time/income details, quantity/unit cost, and action metadata.', { feeId: z.number().describe('Fee record ID (CSFee.CSFeeId).') }, async ({ feeId }) => get(`/fees/${feeId}`));
|
|
239
|
+
strictTool('fee_search', 'Search the read-only account fee view (vw_CSFee). Filter by account, logged-by or assigned-to person, fee period, action type, start-date range, or free text. Results are newest-starting first.', {
|
|
240
|
+
q: z.string().optional().describe('Exact feeId or partial account, task, time, PO reference, action-note, or fee-note text.'),
|
|
241
|
+
accountId: z.number().optional().describe('Filter by customer/account/company. Maps to CSFee_TASK_CSAID.'),
|
|
242
|
+
loggedByUserId: z.number().optional().describe('Filter by the contact captured as the task requester/logger.'),
|
|
243
|
+
assignedToUserId: z.number().optional().describe('Filter by the staff contact captured as task assignee.'),
|
|
244
|
+
period: z.string().optional().describe('Exact CSFee_Period value.'),
|
|
245
|
+
actionType: z.string().optional().describe('Exact CSFee_ActionType value.'),
|
|
246
|
+
dateFrom: z.string().optional().describe('Fee start-date range start (inclusive), e.g. 2026-01-01.'),
|
|
247
|
+
dateTo: z.string().optional().describe('Fee start-date range end (inclusive).'),
|
|
248
|
+
page: z.number().optional(),
|
|
249
|
+
pageSize: z.number().optional(),
|
|
250
|
+
}, async (args) => get('/fees/search', args));
|
|
236
251
|
// --- CRM: sales activities / time (read) ---
|
|
237
252
|
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}`));
|
|
238
253
|
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.', {
|
|
@@ -294,11 +309,15 @@ strictTool('task_search', 'Search/filter tasks. Supports filtering by customer/a
|
|
|
294
309
|
page: z.number().optional(), pageSize: z.number().optional(),
|
|
295
310
|
}, async (args) => get('/tasks/search', args));
|
|
296
311
|
// --- Orders / PM (read) ---
|
|
297
|
-
strictTool('order_get', 'Get an order header
|
|
312
|
+
strictTool('order_get', 'Get an order header, totals, and statusFlags. `statusFlags` reports unapproved/unreceived lines, completion, and returns awaiting credit using the same semantics as order_search. `account` is the resale customer, not the supplier. `vendors` contains every distinct supplier from the order lines; `vendor` is populated only for a single-vendor order. Returns account/bill-to and contact actor fields as objects with IDs and names. `orderType` is returned as { code, label } from CSSelectors/OrderType.', { orderId: z.number() }, async ({ orderId }) => get(`/orders/${orderId}`));
|
|
298
313
|
strictTool('order_list_items', 'List order line items.', { orderId: z.number() }, async ({ orderId }) => get(`/orders/${orderId}/items`));
|
|
299
314
|
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.', {
|
|
300
315
|
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.'),
|
|
301
316
|
advanced: z.boolean().optional().describe('Widen `q` to also match order notes and line product code/OEM code/descriptions.'),
|
|
317
|
+
invoiceNumber: z.union([z.string(), z.number()]).transform(String).optional().describe('Exact supplier invoice number. Numeric values are accepted and preserved as reference strings.'),
|
|
318
|
+
creditReference: z.union([z.string(), z.number()]).transform(String).optional().describe('Exact supplier credit reference.'),
|
|
319
|
+
returnAuthorisationReference: z.union([z.string(), z.number()]).transform(String).optional().describe('Exact return-authorisation reference.'),
|
|
320
|
+
customerOrderReference: z.union([z.string(), z.number()]).transform(String).optional().describe('Exact customer order reference.'),
|
|
302
321
|
accountId: z.number().optional().describe('Filter by customer/account/company (CSAID). Maps to PMOrder.PMO_CSAID.'),
|
|
303
322
|
branchId: z.string().optional().describe('Filter by the branch that owns the order account (CSA_CSBID).'),
|
|
304
323
|
enteredByUserId: z.number().optional().describe('Filter by the staff member who entered/created the order (PMOrder.PMO_CSCID).'),
|
|
@@ -315,6 +334,7 @@ strictTool('order_search', 'Search/filter orders. Supports filtering by customer
|
|
|
315
334
|
received: z.enum(['yes', 'no']).optional().describe('Whether at least one line has been received. Not mutually exclusive with `no` — an order can have both received and unreceived lines.'),
|
|
316
335
|
invoiced: z.enum(['yes', 'no']).optional().describe('Whether at least one line has been invoiced. Same "at least one line" semantics as `received`.'),
|
|
317
336
|
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`.'),
|
|
337
|
+
credited: z.enum(['yes', 'no']).optional().describe('Whether at least one line has supplier credit recorded.'),
|
|
318
338
|
page: z.number().optional(), pageSize: z.number().optional(),
|
|
319
339
|
}, async (args) => get('/orders/search', args));
|
|
320
340
|
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.', {
|