@zaapi/open-api-mcp 1.2.0 → 1.3.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.
Files changed (59) hide show
  1. package/dist/client.js +5 -0
  2. package/dist/client.js.map +1 -1
  3. package/dist/instructions.js +73 -0
  4. package/dist/instructions.js.map +1 -0
  5. package/dist/server.js +134 -12
  6. package/dist/server.js.map +1 -1
  7. package/dist/tools/accounts/list-accounts.js +8 -18
  8. package/dist/tools/accounts/list-accounts.js.map +1 -1
  9. package/dist/tools/common.js +22 -26
  10. package/dist/tools/common.js.map +1 -1
  11. package/dist/tools/contacts/create-contact.js +13 -7
  12. package/dist/tools/contacts/create-contact.js.map +1 -1
  13. package/dist/tools/contacts/get-contact-by-id.js +6 -7
  14. package/dist/tools/contacts/get-contact-by-id.js.map +1 -1
  15. package/dist/tools/contacts/list-contact-fields.js +5 -3
  16. package/dist/tools/contacts/list-contact-fields.js.map +1 -1
  17. package/dist/tools/contacts/list-contacts.js +11 -6
  18. package/dist/tools/contacts/list-contacts.js.map +1 -1
  19. package/dist/tools/contacts/search-contacts.js +20 -0
  20. package/dist/tools/contacts/search-contacts.js.map +1 -0
  21. package/dist/tools/contacts/update-contact-field.js +12 -7
  22. package/dist/tools/contacts/update-contact-field.js.map +1 -1
  23. package/dist/tools/conversations/filter-conversations.js +11 -7
  24. package/dist/tools/conversations/filter-conversations.js.map +1 -1
  25. package/dist/tools/conversations/mark-conversation-read.js +4 -6
  26. package/dist/tools/conversations/mark-conversation-read.js.map +1 -1
  27. package/dist/tools/conversations/update-conversation-labels.js +10 -9
  28. package/dist/tools/conversations/update-conversation-labels.js.map +1 -1
  29. package/dist/tools/index.js +4 -0
  30. package/dist/tools/index.js.map +1 -1
  31. package/dist/tools/labels/list-labels.js +7 -4
  32. package/dist/tools/labels/list-labels.js.map +1 -1
  33. package/dist/tools/messages/create-internal-comment.js +9 -8
  34. package/dist/tools/messages/create-internal-comment.js.map +1 -1
  35. package/dist/tools/messages/get-messages.js +9 -7
  36. package/dist/tools/messages/get-messages.js.map +1 -1
  37. package/dist/tools/messages/list-internal-comments.js +8 -8
  38. package/dist/tools/messages/list-internal-comments.js.map +1 -1
  39. package/dist/tools/messages/search-messages.js +20 -0
  40. package/dist/tools/messages/search-messages.js.map +1 -0
  41. package/dist/tools/messages/send-plain-text-message.js +9 -8
  42. package/dist/tools/messages/send-plain-text-message.js.map +1 -1
  43. package/dist/tools/responses.js +271 -0
  44. package/dist/tools/responses.js.map +1 -0
  45. package/dist/tools/teams/list-teams.js +10 -5
  46. package/dist/tools/teams/list-teams.js.map +1 -1
  47. package/dist/tools/tickets/close-ticket.js +17 -10
  48. package/dist/tools/tickets/close-ticket.js.map +1 -1
  49. package/dist/tools/tickets/get-ticket-by-id.js +8 -8
  50. package/dist/tools/tickets/get-ticket-by-id.js.map +1 -1
  51. package/dist/tools/tickets/list-ticket-fields.js +7 -4
  52. package/dist/tools/tickets/list-ticket-fields.js.map +1 -1
  53. package/dist/tools/tickets/list-tickets.js +22 -22
  54. package/dist/tools/tickets/list-tickets.js.map +1 -1
  55. package/dist/tools/tickets/update-ticket-field.js +15 -8
  56. package/dist/tools/tickets/update-ticket-field.js.map +1 -1
  57. package/dist/tools/users/list-users.js +8 -5
  58. package/dist/tools/users/list-users.js.map +1 -1
  59. package/package.json +1 -1
@@ -1,26 +1,33 @@
1
1
  import { z } from 'zod';
2
- import { describeHttpRequest, expand, fieldValue, } from '../common.js';
2
+ import { expand, fieldValue } from '../common.js';
3
+ import { envelope, ticket } from '../responses.js';
3
4
  const queryKeys = ['expand'];
4
5
  export const updateTicketField = {
5
6
  name: 'updateTicketField',
6
7
  title: 'Update a ticket field value',
7
- description: `Required scope: tickets:write. ${describeHttpRequest('PATCH', '/v1/tickets/fields', queryKeys)} Set or clear one field on a ticket. Send null as newValue to unset. Send ticketFieldsUpdatedAt from the last read; a mismatch returns 409.`,
8
+ description: 'Set or clear exactly one custom field on a ticket, and return the updated ticket. Resolve ticketFieldId with listTicketFields and read the ticket first: ticketFieldsUpdatedAt must be the value from that read, or the write is rejected with 409 because someone else changed a field in the meantime — re-read and retry. Send null as newValue to unset. Requires the tickets:write scope.',
9
+ scope: 'tickets:write',
8
10
  method: 'PATCH',
9
11
  path: '/v1/tickets/fields',
10
12
  queryKeys,
11
13
  inputSchema: z.object({
12
- expand: expand('Related objects to include on the updated ticket: account, conversation, assignee, handledBy.'),
13
- ticketId: z.string().min(1).describe('JSON body. The ID of the ticket.'),
14
+ expand: expand(['account', 'conversation', 'assignee', 'handledBy'], 'Replace these ids on the returned ticket with the named object.'),
15
+ ticketId: z.string().min(1).describe('The ID of the ticket.'),
14
16
  ticketFieldId: z
15
17
  .string()
16
18
  .min(1)
17
- .describe('JSON body. The ID of the ticket field.'),
19
+ .describe('The ID of the ticket field, from listTicketFields.'),
18
20
  ticketFieldsUpdatedAt: z
19
21
  .string()
20
22
  .optional()
21
- .describe('JSON body. ISO 8601 date-time from the last read. Omit if the ticket has never had a field update.'),
22
- newValue: fieldValue.describe('JSON body. The new field value. Send null to unset.'),
23
+ .describe('ISO 8601 date-time. The ticketFieldsUpdatedAt you last read. Omit only when the ticket has never had a field update.'),
24
+ newValue: fieldValue.describe('The new value, matching the field dataType. Send null to unset.'),
23
25
  }),
24
- annotations: { readOnlyHint: false, destructiveHint: false },
26
+ outputSchema: envelope(ticket, 'The ticket after the update.'),
27
+ annotations: {
28
+ readOnlyHint: false,
29
+ destructiveHint: false,
30
+ openWorldHint: true,
31
+ },
25
32
  };
26
33
  //# sourceMappingURL=update-ticket-field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-ticket-field.js","sourceRoot":"","sources":["../../../src/tools/tickets/update-ticket-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,MAAM,EACN,UAAU,GAEX,MAAM,cAAc,CAAC;AAEtB,MAAM,SAAS,GAAG,CAA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,gYAAgY;IAClY,KAAK,EAAE,eAAe;IACtB,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,oBAAoB;IAC1B,SAAS;IACT,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CACZ,CAAC,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,CAAC,EACpD,iEAAiE,CAClE;QACD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QAC7D,aAAa,EAAE,CAAC;aACb,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,oDAAoD,CAAC;QACjE,qBAAqB,EAAE,CAAC;aACrB,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,sHAAsH,CACvH;QACH,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAC3B,iEAAiE,CAClE;KACF,CAAC;IACF,YAAY,EAAE,QAAQ,CAAC,MAAM,EAAE,8BAA8B,CAAC;IAC9D,WAAW,EAAE;QACX,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,KAAK;QACtB,aAAa,EAAE,IAAI;KACpB;CACF,CAAC"}
@@ -1,10 +1,12 @@
1
1
  import { z } from 'zod';
2
- import { describeHttpRequest, expand } from '../common.js';
2
+ import { expand } from '../common.js';
3
+ import { envelope, user } from '../responses.js';
3
4
  const queryKeys = ['userId', 'expand'];
4
5
  export const listUsers = {
5
6
  name: 'listUsers',
6
7
  title: 'List users',
7
- description: `Required scope: users:read. ${describeHttpRequest('GET', '/v1/users', queryKeys)} Full list of users on the store. Not paginated. Optionally filter to one userId (UUID). Pass expand=role to include { id, name } for the role.`,
8
+ description: 'Full list of the seats on the store, with the role of each. Not paginated. Call this to turn an agent’s name into an id — and take userId, the UUID, not the id beside it: userId is what ticket assignment, handledBy and the listTeams filter match on. Requires the users:read scope.',
9
+ scope: 'users:read',
8
10
  method: 'GET',
9
11
  path: '/v1/users',
10
12
  queryKeys,
@@ -13,9 +15,10 @@ export const listUsers = {
13
15
  .string()
14
16
  .min(1)
15
17
  .optional()
16
- .describe('Query parameter. Restrict to this user (UUID).'),
17
- expand: expand('Pass role to include { id, name } for the role. Without expand, the response keeps roleId.'),
18
+ .describe('Restrict to this user UUID.'),
19
+ expand: expand(['role'], 'Replace roleId with { id, name }.'),
18
20
  }),
19
- annotations: { readOnlyHint: true },
21
+ outputSchema: envelope(z.array(user), 'Every user seat on the store.'),
22
+ annotations: { readOnlyHint: true, openWorldHint: true },
20
23
  };
21
24
  //# sourceMappingURL=list-users.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-users.js","sourceRoot":"","sources":["../../../src/tools/users/list-users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAqB,MAAM,cAAc,CAAC;AAE9E,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAEhD,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,+BAA+B,mBAAmB,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,iJAAiJ;IAC/O,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,WAAW;IACjB,SAAS;IACT,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,MAAM,EAAE,CAAC;aACN,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,EAAE;aACV,QAAQ,CAAC,gDAAgD,CAAC;QAC7D,MAAM,EAAE,MAAM,CACZ,4FAA4F,CAC7F;KACF,CAAC;IACF,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;CACpC,CAAC"}
1
+ {"version":3,"file":"list-users.js","sourceRoot":"","sources":["../../../src/tools/users/list-users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAqB,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAEhD,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,YAAY;IACnB,WAAW,EACT,0RAA0R;IAC5R,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,WAAW;IACjB,SAAS;IACT,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,MAAM,EAAE,CAAC;aACN,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,EAAE;aACV,QAAQ,CAAC,6BAA6B,CAAC;QAC1C,MAAM,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,mCAAmC,CAAC;KAC9D,CAAC;IACF,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,+BAA+B,CAAC;IACtE,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;CACzD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaapi/open-api-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "MCP server for the Zaapi Open API",
5
5
  "homepage": "https://github.com/Zaapi/zaapi-open-api-mcp#readme",
6
6
  "bugs": {