todo

package
v1.0.54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package todo declares high-fidelity shortcuts for the DingTalk "todo" (personal todo) MCP service. Tool names and parameter keys are copied verbatim from internal/helpers/todo.go; do not invent tools or params here.

Index

Constants

This section is empty.

Variables

View Source
var Get = shortcut.Shortcut{
	Service:     "todo",
	Command:     "+get",
	Product:     "todo",
	Description: "查询待办详情",
	Intent:      "当你已知某条待办的任务 ID、想查看它的完整信息(标题、执行者、截止时间、优先级、状态等)时使用;输入任务 ID,返回该待办的详细内容。",
	Risk:        shortcut.RiskRead,
	Flags: []shortcut.Flag{
		{Name: "task-id", Type: shortcut.FlagString, Desc: "待办任务 ID", Required: true},
	},
	Tips: []string{`dws todo +get --task-id <taskId>`},
	Execute: func(rt *shortcut.RuntimeContext) error {
		return rt.CallMCP("get_todo_detail", map[string]any{
			"taskId": rt.Str("task-id"),
		})
	},
}

Update maps helper `update_todo_task`. Complete maps helper `update_todo_done_status`. Get maps helper `get_todo_detail`.

View Source
var GetMyTasks = shortcut.Shortcut{
	Service:     "todo",
	Command:     "+get-my-tasks",
	Product:     "todo",
	Description: "查询当前组织下我的待办列表",
	Intent:      "当你想查看自己在当前组织下的待办清单、盘点未完成事项或按条件筛选任务时使用;可按完成状态、优先级、角色(创建者/执行者/参与者)和截止时间范围过滤并分页,返回匹配的待办列表。",
	Risk:        shortcut.RiskRead,
	Flags: []shortcut.Flag{
		{Name: "page", Type: shortcut.FlagString, Default: "1", Desc: "页码"},
		{Name: "size", Type: shortcut.FlagString, Default: "20", Desc: "每页数量"},
		{Name: "status", Type: shortcut.FlagString, Enum: []string{"true", "false"}, Desc: "true=已完成, false=未完成"},
		{Name: "priority", Type: shortcut.FlagStringSlice, Desc: "优先级过滤: 10/20/30/40"},
		{Name: "role-types", Type: shortcut.FlagStringSlice, Default: "executor", Desc: "角色类型: creator/executor/participant"},
		{Name: "plan-finish-start", Type: shortcut.FlagInt, Desc: "截止时间范围开始(Unix 毫秒时间戳)"},
		{Name: "plan-finish-end", Type: shortcut.FlagInt, Desc: "截止时间范围结束(Unix 毫秒时间戳)"},
	},
	Tips: []string{`dws todo +get-my-tasks --status false --priority 40,30`},
	Execute: func(rt *shortcut.RuntimeContext) error {
		params := map[string]any{
			"pageNum":  rt.Str("page"),
			"pageSize": rt.Str("size"),
		}
		if rt.Changed("status") {
			params["todoStatus"] = rt.Str("status")
		}
		if rt.Changed("priority") {
			var ps []int
			for _, p := range rt.StrSlice("priority") {
				if n, err := strconv.Atoi(p); err == nil {
					ps = append(ps, n)
				}
			}
			if ps != nil {
				params["priorityList"] = ps
			}
		}
		roles := rt.StrSlice("role-types")
		if len(roles) == 0 {
			roles = []string{"executor"}
		}
		params["roleTypes"] = roles
		if rt.Changed("plan-finish-start") {
			params["planFinishDateStart"] = rt.Int("plan-finish-start")
		}
		if rt.Changed("plan-finish-end") {
			params["planFinishDateEnd"] = rt.Int("plan-finish-end")
		}
		data, err := rt.CallMCPData("todo", "get_user_todos_in_current_org", params)
		if err != nil {
			return err
		}
		cards := getMyTasksProject(data)
		return rt.Output(map[string]any{"count": len(cards), "todos": cards})
	},
}

Create maps helper `create_personal_todo`. CreateSub maps helper `create_personal_sub_todo`. GetMyTasks maps helper `get_user_todos_in_current_org`.

View Source
var ListAttachment = shortcut.Shortcut{
	Service:     "todo",
	Command:     "+list-attachment",
	Product:     "todo",
	Description: "查询待办任务的附件列表",
	Intent:      "当你想查看某条待办上挂了哪些附件、或需要拿到附件 ID 以便后续删除时使用;输入任务 ID,返回该待办的附件列表。",
	Risk:        shortcut.RiskRead,
	Flags: []shortcut.Flag{
		{Name: "task-id", Type: shortcut.FlagString, Desc: "待办任务 ID", Required: true},
	},
	Tips: []string{`dws todo +list-attachment --task-id <taskId>`},
	Execute: func(rt *shortcut.RuntimeContext) error {
		data, err := rt.CallMCPData("todo", "list_todo_attachment", map[string]any{
			"todoAttachmentListRequest": map[string]any{
				"taskId": rt.Str("task-id"),
			},
		})
		if err != nil {
			return err
		}
		atts := listAttachmentProject(data)
		return rt.Output(map[string]any{"count": len(atts), "attachments": atts})
	},
}

Delete maps helper `delete_todo`. AddExecutor maps helper `add_task_executors`. RemoveExecutor maps helper `remove_task_executors`. AddParticipant maps helper `add_task_participants`. RemoveParticipant maps helper `remove_task_participants`. AddReminder maps helper `add_todo_reminder`. ListAttachment maps helper `list_todo_attachment`.

View Source
var ListComment = shortcut.Shortcut{
	Service:     "todo",
	Command:     "+list-comment",
	Product:     "todo",
	Description: "查询待办评论列表",
	Intent:      "当你想查看某条待办下的讨论记录、了解协作沟通历史或获取评论 ID 以便删除时使用;输入任务 ID 并可分页,返回该待办的评论列表。",
	Risk:        shortcut.RiskRead,
	Flags: []shortcut.Flag{
		{Name: "task-id", Type: shortcut.FlagString, Desc: "待办任务 ID", Required: true},
		{Name: "page", Type: shortcut.FlagString, Default: "1", Desc: "页码"},
		{Name: "size", Type: shortcut.FlagString, Default: "20", Desc: "每页数量"},
	},
	Tips: []string{`dws todo +list-comment --task-id <taskId>`},
	Execute: func(rt *shortcut.RuntimeContext) error {
		data, err := rt.CallMCPData("todo", "list_todo_comment", map[string]any{
			"taskId":   rt.Str("task-id"),
			"page":     rt.Str("page"),
			"pageSize": rt.Str("size"),
		})
		if err != nil {
			return err
		}
		comments := listCommentProject(data)
		return rt.Output(map[string]any{"count": len(comments), "comments": comments})
	},
}

RemoveAttachment maps helper `remove_todo_attachment`. AddComment maps helper `add_todo_comment`. ListComment maps helper `list_todo_comment`.

View Source
var ListSub = shortcut.Shortcut{
	Service:     "todo",
	Command:     "+list-sub",
	Product:     "todo",
	Description: "查询子待办列表",
	Intent:      "当你已知某个待办任务 ID、想了解它被拆解出的所有子任务时使用;输入父任务 ID,返回其下的子待办列表。",
	Risk:        shortcut.RiskRead,
	Flags: []shortcut.Flag{
		{Name: "task-id", Type: shortcut.FlagString, Desc: "待办任务 ID", Required: true},
	},
	Tips: []string{`dws todo +list-sub --task-id <taskId>`},
	Execute: func(rt *shortcut.RuntimeContext) error {
		data, err := rt.CallMCPData("todo", "list_sub_tasks", map[string]any{
			"todoSubTaskListRequest": map[string]any{
				"taskId": rt.Str("task-id"),
			},
		})
		if err != nil {
			return err
		}
		subs := listSubProject(data)
		return rt.Output(map[string]any{"count": len(subs), "subTasks": subs})
	},
}

ListSub maps helper `list_sub_tasks`.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL