@zaapi/open-api-mcp 1.0.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 +37 -0
- package/dist/client.js +59 -0
- package/dist/client.js.map +1 -0
- package/dist/config.js +13 -0
- package/dist/config.js.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/server.js +68 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/close-ticket.js +21 -0
- package/dist/tools/close-ticket.js.map +1 -0
- package/dist/tools/common.js +29 -0
- package/dist/tools/common.js.map +1 -0
- package/dist/tools/contacts/create-contact.js +21 -0
- package/dist/tools/contacts/create-contact.js.map +1 -0
- package/dist/tools/contacts/get-contact-by-id.js +14 -0
- package/dist/tools/contacts/get-contact-by-id.js.map +1 -0
- package/dist/tools/contacts/list-contact-fields.js +12 -0
- package/dist/tools/contacts/list-contact-fields.js.map +1 -0
- package/dist/tools/contacts/list-contacts.js +22 -0
- package/dist/tools/contacts/list-contacts.js.map +1 -0
- package/dist/tools/contacts/update-contact-field.js +17 -0
- package/dist/tools/contacts/update-contact-field.js.map +1 -0
- package/dist/tools/conversations/filter-conversations.js +27 -0
- package/dist/tools/conversations/filter-conversations.js.map +1 -0
- package/dist/tools/conversations/mark-conversation-read.js +18 -0
- package/dist/tools/conversations/mark-conversation-read.js.map +1 -0
- package/dist/tools/conversations/update-conversation-labels.js +23 -0
- package/dist/tools/conversations/update-conversation-labels.js.map +1 -0
- package/dist/tools/create-contact.js +21 -0
- package/dist/tools/create-contact.js.map +1 -0
- package/dist/tools/create-internal-comment.js +15 -0
- package/dist/tools/create-internal-comment.js.map +1 -0
- package/dist/tools/filter-conversations.js +18 -0
- package/dist/tools/filter-conversations.js.map +1 -0
- package/dist/tools/get-contact-by-id.js +14 -0
- package/dist/tools/get-contact-by-id.js.map +1 -0
- package/dist/tools/get-messages.js +19 -0
- package/dist/tools/get-messages.js.map +1 -0
- package/dist/tools/get-ticket-by-id.js +16 -0
- package/dist/tools/get-ticket-by-id.js.map +1 -0
- package/dist/tools/index.js +62 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/labels/list-labels.js +16 -0
- package/dist/tools/labels/list-labels.js.map +1 -0
- package/dist/tools/list-contact-fields.js +12 -0
- package/dist/tools/list-contact-fields.js.map +1 -0
- package/dist/tools/list-contacts.js +22 -0
- package/dist/tools/list-contacts.js.map +1 -0
- package/dist/tools/list-internal-comments.js +17 -0
- package/dist/tools/list-internal-comments.js.map +1 -0
- package/dist/tools/list-labels.js +16 -0
- package/dist/tools/list-labels.js.map +1 -0
- package/dist/tools/list-teams.js +17 -0
- package/dist/tools/list-teams.js.map +1 -0
- package/dist/tools/list-ticket-fields.js +15 -0
- package/dist/tools/list-ticket-fields.js.map +1 -0
- package/dist/tools/list-tickets.js +88 -0
- package/dist/tools/list-tickets.js.map +1 -0
- package/dist/tools/list-users.js +16 -0
- package/dist/tools/list-users.js.map +1 -0
- package/dist/tools/mark-conversation-read.js +18 -0
- package/dist/tools/mark-conversation-read.js.map +1 -0
- package/dist/tools/messages/create-internal-comment.js +15 -0
- package/dist/tools/messages/create-internal-comment.js.map +1 -0
- package/dist/tools/messages/get-messages.js +29 -0
- package/dist/tools/messages/get-messages.js.map +1 -0
- package/dist/tools/messages/list-internal-comments.js +17 -0
- package/dist/tools/messages/list-internal-comments.js.map +1 -0
- package/dist/tools/messages/send-plain-text-message.js +15 -0
- package/dist/tools/messages/send-plain-text-message.js.map +1 -0
- package/dist/tools/send-plain-text-message.js +15 -0
- package/dist/tools/send-plain-text-message.js.map +1 -0
- package/dist/tools/teams/list-teams.js +17 -0
- package/dist/tools/teams/list-teams.js.map +1 -0
- package/dist/tools/tickets/close-ticket.js +21 -0
- package/dist/tools/tickets/close-ticket.js.map +1 -0
- package/dist/tools/tickets/get-ticket-by-id.js +16 -0
- package/dist/tools/tickets/get-ticket-by-id.js.map +1 -0
- package/dist/tools/tickets/list-ticket-fields.js +15 -0
- package/dist/tools/tickets/list-ticket-fields.js.map +1 -0
- package/dist/tools/tickets/list-tickets.js +88 -0
- package/dist/tools/tickets/list-tickets.js.map +1 -0
- package/dist/tools/tickets/update-ticket-field.js +22 -0
- package/dist/tools/tickets/update-ticket-field.js.map +1 -0
- package/dist/tools/update-contact-field.js +17 -0
- package/dist/tools/update-contact-field.js.map +1 -0
- package/dist/tools/update-conversation-labels.js +16 -0
- package/dist/tools/update-conversation-labels.js.map +1 -0
- package/dist/tools/update-ticket-field.js +22 -0
- package/dist/tools/update-ticket-field.js.map +1 -0
- package/dist/tools/users/list-users.js +16 -0
- package/dist/tools/users/list-users.js.map +1 -0
- package/dist/tools.js +413 -0
- package/dist/tools.js.map +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Zaapi Open API MCP
|
|
2
|
+
|
|
3
|
+
MCP server for the [Zaapi Open API](https://openplatform.zaapi.co). It exposes each public `/v1` operation as a tool over stdio.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"mcpServers": {
|
|
10
|
+
"zaapi": {
|
|
11
|
+
"command": "npx",
|
|
12
|
+
"args": ["-y", "@zaapi/open-api-mcp"],
|
|
13
|
+
"env": {
|
|
14
|
+
"ZAAPI_BASE_URL": "https://openplatform.zaapi.co",
|
|
15
|
+
"ZAAPI_API_KEY": "<usage-plan key>"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
| Variable | Required | Description |
|
|
23
|
+
| --- | --- | --- |
|
|
24
|
+
| `ZAAPI_API_KEY` | yes | Store API key (`x-api-key`). Keys start with `zaapi_`. |
|
|
25
|
+
| `ZAAPI_BASE_URL` | no | Defaults to `https://openplatform.zaapi.co`. Use `https://openplatform-staging.zaapi.co` for staging. |
|
|
26
|
+
|
|
27
|
+
Create keys in the Zaapi App under **Settings → Developers**.
|
|
28
|
+
|
|
29
|
+
## Local development
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install
|
|
33
|
+
npm run build
|
|
34
|
+
ZAAPI_API_KEY=zaapi_… npm start
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Point an MCP client at `node` with args `["/path/to/zaapi-open-api-mcp/dist/index.js"]` and the same env vars.
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { loadConfig } from './config.js';
|
|
2
|
+
const PAGE_SIZE_HEADER = 'x-pagination-page-size';
|
|
3
|
+
const NEXT_CURSOR_HEADER = 'x-pagination-next-cursor';
|
|
4
|
+
export class ZaapiClient {
|
|
5
|
+
config;
|
|
6
|
+
fetchFn;
|
|
7
|
+
constructor(config, fetchFn = fetch) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
this.fetchFn = fetchFn;
|
|
10
|
+
}
|
|
11
|
+
static fromEnv(env = process.env, fetchFn = fetch) {
|
|
12
|
+
return new ZaapiClient(loadConfig(env), fetchFn);
|
|
13
|
+
}
|
|
14
|
+
async request(request) {
|
|
15
|
+
const url = this.buildUrl(request.path, request.query);
|
|
16
|
+
const headers = {
|
|
17
|
+
'x-api-key': this.config.apiKey,
|
|
18
|
+
accept: 'application/json',
|
|
19
|
+
};
|
|
20
|
+
const init = { method: request.method, headers };
|
|
21
|
+
if (request.method !== 'GET' && request.body) {
|
|
22
|
+
headers['content-type'] = 'application/json';
|
|
23
|
+
init.body = JSON.stringify(request.body);
|
|
24
|
+
}
|
|
25
|
+
const response = await this.fetchFn(url, init);
|
|
26
|
+
const text = await response.text();
|
|
27
|
+
let body = text;
|
|
28
|
+
if (text) {
|
|
29
|
+
try {
|
|
30
|
+
body = JSON.parse(text);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
body = text;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
status: response.status,
|
|
38
|
+
body,
|
|
39
|
+
pagination: {
|
|
40
|
+
pageSize: response.headers.get(PAGE_SIZE_HEADER) ?? undefined,
|
|
41
|
+
nextCursor: response.headers.get(NEXT_CURSOR_HEADER) ?? undefined,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
buildUrl(path, query) {
|
|
46
|
+
const url = new URL(path, `${this.config.baseUrl}/`);
|
|
47
|
+
if (!query) {
|
|
48
|
+
return url.toString();
|
|
49
|
+
}
|
|
50
|
+
for (const [key, value] of Object.entries(query)) {
|
|
51
|
+
if (value === undefined || value === null) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
url.searchParams.set(key, Array.isArray(value) ? value.join(',') : String(value));
|
|
55
|
+
}
|
|
56
|
+
return url.toString();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,aAAa,CAAC;AAsB3D,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AAClD,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AAEtD,MAAM,OAAO,WAAW;IAEH;IACA;IAFnB,YACmB,MAAmB,EACnB,UAAmB,KAAK;QADxB,WAAM,GAAN,MAAM,CAAa;QACnB,YAAO,GAAP,OAAO,CAAiB;IACxC,CAAC;IAEJ,MAAM,CAAC,OAAO,CACZ,MAA2B,OAAO,CAAC,GAAG,EACtC,UAAmB,KAAK;QAExB,OAAO,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAqB;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACvD,MAAM,OAAO,GAA2B;YACtC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC/B,MAAM,EAAE,kBAAkB;SAC3B,CAAC;QAEF,MAAM,IAAI,GAAgB,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;QAC9D,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YAC7C,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;YAC7C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,IAAI,GAAY,IAAI,CAAC;QACzB,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC;gBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;YAAC,MAAM,CAAC;gBACP,IAAI,GAAG,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAED,OAAO;YACL,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,IAAI;YACJ,UAAU,EAAE;gBACV,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,SAAS;gBAC7D,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,SAAS;aAClE;SACF,CAAC;IACJ,CAAC;IAEO,QAAQ,CAAC,IAAY,EAAE,KAA+B;QAC5D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;QACrD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC;QAED,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBAC1C,SAAS;YACX,CAAC;YACD,GAAG,CAAC,YAAY,CAAC,GAAG,CAClB,GAAG,EACH,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;QACJ,CAAC;QAED,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;CACF"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const DEFAULT_BASE_URL = 'https://openplatform.zaapi.co';
|
|
2
|
+
export function loadConfig(env = process.env) {
|
|
3
|
+
const apiKey = env.ZAAPI_API_KEY?.trim();
|
|
4
|
+
if (!apiKey) {
|
|
5
|
+
throw new Error('ZAAPI_API_KEY is required');
|
|
6
|
+
}
|
|
7
|
+
const baseUrl = (env.ZAAPI_BASE_URL?.trim() || DEFAULT_BASE_URL).replace(/\/+$/, '');
|
|
8
|
+
return {
|
|
9
|
+
baseUrl,
|
|
10
|
+
apiKey,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,+BAA+B,CAAC;AAOzD,MAAM,UAAU,UAAU,CACxB,MAA2B,OAAO,CAAC,GAAG;IAEtC,MAAM,MAAM,GAAG,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC;IACzC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,gBAAgB,CAAC,CAAC,OAAO,CACtE,MAAM,EACN,EAAE,CACH,CAAC;IAEF,OAAO;QACL,OAAO;QACP,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { serveStdio } from '@modelcontextprotocol/server/stdio';
|
|
3
|
+
import { ZaapiClient } from './client.js';
|
|
4
|
+
import { loadConfig } from './config.js';
|
|
5
|
+
import { createZaapiServer } from './server.js';
|
|
6
|
+
try {
|
|
7
|
+
const config = loadConfig();
|
|
8
|
+
const client = new ZaapiClient(config);
|
|
9
|
+
serveStdio(() => createZaapiServer(client));
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
13
|
+
process.stderr.write(`${message}\n`);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,IAAI,CAAC;IACH,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,UAAU,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9C,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/server';
|
|
2
|
+
import { splitInput, tools } from './tools/index.js';
|
|
3
|
+
export function createZaapiServer(client) {
|
|
4
|
+
const server = new McpServer({
|
|
5
|
+
name: 'zaapi',
|
|
6
|
+
version: '1.0.0',
|
|
7
|
+
});
|
|
8
|
+
for (const tool of tools) {
|
|
9
|
+
server.registerTool(tool.name, {
|
|
10
|
+
title: tool.title,
|
|
11
|
+
description: tool.description,
|
|
12
|
+
inputSchema: tool.inputSchema,
|
|
13
|
+
annotations: tool.annotations,
|
|
14
|
+
}, createToolHandler(client, tool));
|
|
15
|
+
}
|
|
16
|
+
return server;
|
|
17
|
+
}
|
|
18
|
+
export function createToolHandler(client, tool) {
|
|
19
|
+
return async (input) => {
|
|
20
|
+
const args = input && typeof input === 'object' && !Array.isArray(input)
|
|
21
|
+
? input
|
|
22
|
+
: {};
|
|
23
|
+
const { query, body } = splitRequest(tool, args);
|
|
24
|
+
const result = await client.request({
|
|
25
|
+
method: tool.method,
|
|
26
|
+
path: tool.path,
|
|
27
|
+
query,
|
|
28
|
+
body,
|
|
29
|
+
});
|
|
30
|
+
const payload = {
|
|
31
|
+
status: result.status,
|
|
32
|
+
data: unwrapOpenApiEnvelope(result.body),
|
|
33
|
+
...(result.pagination.pageSize || result.pagination.nextCursor
|
|
34
|
+
? { pagination: result.pagination }
|
|
35
|
+
: {}),
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: 'text', text: JSON.stringify(payload) }],
|
|
39
|
+
isError: result.status >= 400,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function unwrapOpenApiEnvelope(body) {
|
|
44
|
+
if (body === null || typeof body !== 'object' || Array.isArray(body)) {
|
|
45
|
+
return body;
|
|
46
|
+
}
|
|
47
|
+
if ('data' in body) {
|
|
48
|
+
return body.data;
|
|
49
|
+
}
|
|
50
|
+
if ('error' in body) {
|
|
51
|
+
return body.error;
|
|
52
|
+
}
|
|
53
|
+
return body;
|
|
54
|
+
}
|
|
55
|
+
function splitRequest(tool, input) {
|
|
56
|
+
switch (tool.method) {
|
|
57
|
+
case 'GET':
|
|
58
|
+
return splitInput(input, Object.keys(input));
|
|
59
|
+
case 'POST':
|
|
60
|
+
case 'PATCH':
|
|
61
|
+
return splitInput(input, tool.queryKeys);
|
|
62
|
+
default: {
|
|
63
|
+
const _exhaustive = tool.method;
|
|
64
|
+
throw new Error(`Unsupported method: ${_exhaustive}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { expand } from './common.js';
|
|
3
|
+
export const closeTicket = {
|
|
4
|
+
name: 'closeTicket',
|
|
5
|
+
title: 'Close a ticket',
|
|
6
|
+
description: 'Required scope: tickets:write. Close a ticket. You can record who handled it, conversion details, and ticket field values in the same request.',
|
|
7
|
+
method: 'PATCH',
|
|
8
|
+
path: '/v1/tickets/close',
|
|
9
|
+
queryKeys: ['expand'],
|
|
10
|
+
inputSchema: z.object({
|
|
11
|
+
expand: expand('Related objects to include on the closed ticket.'),
|
|
12
|
+
ticketId: z.string(),
|
|
13
|
+
handledBy: z.string().uuid().optional(),
|
|
14
|
+
isConverted: z.boolean().optional(),
|
|
15
|
+
totalRevenue: z.number().min(0).optional(),
|
|
16
|
+
currency: z.string().optional(),
|
|
17
|
+
ticketFields: z.record(z.string(), z.any()).optional(),
|
|
18
|
+
}),
|
|
19
|
+
annotations: { readOnlyHint: false, destructiveHint: true },
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=close-ticket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"close-ticket.js","sourceRoot":"","sources":["../../src/tools/close-ticket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AAExD,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,gBAAgB;IACvB,WAAW,EACT,gJAAgJ;IAClJ,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,CAAC,QAAQ,CAAC;IACrB,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC,kDAAkD,CAAC;QAClE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;QACvC,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;QACnC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QAC1C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC/B,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;KACvD,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE;CAC5D,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const pageSize = z
|
|
3
|
+
.number()
|
|
4
|
+
.int()
|
|
5
|
+
.min(1)
|
|
6
|
+
.max(50)
|
|
7
|
+
.optional()
|
|
8
|
+
.describe('Items per page. Defaults to 20. Maximum 50.');
|
|
9
|
+
export const messagePageSize = z
|
|
10
|
+
.number()
|
|
11
|
+
.int()
|
|
12
|
+
.min(1)
|
|
13
|
+
.max(15)
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Items per page. Maximum 15 on this endpoint.');
|
|
16
|
+
export const cursor = z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Opaque token from the previous page x-pagination-next-cursor header.');
|
|
20
|
+
export const expand = (description) => z
|
|
21
|
+
.union([z.string(), z.array(z.string())])
|
|
22
|
+
.optional()
|
|
23
|
+
.describe(description);
|
|
24
|
+
export const paginationQueryKeys = ['pageSize', 'cursor', 'expand'];
|
|
25
|
+
export const paginationFields = {
|
|
26
|
+
pageSize,
|
|
27
|
+
cursor,
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/tools/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC;KACtB,MAAM,EAAE;KACR,GAAG,EAAE;KACL,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,QAAQ,EAAE;KACV,QAAQ,CAAC,6CAA6C,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,EAAE;KACR,GAAG,EAAE;KACL,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,QAAQ,EAAE;KACV,QAAQ,CAAC,8CAA8C,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC;KACpB,MAAM,EAAE;KACR,QAAQ,EAAE;KACV,QAAQ,CACP,sEAAsE,CACvE,CAAC;AAEJ,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,WAAmB,EAAE,EAAE,CAC5C,CAAC;KACE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;KACxC,QAAQ,EAAE;KACV,QAAQ,CAAC,WAAW,CAAC,CAAC;AAE3B,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAE7E,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,QAAQ;IACR,MAAM;CACP,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const createContact = {
|
|
3
|
+
name: 'createContact',
|
|
4
|
+
title: 'Create a contact',
|
|
5
|
+
description: 'Required scope: contacts:write. Create a contact. A contact whose email or phone already exists is rejected with 409.',
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/v1/contacts',
|
|
8
|
+
queryKeys: [],
|
|
9
|
+
inputSchema: z.object({
|
|
10
|
+
firstName: z.string().max(50),
|
|
11
|
+
lastName: z.string().max(50).optional(),
|
|
12
|
+
email: z.string().email().max(100).optional(),
|
|
13
|
+
phone: z
|
|
14
|
+
.string()
|
|
15
|
+
.max(15)
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Primary phone number in E.164 format.'),
|
|
18
|
+
}),
|
|
19
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=create-contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-contact.js","sourceRoot":"","sources":["../../../src/tools/contacts/create-contact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,uHAAuH;IACzH,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,cAAc;IACpB,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;QACvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;QAC7C,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,GAAG,CAAC,EAAE,CAAC;aACP,QAAQ,EAAE;aACV,QAAQ,CAAC,uCAAuC,CAAC;KACrD,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE;CAC7D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const getContactById = {
|
|
3
|
+
name: 'getContactById',
|
|
4
|
+
title: 'Get a contact by ID',
|
|
5
|
+
description: 'Required scope: contacts:read. Fetch a single contact, including custom field values.',
|
|
6
|
+
method: 'GET',
|
|
7
|
+
path: '/v1/contacts',
|
|
8
|
+
queryKeys: ['contactId'],
|
|
9
|
+
inputSchema: z.object({
|
|
10
|
+
contactId: z.string(),
|
|
11
|
+
}),
|
|
12
|
+
annotations: { readOnlyHint: true },
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=get-contact-by-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-contact-by-id.js","sourceRoot":"","sources":["../../../src/tools/contacts/get-contact-by-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACT,uFAAuF;IACzF,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,cAAc;IACpB,SAAS,EAAE,CAAC,WAAW,CAAC;IACxB,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;CACpC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const listContactFields = {
|
|
3
|
+
name: 'listContactFields',
|
|
4
|
+
title: 'List contact fields',
|
|
5
|
+
description: 'Required scope: contacts:read. Fetch contact field definitions for the store.',
|
|
6
|
+
method: 'GET',
|
|
7
|
+
path: '/v1/contacts/fields',
|
|
8
|
+
queryKeys: [],
|
|
9
|
+
inputSchema: z.object({}),
|
|
10
|
+
annotations: { readOnlyHint: true },
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=list-contact-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-contact-fields.js","sourceRoot":"","sources":["../../../src/tools/contacts/list-contact-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,iBAAiB,GAAiB;IAC7C,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACT,+EAA+E;IACjF,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,qBAAqB;IAC3B,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;CACpC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { paginationFields } from '../common.js';
|
|
3
|
+
export const listContacts = {
|
|
4
|
+
name: 'listContacts',
|
|
5
|
+
title: 'List contacts',
|
|
6
|
+
description: 'Required scope: contacts:read. Search and page through contacts, most recently updated first.',
|
|
7
|
+
method: 'POST',
|
|
8
|
+
path: '/v1/contacts/list',
|
|
9
|
+
queryKeys: ['pageSize', 'cursor'],
|
|
10
|
+
inputSchema: z.object({
|
|
11
|
+
...paginationFields,
|
|
12
|
+
search: z
|
|
13
|
+
.string()
|
|
14
|
+
.max(100)
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Free-text search across name, email, and phone.'),
|
|
17
|
+
updatedAfter: z.string().optional(),
|
|
18
|
+
updatedBefore: z.string().optional(),
|
|
19
|
+
}),
|
|
20
|
+
annotations: { readOnlyHint: true },
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=list-contacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-contacts.js","sourceRoot":"","sources":["../../../src/tools/contacts/list-contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAqB,MAAM,cAAc,CAAC;AAEnE,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,+FAA+F;IACjG,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,GAAG,gBAAgB;QACnB,MAAM,EAAE,CAAC;aACN,MAAM,EAAE;aACR,GAAG,CAAC,GAAG,CAAC;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,iDAAiD,CAAC;QAC9D,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACnC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACrC,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;CACpC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const updateContactField = {
|
|
3
|
+
name: 'updateContactField',
|
|
4
|
+
title: 'Update a contact field value',
|
|
5
|
+
description: 'Required scope: contacts:write. Set or clear a custom field. Pass the customFieldsUpdatedAt you last read as updatedAt; a mismatch is rejected.',
|
|
6
|
+
method: 'PATCH',
|
|
7
|
+
path: '/v1/contacts/fields',
|
|
8
|
+
queryKeys: [],
|
|
9
|
+
inputSchema: z.object({
|
|
10
|
+
contactId: z.string(),
|
|
11
|
+
contactFieldId: z.string(),
|
|
12
|
+
value: z.any().nullable(),
|
|
13
|
+
updatedAt: z.string(),
|
|
14
|
+
}),
|
|
15
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=update-contact-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-contact-field.js","sourceRoot":"","sources":["../../../src/tools/contacts/update-contact-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,kBAAkB,GAAiB;IAC9C,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,8BAA8B;IACrC,WAAW,EACT,iJAAiJ;IACnJ,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,qBAAqB;IAC3B,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;QAC1B,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;QACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE;CAC7D,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { expand, paginationFields, paginationQueryKeys, } from '../common.js';
|
|
3
|
+
const filterConversationsExpand = expand('Pass account to replace accountId with { id, name, channel }.');
|
|
4
|
+
export const filterConversations = {
|
|
5
|
+
name: 'filterConversations',
|
|
6
|
+
title: 'Filter conversations by ID or contact',
|
|
7
|
+
description: 'Required scope: conversations:read. Send conversationId and/or contactId — at least one is required. Paginate with pageSize and cursor. Pass expand=account to replace accountId.',
|
|
8
|
+
method: 'GET',
|
|
9
|
+
path: '/v1/conversations',
|
|
10
|
+
queryKeys: ['conversationId', 'contactId', ...paginationQueryKeys],
|
|
11
|
+
inputSchema: z.union([
|
|
12
|
+
z.object({
|
|
13
|
+
conversationId: z.string().min(1),
|
|
14
|
+
contactId: z.string().min(1).optional(),
|
|
15
|
+
...paginationFields,
|
|
16
|
+
expand: filterConversationsExpand,
|
|
17
|
+
}),
|
|
18
|
+
z.object({
|
|
19
|
+
contactId: z.string().min(1),
|
|
20
|
+
conversationId: z.string().min(1).optional(),
|
|
21
|
+
...paginationFields,
|
|
22
|
+
expand: filterConversationsExpand,
|
|
23
|
+
}),
|
|
24
|
+
]),
|
|
25
|
+
annotations: { readOnlyHint: true },
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=filter-conversations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-conversations.js","sourceRoot":"","sources":["../../../src/tools/conversations/filter-conversations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,mBAAmB,GAEpB,MAAM,cAAc,CAAC;AAEtB,MAAM,yBAAyB,GAAG,MAAM,CACtC,+DAA+D,CAChE,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,IAAI,EAAE,qBAAqB;IAC3B,KAAK,EAAE,uCAAuC;IAC9C,WAAW,EACT,mLAAmL;IACrL,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,CAAC,gBAAgB,EAAE,WAAW,EAAE,GAAG,mBAAmB,CAAC;IAClE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC;QACnB,CAAC,CAAC,MAAM,CAAC;YACP,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;YACvC,GAAG,gBAAgB;YACnB,MAAM,EAAE,yBAAyB;SAClC,CAAC;QACF,CAAC,CAAC,MAAM,CAAC;YACP,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;YAC5C,GAAG,gBAAgB;YACnB,MAAM,EAAE,yBAAyB;SAClC,CAAC;KACH,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;CACpC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const markConversationRead = {
|
|
3
|
+
name: 'markConversationRead',
|
|
4
|
+
title: 'Mark a conversation as read',
|
|
5
|
+
description: "Required scope: conversations:write. Clears the unread count on the conversation's open ticket. Idempotent. A conversation with no open ticket returns 404.",
|
|
6
|
+
method: 'PATCH',
|
|
7
|
+
path: '/v1/conversations/read',
|
|
8
|
+
queryKeys: [],
|
|
9
|
+
inputSchema: z.object({
|
|
10
|
+
conversationId: z.string(),
|
|
11
|
+
}),
|
|
12
|
+
annotations: {
|
|
13
|
+
readOnlyHint: false,
|
|
14
|
+
destructiveHint: false,
|
|
15
|
+
idempotentHint: true,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=mark-conversation-read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mark-conversation-read.js","sourceRoot":"","sources":["../../../src/tools/conversations/mark-conversation-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,oBAAoB,GAAiB;IAChD,IAAI,EAAE,sBAAsB;IAC5B,KAAK,EAAE,6BAA6B;IACpC,WAAW,EACT,6JAA6J;IAC/J,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,wBAAwB;IAC9B,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;KAC3B,CAAC;IACF,WAAW,EAAE;QACX,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;KACrB;CACF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const updateConversationLabels = {
|
|
3
|
+
name: 'updateConversationLabels',
|
|
4
|
+
title: 'Update conversation labels',
|
|
5
|
+
description: 'Required scope: conversations:write. Add and/or remove up to 10 labels. At least one of addLabels or removeLabels is required.',
|
|
6
|
+
method: 'PATCH',
|
|
7
|
+
path: '/v1/conversations/labels',
|
|
8
|
+
queryKeys: [],
|
|
9
|
+
inputSchema: z.union([
|
|
10
|
+
z.object({
|
|
11
|
+
conversationId: z.string().min(1),
|
|
12
|
+
addLabels: z.array(z.string()).min(1).max(10),
|
|
13
|
+
removeLabels: z.array(z.string()).max(10).optional(),
|
|
14
|
+
}),
|
|
15
|
+
z.object({
|
|
16
|
+
conversationId: z.string().min(1),
|
|
17
|
+
removeLabels: z.array(z.string()).min(1).max(10),
|
|
18
|
+
addLabels: z.array(z.string()).max(10).optional(),
|
|
19
|
+
}),
|
|
20
|
+
]),
|
|
21
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=update-conversation-labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-conversation-labels.js","sourceRoot":"","sources":["../../../src/tools/conversations/update-conversation-labels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,wBAAwB,GAAiB;IACpD,IAAI,EAAE,0BAA0B;IAChC,KAAK,EAAE,4BAA4B;IACnC,WAAW,EACT,gIAAgI;IAClI,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,0BAA0B;IAChC,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC;QACnB,CAAC,CAAC,MAAM,CAAC;YACP,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YACjC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7C,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;SACrD,CAAC;QACF,CAAC,CAAC,MAAM,CAAC;YACP,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YACjC,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;YAChD,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;SAClD,CAAC;KACH,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE;CAC7D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const createContact = {
|
|
3
|
+
name: 'createContact',
|
|
4
|
+
title: 'Create a contact',
|
|
5
|
+
description: 'Required scope: contacts:write. Create a contact. A contact whose email or phone already exists is rejected with 409.',
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/v1/contacts',
|
|
8
|
+
queryKeys: [],
|
|
9
|
+
inputSchema: z.object({
|
|
10
|
+
firstName: z.string().max(50),
|
|
11
|
+
lastName: z.string().max(50).optional(),
|
|
12
|
+
email: z.string().email().max(100).optional(),
|
|
13
|
+
phone: z
|
|
14
|
+
.string()
|
|
15
|
+
.max(15)
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Primary phone number in E.164 format.'),
|
|
18
|
+
}),
|
|
19
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=create-contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-contact.js","sourceRoot":"","sources":["../../src/tools/create-contact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,uHAAuH;IACzH,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,cAAc;IACpB,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;QACvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;QAC7C,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,GAAG,CAAC,EAAE,CAAC;aACP,QAAQ,EAAE;aACV,QAAQ,CAAC,uCAAuC,CAAC;KACrD,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE;CAC7D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const createInternalComment = {
|
|
3
|
+
name: 'createInternalComment',
|
|
4
|
+
title: 'Add an internal comment',
|
|
5
|
+
description: 'Required scope: messages:write. Add a seller-private note. Not sent to the customer.',
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/v1/messages/internal-comments',
|
|
8
|
+
queryKeys: [],
|
|
9
|
+
inputSchema: z.object({
|
|
10
|
+
conversationId: z.string(),
|
|
11
|
+
text: z.string(),
|
|
12
|
+
}),
|
|
13
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=create-internal-comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-internal-comment.js","sourceRoot":"","sources":["../../src/tools/create-internal-comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE,yBAAyB;IAChC,WAAW,EACT,sFAAsF;IACxF,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,gCAAgC;IACtC,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;QAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE;CAC7D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { expand, paginationFields, paginationQueryKeys, } from './common.js';
|
|
3
|
+
export const filterConversations = {
|
|
4
|
+
name: 'filterConversations',
|
|
5
|
+
title: 'Filter conversations by ID or contact',
|
|
6
|
+
description: 'Required scope: conversations:read. Send conversationId and/or contactId — at least one is required. Paginate with pageSize and cursor. Pass expand=account to replace accountId.',
|
|
7
|
+
method: 'GET',
|
|
8
|
+
path: '/v1/conversations',
|
|
9
|
+
queryKeys: ['conversationId', 'contactId', ...paginationQueryKeys],
|
|
10
|
+
inputSchema: z.object({
|
|
11
|
+
conversationId: z.string().optional(),
|
|
12
|
+
contactId: z.string().optional(),
|
|
13
|
+
...paginationFields,
|
|
14
|
+
expand: expand('Pass account to replace accountId with { id, name, channel }.'),
|
|
15
|
+
}),
|
|
16
|
+
annotations: { readOnlyHint: true },
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=filter-conversations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-conversations.js","sourceRoot":"","sources":["../../src/tools/filter-conversations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,mBAAmB,GAEpB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,IAAI,EAAE,qBAAqB;IAC3B,KAAK,EAAE,uCAAuC;IAC9C,WAAW,EACT,mLAAmL;IACrL,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,CAAC,gBAAgB,EAAE,WAAW,EAAE,GAAG,mBAAmB,CAAC;IAClE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACrC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAChC,GAAG,gBAAgB;QACnB,MAAM,EAAE,MAAM,CACZ,+DAA+D,CAChE;KACF,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;CACpC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const getContactById = {
|
|
3
|
+
name: 'getContactById',
|
|
4
|
+
title: 'Get a contact by ID',
|
|
5
|
+
description: 'Required scope: contacts:read. Fetch a single contact, including custom field values.',
|
|
6
|
+
method: 'GET',
|
|
7
|
+
path: '/v1/contacts',
|
|
8
|
+
queryKeys: ['contactId'],
|
|
9
|
+
inputSchema: z.object({
|
|
10
|
+
contactId: z.string(),
|
|
11
|
+
}),
|
|
12
|
+
annotations: { readOnlyHint: true },
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=get-contact-by-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-contact-by-id.js","sourceRoot":"","sources":["../../src/tools/get-contact-by-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACT,uFAAuF;IACzF,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,cAAc;IACpB,SAAS,EAAE,CAAC,WAAW,CAAC;IACxB,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;CACpC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { cursor, expand, messagePageSize, } from './common.js';
|
|
3
|
+
export const getMessages = {
|
|
4
|
+
name: 'getMessages',
|
|
5
|
+
title: 'List messages',
|
|
6
|
+
description: 'Required scope: messages:read. Customer-facing messages, newest first. Send conversationId and/or ticketId — at least one is required. pageSize max 15.',
|
|
7
|
+
method: 'GET',
|
|
8
|
+
path: '/v1/messages',
|
|
9
|
+
queryKeys: ['conversationId', 'ticketId', 'pageSize', 'cursor', 'expand'],
|
|
10
|
+
inputSchema: z.object({
|
|
11
|
+
conversationId: z.string().optional(),
|
|
12
|
+
ticketId: z.string().optional(),
|
|
13
|
+
pageSize: messagePageSize,
|
|
14
|
+
cursor,
|
|
15
|
+
expand: expand('Pass sentBy,conversation,account to add related names.'),
|
|
16
|
+
}),
|
|
17
|
+
annotations: { readOnlyHint: true },
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=get-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-messages.js","sourceRoot":"","sources":["../../src/tools/get-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,MAAM,EACN,MAAM,EACN,eAAe,GAEhB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,yJAAyJ;IAC3J,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,cAAc;IACpB,SAAS,EAAE,CAAC,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;IACzE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACrC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC/B,QAAQ,EAAE,eAAe;QACzB,MAAM;QACN,MAAM,EAAE,MAAM,CAAC,wDAAwD,CAAC;KACzE,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;CACpC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { expand } from './common.js';
|
|
3
|
+
export const getTicketById = {
|
|
4
|
+
name: 'getTicketById',
|
|
5
|
+
title: 'Get a ticket by ID',
|
|
6
|
+
description: 'Required scope: tickets:read. Fetch a single ticket. Pass expand=account,conversation,assignee,handledBy to replace those ids with names.',
|
|
7
|
+
method: 'GET',
|
|
8
|
+
path: '/v1/tickets',
|
|
9
|
+
queryKeys: ['ticketId', 'expand'],
|
|
10
|
+
inputSchema: z.object({
|
|
11
|
+
ticketId: z.string().describe('The ID of the ticket'),
|
|
12
|
+
expand: expand('Comma-separated related objects to include.'),
|
|
13
|
+
}),
|
|
14
|
+
annotations: { readOnlyHint: true },
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=get-ticket-by-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-ticket-by-id.js","sourceRoot":"","sources":["../../src/tools/get-ticket-by-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AAExD,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EACT,2IAA2I;IAC7I,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,aAAa;IACnB,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACrD,MAAM,EAAE,MAAM,CAAC,6CAA6C,CAAC;KAC9D,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;CACpC,CAAC"}
|