Documentation
¶
Overview ¶
Package mail provides declarative shortcuts for the DingTalk mail (邮箱) service: mailbox / message / draft / thread / folder / tag / user / attachment / template / contact / auto-reply / rule operations. Each shortcut maps 1:1 onto an MCP tool declared in internal/helpers/mail.go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ContactList = shortcut.Shortcut{ Service: "mail", Command: "+contact-list", Product: "mail", Description: "列出指定邮箱的所有邮件联系人", Intent: "当你想查看某邮箱通讯录里有哪些联系人、或需要取得联系人 ID 以便更新或删除时使用;传入邮箱和每页数量,返回联系人列表,支持分页。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "email", Type: shortcut.FlagString, Desc: "用户邮箱地址", Required: true}, {Name: "limit", Type: shortcut.FlagString, Desc: "每页返回数量", Required: true}, {Name: "cursor", Type: shortcut.FlagString, Desc: "分页游标,取自响应中的 nextCursor"}, }, Tips: []string{ `dws mail +contact-list --email user@company.com --limit 20`, }, Execute: func(rt *shortcut.RuntimeContext) error { params := map[string]any{ "email": rt.Str("email"), "size": rt.Str("limit"), } if rt.Changed("cursor") { params["cursor"] = rt.Str("cursor") } data, err := rt.CallMCPData("mail", "list_user_mail_contacts", params) if err != nil { return err } contacts := contactListProject(data) return rt.Output(map[string]any{"count": len(contacts), "contacts": contacts}) }, }
ContactCreate 创建邮件联系人。 ContactList 列举邮件联系人。
View Source
var FolderList = shortcut.Shortcut{ Service: "mail", Command: "+folder-list", Product: "mail", Description: "列出顶层文件夹或指定父文件夹下的子文件夹", Intent: "当你需要了解某个邮箱有哪些文件夹、或要取得文件夹 ID 以便移动邮件、按文件夹列信/建规则时使用;传入邮箱(可选父文件夹 ID 查子级),返回文件夹列表及其 ID。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "email", Type: shortcut.FlagString, Desc: "邮件所属邮箱地址", Required: true}, {Name: "folder", Type: shortcut.FlagString, Desc: "父文件夹 ID,不传则返回顶层文件夹"}, }, Tips: []string{ `dws mail +folder-list --email user@company.com`, }, Execute: func(rt *shortcut.RuntimeContext) error { params := map[string]any{ "email": rt.Str("email"), } if rt.Changed("folder") { params["folderId"] = rt.Str("folder") } data, err := rt.CallMCPData("mail", "list_folders", params) if err != nil { return err } folders := folderListProject(data) return rt.Output(map[string]any{"count": len(folders), "folders": folders}) }, }
FolderList 列举邮件文件夹。
View Source
var TagList = shortcut.Shortcut{ Service: "mail", Command: "+tag-list", Product: "mail", Description: "列出指定邮箱下的所有邮件标签", Intent: "当你要查看邮箱里有哪些标签、或需要取得标签 ID 以便给邮件/会话加标签时使用;传入邮箱地址,返回全部邮件标签及其 ID。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "email", Type: shortcut.FlagString, Desc: "用户的邮箱地址", Required: true}, }, Tips: []string{ `dws mail +tag-list --email user@company.com`, }, Execute: func(rt *shortcut.RuntimeContext) error { data, err := rt.CallMCPData("mail", "list_tags", map[string]any{ "email": rt.Str("email"), }) if err != nil { return err } tags := tagListProject(data) return rt.Output(map[string]any{"count": len(tags), "tags": tags}) }, }
TagList 列举邮件标签。
View Source
var TemplateList = shortcut.Shortcut{ Service: "mail", Command: "+template-list", Product: "mail", Description: "列出指定邮箱的所有邮件模板", Intent: "当你想查看某个邮箱下已有哪些邮件模板、或需要取得模板 ID 以便查看详情或更新时使用;传入邮箱和每页数量,返回模板列表,支持分页。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "email", Type: shortcut.FlagString, Desc: "用户邮箱地址", Required: true}, {Name: "limit", Type: shortcut.FlagString, Desc: "每页返回数量", Required: true}, {Name: "cursor", Type: shortcut.FlagString, Desc: "分页游标,取自响应中的 nextCursor"}, }, Tips: []string{ `dws mail +template-list --email user@company.com --limit 20`, }, Execute: func(rt *shortcut.RuntimeContext) error { params := map[string]any{ "email": rt.Str("email"), "size": rt.Str("limit"), } if rt.Changed("cursor") { params["cursor"] = rt.Str("cursor") } data, err := rt.CallMCPData("mail", "list_user_message_templates", params) if err != nil { return err } templates := templateListProject(data) return rt.Output(map[string]any{"count": len(templates), "templates": templates}) }, }
TemplateCreate 创建邮件模板。 TemplateList 列举邮件模板。
View Source
var ThreadList = shortcut.Shortcut{ Service: "mail", Command: "+thread-list", Product: "mail", Description: "列出指定邮箱文件夹下的邮件会话(thread)", Intent: "当你想按会话(同一往来主题的邮件串)而非单封邮件来浏览某个文件夹时使用;传入邮箱和文件夹 ID,可按时间范围和升降序筛选,返回会话列表及其 conversationId,供 +thread 查看详情。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "email", Type: shortcut.FlagString, Desc: "会话所属邮箱地址", Required: true}, {Name: "folder", Type: shortcut.FlagString, Desc: "邮件文件夹 ID(不是文件夹名称)", Required: true}, {Name: "limit", Type: shortcut.FlagInt, Default: "20", Desc: "本次列出的会话数,最大 100"}, {Name: "cursor", Type: shortcut.FlagString, Desc: "分页游标,首次请求可不传"}, {Name: "start", Type: shortcut.FlagString, Desc: "开始 UTC 时间,如 2024-01-01T00:00:00Z"}, {Name: "end", Type: shortcut.FlagString, Desc: "结束 UTC 时间,如 2024-12-31T23:59:59Z"}, {Name: "ascending", Type: shortcut.FlagBool, Desc: "是否按时间升序"}, }, Tips: []string{ `dws mail +thread-list --email user@company.com --folder 104 --limit 20`, }, Execute: func(rt *shortcut.RuntimeContext) error { params := map[string]any{ "email": rt.Str("email"), "folderId": rt.Str("folder"), "size": rt.Int("limit"), } if rt.Changed("cursor") { params["cursor"] = rt.Str("cursor") } if rt.Changed("start") { params["startTime"] = rt.Str("start") } if rt.Changed("end") { params["endTime"] = rt.Str("end") } if rt.Changed("ascending") { params["isAscending"] = rt.Bool("ascending") } data, err := rt.CallMCPData("mail", "list_mailbox_threads", params) if err != nil { return err } threads := threadListProject(data) return rt.Output(map[string]any{"count": len(threads), "threads": threads}) }, }
ThreadList 列出指定邮箱文件夹下的邮件会话。
View Source
var UserSearch = shortcut.Shortcut{ Service: "mail", Command: "+user-search", Product: "mail", Description: "按关键词或工号搜索邮箱用户(仅企业邮箱)", Intent: "当你只知道同事的姓名或工号、需要查出其企业邮箱地址以便发信或添加联系人时使用;提供关键词或工号(至少其一),返回匹配的企业邮箱用户列表。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "keyword", Type: shortcut.FlagString, Desc: "搜索关键词(未提供 --employee-no 时为必填)"}, {Name: "employee-no", Type: shortcut.FlagString, Desc: "按工号精确搜索"}, {Name: "email", Type: shortcut.FlagString, Desc: "搜索目标邮箱地址"}, {Name: "cursor", Type: shortcut.FlagString, Desc: "分页游标,取自响应中的 nextCursor"}, {Name: "limit", Type: shortcut.FlagString, Desc: "每页返回数量"}, }, Constraints: []shortcut.Constraint{ {Kind: shortcut.ConstraintAtLeastOne, Flags: []string{"keyword", "employee-no"}}, }, Tips: []string{ `dws mail +user-search --keyword "张三"`, `dws mail +user-search --email user@company.com --employee-no "E123456"`, }, Execute: func(rt *shortcut.RuntimeContext) error { params := map[string]any{} if rt.Str("keyword") != "" { params["keyword"] = rt.Str("keyword") } if rt.Str("employee-no") != "" { params["employeeNo"] = rt.Str("employee-no") } if rt.Changed("email") { params["email"] = rt.Str("email") } if rt.Changed("cursor") { params["cursor"] = rt.Str("cursor") } if rt.Changed("limit") { params["size"] = rt.Str("limit") } data, err := rt.CallMCPData("mail", "search_mail_users", params) if err != nil { return err } users := userSearchProject(data) return rt.Output(map[string]any{"count": len(users), "users": users}) }, }
UserSearch 按关键词或工号搜索邮箱用户。
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.