@teamnetwork-nz/teamlink-mcp-server 0.6.8 → 0.7.0
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 +2 -0
- package/dist/index.js +23 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,8 @@ The example URL is deliberately non-routable. Configure your own service URL and
|
|
|
49
49
|
|
|
50
50
|
Do not substitute alpha IDs, person IDs or branch IDs for `accountId`. Preserve response warnings, pagination and status information; tool errors are not empty search results.
|
|
51
51
|
|
|
52
|
+
Every tool accepts optional `outputFormat: "json"`. Set it when the result must be valid JSON text with no Markdown wrapper. When omitted, the existing result formatting is used. The option is handled by the MCP server and is never sent as a TEAMlink API parameter.
|
|
53
|
+
|
|
52
54
|
## Development
|
|
53
55
|
|
|
54
56
|
```powershell
|
package/dist/index.js
CHANGED
|
@@ -121,8 +121,27 @@ function strictTool(name, description, inputSchema, callback) {
|
|
|
121
121
|
registrations.push((server) => {
|
|
122
122
|
server.registerTool(name, {
|
|
123
123
|
description,
|
|
124
|
-
inputSchema: z.object(
|
|
125
|
-
|
|
124
|
+
inputSchema: z.object({
|
|
125
|
+
...inputSchema,
|
|
126
|
+
outputFormat: z.enum(['json']).optional().describe('When set to "json", return the result as valid JSON text. Omit to keep the default response.'),
|
|
127
|
+
}).strict(),
|
|
128
|
+
}, async (args, extra) => {
|
|
129
|
+
const { outputFormat, ...toolArgs } = args;
|
|
130
|
+
const result = await callback(toolArgs, extra);
|
|
131
|
+
if (outputFormat !== 'json' || result.isError)
|
|
132
|
+
return result;
|
|
133
|
+
const formatted = result.content.map((item) => {
|
|
134
|
+
if (item.type !== 'text')
|
|
135
|
+
return item;
|
|
136
|
+
try {
|
|
137
|
+
return { ...item, text: JSON.stringify(JSON.parse(item.text), null, 2) };
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
return { ...item, text: JSON.stringify(item.text) };
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
return { ...result, content: formatted };
|
|
144
|
+
});
|
|
126
145
|
});
|
|
127
146
|
}
|
|
128
147
|
const allowedQueryParams = {
|
|
@@ -192,7 +211,7 @@ if (READWRITE) {
|
|
|
192
211
|
// TYPE) — typeFlags.isAdminContact means a client-side admin/accounts contact,
|
|
193
212
|
// NOT the application admin role (role="A").
|
|
194
213
|
const roleDescription = 'CSCClass web-app role: A=Administrator, C=Customer, E=Engineer, M=Business Manager, P=Partner, S=Sales, T=Account Manager.';
|
|
195
|
-
strictTool('crm_search_contacts', 'Search contacts. `cscId` is canonical for CSContact.CSCID; `contactId` is accepted as a compatibility alias. `accountId` is the canonical public name for account linkage and maps to CSAccount.CSAID / CSPivotContactAccount.CSPCA_CSAID in SQL. Default mode is standard: exact case-insensitive matches. Fuzzy mode performs partial matching.', {
|
|
214
|
+
strictTool('crm_search_contacts', 'Search contacts. Searches default to active account links (CSPCA_Active = 1), except an exact cscId/contactId lookup, which returns the contact regardless of link status and reports isActive. Account-scoped searches remain active-only by default. Set isActive=false to explicitly search inactive links. Related-object details (such as orders) can include inactive contacts. `cscId` is canonical for CSContact.CSCID; `contactId` is accepted as a compatibility alias. `accountId` is the canonical public name for account linkage and maps to CSAccount.CSAID / CSPivotContactAccount.CSPCA_CSAID in SQL. Default mode is standard: exact case-insensitive matches. Fuzzy mode performs partial matching.', {
|
|
196
215
|
mode: z.enum(['standard', 'fuzzy']).optional().describe('Search mode. standard=exact case-insensitive matching; fuzzy=partial matching. Defaults to standard.'),
|
|
197
216
|
q: z.string().optional().describe('General search value matched against cscId/contactId, names, email, mobile, and business phone.'),
|
|
198
217
|
cscId: z.number().optional().describe('Canonical contact primary key (CSContact.CSCID).'),
|
|
@@ -205,7 +224,7 @@ strictTool('crm_search_contacts', 'Search contacts. `cscId` is canonical for CSC
|
|
|
205
224
|
email: z.string().optional(),
|
|
206
225
|
mobile: z.string().optional().describe('Mobile phone search; punctuation/spaces are ignored.'),
|
|
207
226
|
businessPhone: z.string().optional().describe('Business/DDI phone search; punctuation/spaces are ignored.'),
|
|
208
|
-
isActive: z.boolean().optional().describe('
|
|
227
|
+
isActive: z.boolean().optional().describe('Defaults to true for account or general searches. Exact cscId/contactId lookups include either status by default and report it. Set false to search inactive links explicitly.'),
|
|
209
228
|
role: z.string().optional().describe(roleDescription),
|
|
210
229
|
page: z.number().optional().describe("Page number for the filtered search; follow API pagination metadata rather than assuming the first page is complete."), pageSize: z.number().optional().describe("Maximum results requested per page; choose the smallest size needed and respect API response limits."),
|
|
211
230
|
}, async (args) => get('/contacts/search', args));
|