clokio-mcp 0.31.0 → 0.32.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 CHANGED
@@ -89,7 +89,7 @@ acting. An explicit code on a tool call always takes precedence.
89
89
 
90
90
  Optional: set `CLOKIO_TOOLSETS` to register only the tool groups you need, e.g.
91
91
  `CLOKIO_TOOLSETS=tasks`. This cuts the per-session tool-list cost - a
92
- task-focused session drops from 131 tools to 42. Optional groups are `tasks`,
92
+ task-focused session drops from 137 tools to 48. Optional groups are `tasks`,
93
93
  `employees`, `attendance` (which includes leave, time entries and logging time), `docs` and
94
94
  `tickets`;
95
95
  combine them with commas. If your key cannot open documents (no acts-as
@@ -100,7 +100,7 @@ through it.
100
100
 
101
101
  ## Tools
102
102
 
103
- 131 tools across seven areas. Read-only tools carry the MCP `readOnlyHint`; writes
103
+ 137 tools across seven areas. Read-only tools carry the MCP `readOnlyHint`; writes
104
104
  are marked mutating (deletes are `destructive`).
105
105
 
106
106
  | Area | Tools |
@@ -118,13 +118,16 @@ export function registerEmployeeTools(server, config, opts = {}) {
118
118
  });
119
119
  registerTool(server, config, {
120
120
  name: 'clokio_get_inbox',
121
- description: 'What needs one person\'s attention, in three lists: mentions_waiting (comments that @-mention them and ' +
121
+ description: 'What needs one person\'s attention, in four lists: mentions_waiting (comments that @-mention them and ' +
122
122
  'that they have NOT replied to yet; mentions on closed tasks are excluded), newly_assigned (tasks ' +
123
123
  'assigned to them in the window), and status_changes (status moves on tasks they hold or created, made ' +
124
- 'by SOMEONE ELSE - their own moves and task-creation rows are excluded). This is how you find that ' +
124
+ 'by SOMEONE ELSE - their own moves and task-creation rows are excluded), and field_changes (assignee and ' +
125
+ 'due date changes on tasks they OPENED, made by someone else: task_id, task_title, field, change, old_value, ' +
126
+ 'new_value, changed_at, by; a replaced assignee is two rows, unassigned and assigned). This is how you find that ' +
125
127
  'someone asked a question or moved your work, without scanning the board. `since` defaults to 14 days ' +
126
128
  '(max 90). status_changes is capped by `limit` (default 100, max 500); the response sets ' +
127
- 'status_changes_truncated=true when more exist past the cap. To answer for the KEY OWNER, pass their ' +
129
+ 'status_changes_truncated=true when more exist past the cap; field_changes likewise, with field_changes_limit ' +
130
+ 'and field_changes_truncated. To answer for the KEY OWNER, pass their ' +
128
131
  'own employee_code (from clokio_whoami).' +
129
132
  (opts.tickets
130
133
  ? ' When the code is the key\'s acting employee (clokio_whoami: acting_as, else issued_by), a `tickets` part is added: ' +
@@ -139,10 +142,17 @@ export function registerEmployeeTools(server, config, opts = {}) {
139
142
  .int()
140
143
  .optional()
141
144
  .describe('Max status_changes to return (default 100, max 500). status_changes_truncated flags overflow'),
145
+ field_changes_limit: z
146
+ .number()
147
+ .int()
148
+ .min(1)
149
+ .max(500)
150
+ .optional()
151
+ .describe('Max field_changes to return (default 100, max 500). field_changes_truncated flags overflow'),
142
152
  },
143
153
  handler: async (args, cfg) => {
144
154
  const inbox = await request(cfg, `/employees/${seg(args.employee_code)}/inbox`, {
145
- query: { since: args.since, limit: args.limit },
155
+ query: { since: args.since, limit: args.limit, field_changes_limit: args.field_changes_limit },
146
156
  });
147
157
  if (!opts.tickets || inbox === null || typeof inbox !== 'object' || Array.isArray(inbox))
148
158
  return inbox;
@@ -7,10 +7,12 @@ import { FIELD_KEY_PATTERN } from './tasks.js';
7
7
  export function registerProjectTools(server, config) {
8
8
  registerTool(server, config, {
9
9
  name: 'clokio_list_projects',
10
- description: 'List projects, optionally filtered by a search term (name / client) or status. Use this to resolve a ' +
11
- 'project NAME to the project_id every task tool needs. Paginated: {data, meta}.',
10
+ description: 'List projects, optionally filtered by a search term or status. Use this to resolve a project NAME to the ' +
11
+ 'project_id every task tool needs. The search covers the project name, the client name and the project\'s ' +
12
+ 'aliases, and ignores spaces, dots and hyphens: "the store" finds "thestore-il.com". Each row lists its aliases. ' +
13
+ 'Paginated: {data, meta}.',
12
14
  schema: {
13
- search: z.string().max(200).optional(),
15
+ search: z.string().max(200).optional().describe('Name, client or alias. Spaces, dots and hyphens are ignored'),
14
16
  status: z.enum(['active', 'archived']).optional(),
15
17
  per_page: z.number().int().min(1).max(100).optional(),
16
18
  },
@@ -18,6 +20,18 @@ export function registerProjectTools(server, config) {
18
20
  query: { search: args.search, status: args.status, per_page: args.per_page },
19
21
  }),
20
22
  });
23
+ registerTool(server, config, {
24
+ name: 'clokio_set_project_aliases',
25
+ mutates: true,
26
+ description: 'Replace a project\'s aliases: other names clokio_list_projects finds it by, such as "שורש" and "Source". Send ' +
27
+ 'the whole list; an empty list removes them. Up to 20, 100 characters each. Needs projects:write. Aliases work ' +
28
+ 'in search through the MCP and the API; the search boxes in the app do not read them yet.',
29
+ schema: {
30
+ project_id: z.number().int(),
31
+ aliases: z.array(z.string().min(1).max(100)).max(20),
32
+ },
33
+ handler: (args, cfg) => request(cfg, `/projects/${args.project_id}/aliases`, { method: 'PUT', body: { aliases: args.aliases } }),
34
+ });
21
35
  registerTool(server, config, {
22
36
  name: 'clokio_get_project_statuses',
23
37
  description: "A project's resolved task-status set, in order (what a task in this project may become).",
@@ -344,6 +344,7 @@ export function withLinkedTicket(task) {
344
344
  */
345
345
  export const TASK_LIST_FIELDS = [
346
346
  'id',
347
+ 'task_url',
347
348
  'title',
348
349
  'status',
349
350
  'priority',
@@ -400,9 +401,11 @@ export function registerTaskTools(server, config) {
400
401
  label: z.string().optional(),
401
402
  search: z.string().optional().describe('Free text over title and description (see search_in)'),
402
403
  search_in: z
403
- .enum(['title', 'all'])
404
+ .enum(['title', 'description', 'all'])
404
405
  .optional()
405
- .describe('Where `search` looks: "title" only, or "all" = title and description (the default)'),
406
+ .describe('Where `search` looks: "title" only, "description" only (matched as stored, HTML included), or ' +
407
+ '"all" = both (the default). Looking for a task by name: use "title", or sort: "relevance"; a word ' +
408
+ 'used as a heading in many descriptions otherwise floods the results.'),
406
409
  no_due_date: z
407
410
  .boolean()
408
411
  .optional()
@@ -468,13 +471,13 @@ export function registerTaskTools(server, config) {
468
471
  compact: z
469
472
  .boolean()
470
473
  .optional()
471
- .describe('STRONGLY PREFERRED when scanning. Returns a slim row - id, title, status, priority, ' +
474
+ .describe('STRONGLY PREFERRED when scanning. Returns a slim row - id, task_url, title, status, priority, ' +
472
475
  'due_date, parent_id, project_id, assignee_codes (employee_code strings of YOUR organisation), ' +
473
476
  'external_assignees ([{employee_code, organization_id}] for a client organisation\'s people on a ' +
474
477
  'shared board, [] when none; organization_id null when that organisation is hidden), labels (names) ' +
475
478
  'and updated_at - dropping the HTML description and flattening the nested project/assignee ' +
476
479
  'objects to ids. Resolve a project_id with clokio_list_projects, and fetch the one task you ' +
477
- 'actually need in full with clokio_get_task (its URL is /tasks/{id}/view).'),
480
+ 'actually need in full with clokio_get_task.'),
478
481
  fields: z
479
482
  .array(z.enum(TASK_LIST_FIELDS))
480
483
  .min(1)
@@ -495,10 +498,13 @@ export function registerTaskTools(server, config) {
495
498
  'title_desc',
496
499
  'priority',
497
500
  'priority_desc',
501
+ 'relevance',
498
502
  ])
499
503
  .optional()
500
- .describe('Order the page. `priority` ascends low -> urgent. CANNOT be combined with cursor or ' +
501
- 'updated_since - that is a 422, because re-ordering a crawl silently skips rows.'),
504
+ .describe('Order the page. `priority` ascends low -> urgent. `relevance` needs `search`: exact title, title ' +
505
+ 'starting with the term, title holding it, then a match in the description alone. Use it when ' +
506
+ 'looking for a task by name, and read further pages with `page` (next_cursor is null). CANNOT be ' +
507
+ 'combined with cursor or updated_since - that is a 422, because re-ordering a crawl silently skips rows.'),
502
508
  },
503
509
  handler: (args, cfg) => request(cfg, '/tasks', {
504
510
  query: {
@@ -711,6 +717,12 @@ export function registerTaskTools(server, config) {
711
717
  description: 'Update a task. ONLY the fields you pass are changed; omitted fields are left alone. Pass null to ' +
712
718
  'due_date / start_date / estimated_hours / description to CLEAR them. Set actor_employee_code so the ' +
713
719
  'activity log names the person rather than the API key.\n\n' +
720
+ 'EDITING A DESCRIPTION: `description` REPLACES THE WHOLE TEXT, including edits people made in the app since ' +
721
+ 'you read it. So: (1) read the task with clokio_get_task right before editing; (2) send its `updated_at` as ' +
722
+ '`if_updated_at`; (3) prefer `description_append` or `description_replace` over sending the whole text. If the ' +
723
+ 'task changed since, the answer is a 409 TASK_CHANGED naming who and when, and NOTHING in the call is saved: ' +
724
+ 'read it again and re-apply your change to the current text; do not resend without if_updated_at. Any change ' +
725
+ 'to the task counts, a new comment too. Every version is kept: clokio_list_task_description_versions.\n\n' +
714
726
  RECURRENCE_MODEL_NOTE +
715
727
  '\n\nManage an existing series here: `recurrence` (an object) sets or retunes the rule and switches ' +
716
728
  'the series ON; `recurrence: null` STOPS it (future copies stop; already-spawned copies are ordinary ' +
@@ -731,7 +743,27 @@ export function registerTaskTools(server, config) {
731
743
  schema: {
732
744
  id: z.number().int(),
733
745
  title: z.string().max(255).optional(),
734
- description: z.string().nullable().optional(),
746
+ description: z
747
+ .string()
748
+ .nullable()
749
+ .optional()
750
+ .describe('Markdown, HTML or plain text. Replaces the whole text; pair it with if_updated_at'),
751
+ if_updated_at: z
752
+ .string()
753
+ .optional()
754
+ .describe('The updated_at from clokio_get_task. If the task changed since, the call fails with a 409 and nothing is saved'),
755
+ description_append: z
756
+ .string()
757
+ .min(1)
758
+ .optional()
759
+ .describe('Added to the end of the current text, without sending the rest. Markdown, HTML or plain text. Not with description or description_replace'),
760
+ description_replace: z
761
+ .object({
762
+ find: z.string().min(1).describe('Exact text in the STORED HTML, as clokio_get_task returns it. Must occur exactly once, or the call is a 422 and nothing changes'),
763
+ replace: z.string().describe('The replacement, as HTML. Sent as written, not converted from Markdown. An empty string deletes the text'),
764
+ })
765
+ .optional()
766
+ .describe('Change one part of the text without sending the rest. Not with description or description_append'),
735
767
  priority: z.enum(['low', 'medium', 'high', 'urgent']).optional(),
736
768
  status: z.string().optional().describe("Status slug valid for this task's board"),
737
769
  due_date: z.string().nullable().optional().describe('YYYY-MM-DD, or null to clear'),
@@ -784,6 +816,9 @@ export function registerTaskTools(server, config) {
784
816
  for (const key of [
785
817
  'title',
786
818
  'description',
819
+ 'if_updated_at',
820
+ 'description_append',
821
+ 'description_replace',
787
822
  'priority',
788
823
  'status',
789
824
  'due_date',
@@ -811,6 +846,8 @@ export function registerTaskTools(server, config) {
811
846
  body.remove_label_names = args.remove_label_names;
812
847
  if (typeof body.description === 'string')
813
848
  body.description = markdownToHtml(body.description);
849
+ if (typeof body.description_append === 'string')
850
+ body.description_append = markdownToHtml(body.description_append);
814
851
  // Series management maps onto the API's two columns. `recurrence`
815
852
  // carries the whole intent (rule + on/off), so combining it with the
816
853
  // bare pause/resume switch is ambiguous and refused rather than
@@ -832,7 +869,7 @@ export function registerTaskTools(server, config) {
832
869
  // Nothing to change (only empty add/remove lists, or no field at all):
833
870
  // refused here, as the bulk tool refuses, instead of a request that
834
871
  // changes nothing.
835
- if (Object.keys(body).filter((k) => k !== 'actor_employee_code').length === 0) {
872
+ if (Object.keys(body).filter((k) => k !== 'actor_employee_code' && k !== 'if_updated_at').length === 0) {
836
873
  throw new Error('Nothing to change: give at least one field (an empty add_label_names / remove_label_names list is not a change).');
837
874
  }
838
875
  // Credit the update to CLOKIO_DEFAULT_ACTOR when the caller named no
@@ -930,8 +967,7 @@ export function registerTaskTools(server, config) {
930
967
  description: 'Correct a comment YOUR integration published - a wrong number, a dead link, a mistaken finding. ' +
931
968
  'Two conditions, both required: the comment was created through this API, and author_employee_code ' +
932
969
  "names its own author. You cannot edit what a person wrote in the web or mobile app (403), and you " +
933
- 'cannot edit someone else\'s comment (403). There is no delete: correcting leaves an audit entry, ' +
934
- 'destroying would leave nothing.',
970
+ 'cannot edit someone else\'s comment (403). To remove something sensitive, see clokio_delete_task_comment.',
935
971
  schema: {
936
972
  id: z.number().int().describe('The task id'),
937
973
  comment_id: z.number().int(),
@@ -943,6 +979,86 @@ export function registerTaskTools(server, config) {
943
979
  body: { body: markdownToHtml(args.body), author_employee_code: args.author_employee_code ?? cfg.defaultActor },
944
980
  }),
945
981
  });
982
+ registerTool(server, config, {
983
+ name: 'clokio_delete_task_comment',
984
+ mutates: 'destructive',
985
+ description: 'PERMANENTLY delete a comment, whoever wrote it, to remove something sensitive such as a pasted password. ' +
986
+ 'Not for correcting a mistake: use clokio_update_task_comment. Do this only when a person asks for this ' +
987
+ 'specific comment to go. Needs the tasks:comments:delete permission, which Full access does NOT include: only ' +
988
+ 'an administrator can tick it on a key, and no key has it by default (403 otherwise). Also removes the text from ' +
989
+ 'the activity log and the bell, unsent digests, and files only this comment used. The log keeps who deleted it ' +
990
+ 'and when, never the text. TELL THE PERSON: emails and notifications already sent, copies people made and ' +
991
+ 'backups (up to 28 days) cannot be reached, so an exposed password must still be changed. The deletion is ' +
992
+ 'credited to the key\'s acting employee; it cannot be credited to someone else. An internal comment answers 404.',
993
+ schema: {
994
+ id: z.number().int().describe('The task id'),
995
+ comment_id: z.number().int(),
996
+ },
997
+ handler: (args, cfg) => request(cfg, `/tasks/${args.id}/comments/${args.comment_id}`, { method: 'DELETE' }),
998
+ });
999
+ registerTool(server, config, {
1000
+ name: 'clokio_list_task_description_versions',
1001
+ description: "A task description's history, newest first, without the text: version, is_current, is_baseline (the text before " +
1002
+ 'the first recorded change, author unknown), restored_from_version, changed_by, via (web, mobile, public_api), ' +
1003
+ 'length and created_at. Every change is kept in full, so text that was overwritten can be read back with ' +
1004
+ 'clokio_get_task_description_version. Empty until the description first changes after this feature shipped. ' +
1005
+ 'meta.updated_at is the value clokio_restore_task_description_version needs.',
1006
+ schema: { id: z.number().int() },
1007
+ handler: (args, cfg) => request(cfg, `/tasks/${args.id}/description-versions`),
1008
+ });
1009
+ registerTool(server, config, {
1010
+ name: 'clokio_get_task_description_version',
1011
+ description: 'One version of a task description, with its full HTML.',
1012
+ schema: { id: z.number().int(), version: z.number().int().min(1) },
1013
+ handler: (args, cfg) => request(cfg, `/tasks/${args.id}/description-versions/${args.version}`),
1014
+ });
1015
+ registerTool(server, config, {
1016
+ name: 'clokio_restore_task_description_version',
1017
+ mutates: true,
1018
+ description: 'Put an earlier version of a description back. Adds a NEW version holding that text and keeps every later one, ' +
1019
+ 'so a restore can itself be undone. Needs `if_updated_at` (the meta.updated_at from ' +
1020
+ 'clokio_list_task_description_versions, or updated_at from clokio_get_task): if the task changed since, the ' +
1021
+ 'answer is a 409 and nothing is written.',
1022
+ schema: {
1023
+ id: z.number().int(),
1024
+ version: z.number().int().min(1),
1025
+ if_updated_at: z.string(),
1026
+ actor_employee_code: employeeCode.optional().describe('Who to credit in the activity log; omit to use the key issuer / CLOKIO_DEFAULT_ACTOR'),
1027
+ },
1028
+ handler: (args, cfg) => request(cfg, `/tasks/${args.id}/description-versions/${args.version}/restore`, {
1029
+ method: 'POST',
1030
+ body: { if_updated_at: args.if_updated_at, actor_employee_code: args.actor_employee_code ?? cfg.defaultActor },
1031
+ }),
1032
+ });
1033
+ registerTool(server, config, {
1034
+ name: 'clokio_purge_task_description_versions',
1035
+ mutates: 'destructive',
1036
+ description: 'PERMANENTLY delete versions of a description, to remove something sensitive. Text stays in EVERY version from ' +
1037
+ 'the one that added it to the one that removed it, so name them all, as `versions` and/or the inclusive range ' +
1038
+ '`from_version` + `to_version`. First edit the description so the text is gone: the current version is refused. ' +
1039
+ 'Also clears copies of the text from the activity log; the log rows stay. An unknown version refuses the whole ' +
1040
+ 'call. Needs tasks:comments:delete, which Full access does NOT include. Do this only when a person asks. TELL THE ' +
1041
+ 'PERSON: text already sent elsewhere and backups (up to 28 days) cannot be reached, so an exposed password must ' +
1042
+ 'still be changed.',
1043
+ schema: {
1044
+ id: z.number().int(),
1045
+ versions: z.array(z.number().int().min(1)).min(1).max(500).optional(),
1046
+ from_version: z.number().int().min(1).optional(),
1047
+ to_version: z.number().int().min(1).optional(),
1048
+ },
1049
+ handler: (args, cfg) => {
1050
+ if (args.versions === undefined && args.from_version === undefined) {
1051
+ throw new Error('Name the versions: versions and/or from_version + to_version.');
1052
+ }
1053
+ if ((args.from_version === undefined) !== (args.to_version === undefined)) {
1054
+ throw new Error('from_version and to_version go together.');
1055
+ }
1056
+ return request(cfg, `/tasks/${args.id}/description-versions/purge`, {
1057
+ method: 'POST',
1058
+ body: { versions: args.versions, from_version: args.from_version, to_version: args.to_version },
1059
+ });
1060
+ },
1061
+ });
946
1062
  registerTool(server, config, {
947
1063
  name: 'clokio_list_task_attachments',
948
1064
  description: "A task's attachments: file name, size, mime type, who uploaded it, and the path to fetch the bytes. " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clokio-mcp",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "Model Context Protocol (MCP) server for Clokio - manage tasks, projects, clients, employees, attendance and documents from Claude and any MCP client.",
5
5
  "type": "module",
6
6
  "bin": {