Skip to content

Commit 04845e8

Browse files
authored
Merge pull request #12 from wiltaylor/add-comment-task-tool
Add task commenting functionality via add_comment_task tool
2 parents 97ec450 + 47882af commit 04845e8

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

index.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { join, dirname } from "path";
1919
import { fileURLToPath } from "url";
2020
import {
2121
ApiError,
22+
CommentCreate,
23+
CommentService,
2224
ConfigService,
2325
DocCreate,
2426
DocService,
@@ -417,6 +419,28 @@ const DELETE_TASK_TOOL: Tool = {
417419
},
418420
};
419421

422+
const ADD_TASK_COMMENT_TOOL: Tool = {
423+
name: "add_task_comment",
424+
description:
425+
"Add a comment to an existing task without modifying the task description. Comments support markdown formatting.",
426+
inputSchema: {
427+
type: "object",
428+
properties: {
429+
taskId: {
430+
type: "string",
431+
description: "The 12-character alphanumeric ID of the task",
432+
pattern: "^[a-zA-Z0-9]{12}$",
433+
},
434+
text: {
435+
type: "string",
436+
description:
437+
"The full content of the comment, which can include markdown formatting.",
438+
},
439+
},
440+
required: ["taskId", "text"],
441+
},
442+
};
443+
420444
const LIST_DOCS_TOOL: Tool = {
421445
name: "list_docs",
422446
description:
@@ -714,6 +738,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
714738
GET_TASK_TOOL,
715739
UPDATE_TASK_TOOL,
716740
DELETE_TASK_TOOL,
741+
ADD_TASK_COMMENT_TOOL,
717742
LIST_DOCS_TOOL,
718743
CREATE_DOC_TOOL,
719744
GET_DOC_TOOL,
@@ -772,6 +797,17 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
772797
content: [{ type: "text", text: JSON.stringify(task, null, 2) }],
773798
};
774799
}
800+
case "add_task_comment": {
801+
const taskId = getIdValidated(request.params.arguments.taskId);
802+
const text = request.params.arguments.text;
803+
const commentData = { taskId, text } as CommentCreate;
804+
const comment = await CommentService.createComment({
805+
item: commentData,
806+
});
807+
return {
808+
content: [{ type: "text", text: JSON.stringify(comment, null, 2) }],
809+
};
810+
}
775811
case "list_docs": {
776812
const docs = await DocService.listDocs(request.params.arguments);
777813
return {

0 commit comments

Comments
 (0)