@teamnetwork-nz/teamlink-mcp-server 0.5.4 → 0.5.6
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 +17 -8
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -87,8 +87,14 @@ const server = new McpServer({ name: 'teamlink-mcp', version: pkgVersion() });
|
|
|
87
87
|
// --- Identity ---
|
|
88
88
|
server.tool('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
89
|
// --- CRM: accounts ---
|
|
90
|
-
server.tool('crm_search_accounts', 'Search customer accounts by name, alpha id,
|
|
91
|
-
|
|
90
|
+
server.tool('crm_search_accounts', 'Search customer accounts by account id, name, alpha id, email domain, website, or normalized phone. Also accepts explicit phone and exactWebsite duplicate-detection style inputs. Results include selector objects for industry/source/salesStatus and named team/contact reference objects where available.', {
|
|
91
|
+
q: z.string().describe('Search text: account ID (CSAID), account name, alpha ID, email domain, website, or phone digits.'),
|
|
92
|
+
phone: z.string().optional().describe('Optional phone search; punctuation/spaces are ignored and partial digit matches are allowed against CSAccount.CSAPhone.'),
|
|
93
|
+
exactWebsite: z.string().optional().describe('Optional exact website match against CSAccount.CSAWebsite.'),
|
|
94
|
+
page: z.number().optional(),
|
|
95
|
+
pageSize: z.number().optional(),
|
|
96
|
+
}, async (args) => get('/accounts/search', args));
|
|
97
|
+
server.tool('crm_list_accounts', 'List/filter accounts. `isActive` filters on CSAActive — only active accounts are eligible for transactional activity (orders/tasks). Results include selector objects for industry/source/salesStatus and named team/contact reference objects where available.', {
|
|
92
98
|
search: z.string().optional(), isActive: z.boolean().optional(), isCustomer: z.boolean().optional(), isProspect: z.boolean().optional(),
|
|
93
99
|
isSupplier: z.boolean().optional(), branchId: z.string().optional(), page: z.number().optional(), pageSize: z.number().optional(),
|
|
94
100
|
}, async (args) => get('/accounts', args));
|
|
@@ -96,7 +102,7 @@ server.tool('crm_list_accounts', 'List/filter accounts. `isActive` filters on CS
|
|
|
96
102
|
// and everything linked to it (contacts, orders, tasks, ...) — see lookup_selectors
|
|
97
103
|
// and crm_search_accounts for how to resolve one. Response `isActive` = CSAActive:
|
|
98
104
|
// only active accounts are eligible for transactional activity (orders/tasks).
|
|
99
|
-
server.tool('crm_get_account', 'Get one account by id (CSAID). Response `isActive` (CSAActive) gates transactional eligibility for orders/tasks.', { accountId: z.number() }, async ({ accountId }) => get(`/accounts/${accountId}`));
|
|
105
|
+
server.tool('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}`));
|
|
100
106
|
server.tool('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 }));
|
|
101
107
|
if (READWRITE) {
|
|
102
108
|
server.tool('crm_create_account', 'Create an account. Returns duplicate-candidate warnings unless createAnyway=true.', {
|
|
@@ -112,8 +118,11 @@ if (READWRITE) {
|
|
|
112
118
|
// TYPE) — typeFlags.isAdminContact means a client-side admin/accounts contact,
|
|
113
119
|
// NOT the application admin role (role="A").
|
|
114
120
|
const roleDescription = 'CSCClass web-app role: A=Administrator, C=Customer, E=Engineer, M=Business Manager, P=Partner, S=Sales, T=Account Manager.';
|
|
115
|
-
server.tool('crm_search_contacts', 'Search contacts by
|
|
121
|
+
server.tool('crm_search_contacts', 'Search contacts by contact id, names, email, mobile, business phone, account id, web-app role (CSCClass), and active pivot status.', {
|
|
116
122
|
q: z.string().optional(), accountId: z.number().optional(), email: z.string().optional(),
|
|
123
|
+
mobile: z.string().optional().describe('Filter by mobile phone (CSContact.CSCMobile); punctuation/spaces are ignored and partial digit matches are allowed.'),
|
|
124
|
+
businessPhone: z.string().optional().describe('Filter by business/DDI phone (CSContact.CSCBizPhone); punctuation/spaces are ignored and partial digit matches are allowed.'),
|
|
125
|
+
isActive: z.boolean().optional().describe('Filter by CSPivotContactAccount.CSPCA_Active when pivot context is joined.'),
|
|
117
126
|
role: z.string().optional().describe(roleDescription),
|
|
118
127
|
page: z.number().optional(), pageSize: z.number().optional(),
|
|
119
128
|
}, async (args) => get('/contacts/search', args));
|
|
@@ -134,7 +143,7 @@ if (READWRITE) {
|
|
|
134
143
|
server.tool('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)}`));
|
|
135
144
|
server.tool('lookup_branches', 'List branches.', {}, async () => get('/lookups/branches'));
|
|
136
145
|
// --- Tasks / time (read) ---
|
|
137
|
-
server.tool('task_get', 'Get a task by id.', { taskId: z.number() }, async ({ taskId }) => get(`/tasks/${taskId}`));
|
|
146
|
+
server.tool('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}`));
|
|
138
147
|
server.tool('task_list_time_entries', 'List time/incidental entries + totals for a task. Can filter by staff person who performed the work (TMActivity.TMA_CSCID).', {
|
|
139
148
|
taskId: z.number().describe('Task ID (TMTask.TMTID / TMActivity.TMA_TMTID).'),
|
|
140
149
|
personId: z.number().optional().describe('Filter by staff person who performed the work (TMActivity.TMA_CSCID).'),
|
|
@@ -149,7 +158,7 @@ server.tool('task_search_time_entries', 'Search task activity/time and incidenta
|
|
|
149
158
|
page: z.number().optional(),
|
|
150
159
|
pageSize: z.number().optional(),
|
|
151
160
|
}, async (args) => get('/tasks/time-entries/search', args));
|
|
152
|
-
server.tool('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.', {
|
|
161
|
+
server.tool('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.', {
|
|
153
162
|
q: z.string().optional().describe('Free text: exact task ID match, or partial match on task name/description.'),
|
|
154
163
|
accountId: z.number().optional().describe('Filter by customer/account/company (CSAID). Maps to TMTask.TMT_CSAID — the account the task was logged for.'),
|
|
155
164
|
loggedForUserId: z.number().optional().describe('Filter by the customer contact who requested/is authorising the task (TMTask.TMTLoggedBy_CSCID).'),
|
|
@@ -163,9 +172,9 @@ server.tool('task_search', 'Search/filter tasks. Supports filtering by customer/
|
|
|
163
172
|
page: z.number().optional(), pageSize: z.number().optional(),
|
|
164
173
|
}, async (args) => get('/tasks/search', args));
|
|
165
174
|
// --- Orders / PM (read) ---
|
|
166
|
-
server.tool('order_get', 'Get an order header + totals. `orderType` is returned as { code, label } from CSSelectors/OrderType.', { orderId: z.number() }, async ({ orderId }) => get(`/orders/${orderId}`));
|
|
175
|
+
server.tool('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}`));
|
|
167
176
|
server.tool('order_list_items', 'List order line items.', { orderId: z.number() }, async ({ orderId }) => get(`/orders/${orderId}/items`));
|
|
168
|
-
server.tool('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. Returned `orderType` is { code, label } resolved from CSSelectors/OrderType.', {
|
|
177
|
+
server.tool('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.', {
|
|
169
178
|
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.'),
|
|
170
179
|
advanced: z.boolean().optional().describe('Widen `q` to also match order notes and line product code/OEM code/descriptions.'),
|
|
171
180
|
accountId: z.number().optional().describe('Filter by customer/account/company (CSAID). Maps to PMOrder.PMO_CSAID.'),
|