plane_v2_api.go 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. package data
  2. import (
  3. "github.com/mark3labs/mcp-go/mcp"
  4. "github.com/mark3labs/mcp-go/server"
  5. )
  6. func registerPlaneV2ApiTools(s *server.MCPServer) {
  7. // ============ Workspace (读) ============
  8. s.AddTool(
  9. mcp.NewTool("data_plane_v2_list_workspaces",
  10. mcp.WithDescription("列出所有工作空间(V2 Web API)"),
  11. ),
  12. handlePlaneV2ListWorkspaces,
  13. )
  14. s.AddTool(
  15. mcp.NewTool("data_plane_v2_get_workspace",
  16. mcp.WithDescription("获取当前工作空间详情(V2 Web API)"),
  17. ),
  18. handlePlaneV2GetWorkspace,
  19. )
  20. // ============ Project (读) ============
  21. s.AddTool(
  22. mcp.NewTool("data_plane_v2_list_projects",
  23. mcp.WithDescription("列出工作空间下的所有项目(V2 Web API)"),
  24. ),
  25. handlePlaneV2ListProjects,
  26. )
  27. s.AddTool(
  28. mcp.NewTool("data_plane_v2_get_project",
  29. mcp.WithDescription("获取项目详情(V2 Web API)"),
  30. mcp.WithString("project_id", mcp.Required(), mcp.Description("项目 UUID")),
  31. ),
  32. handlePlaneV2GetProject,
  33. )
  34. // ============ Issue (读) ============
  35. s.AddTool(
  36. mcp.NewTool("data_plane_v2_list_issues",
  37. mcp.WithDescription("列出项目工作项列表(V2 Web API)"),
  38. ),
  39. handlePlaneV2ListIssues,
  40. )
  41. s.AddTool(
  42. mcp.NewTool("data_plane_v2_get_issue",
  43. mcp.WithDescription("获取工作项详情(V2 Web API)"),
  44. mcp.WithString("issue_id", mcp.Required(), mcp.Description("工作项 UUID")),
  45. ),
  46. handlePlaneV2GetIssue,
  47. )
  48. s.AddTool(
  49. mcp.NewTool("data_plane_v2_get_sub_issues",
  50. mcp.WithDescription("获取子工作项列表(V2 Web API)"),
  51. mcp.WithString("issue_id", mcp.Required(), mcp.Description("父工作项 UUID")),
  52. ),
  53. handlePlaneV2GetSubIssues,
  54. )
  55. s.AddTool(
  56. mcp.NewTool("data_plane_v2_get_issue_activity",
  57. mcp.WithDescription("获取工作项活动历史(V2 Web API)"),
  58. mcp.WithString("issue_id", mcp.Required(), mcp.Description("工作项 UUID")),
  59. ),
  60. handlePlaneV2GetIssueActivity,
  61. )
  62. // ============ Cycle (读) ============
  63. s.AddTool(
  64. mcp.NewTool("data_plane_v2_list_cycles",
  65. mcp.WithDescription("列出项目周期列表(V2 Web API)"),
  66. ),
  67. handlePlaneV2ListCycles,
  68. )
  69. s.AddTool(
  70. mcp.NewTool("data_plane_v2_get_cycle",
  71. mcp.WithDescription("获取周期详情(V2 Web API)"),
  72. mcp.WithString("cycle_id", mcp.Required(), mcp.Description("周期 UUID")),
  73. ),
  74. handlePlaneV2GetCycle,
  75. )
  76. s.AddTool(
  77. mcp.NewTool("data_plane_v2_list_cycle_issues",
  78. mcp.WithDescription("列出周期中的工作项(V2 Web API)"),
  79. mcp.WithString("cycle_id", mcp.Required(), mcp.Description("周期 UUID")),
  80. ),
  81. handlePlaneV2ListCycleIssues,
  82. )
  83. // ============ Module (读) ============
  84. s.AddTool(
  85. mcp.NewTool("data_plane_v2_list_modules",
  86. mcp.WithDescription("列出项目模块列表(V2 Web API)"),
  87. ),
  88. handlePlaneV2ListModules,
  89. )
  90. s.AddTool(
  91. mcp.NewTool("data_plane_v2_get_module",
  92. mcp.WithDescription("获取模块详情(V2 Web API)"),
  93. mcp.WithString("module_id", mcp.Required(), mcp.Description("模块 UUID")),
  94. ),
  95. handlePlaneV2GetModule,
  96. )
  97. s.AddTool(
  98. mcp.NewTool("data_plane_v2_list_module_issues",
  99. mcp.WithDescription("列出模块中的工作项(V2 Web API)"),
  100. mcp.WithString("module_id", mcp.Required(), mcp.Description("模块 UUID")),
  101. ),
  102. handlePlaneV2ListModuleIssues,
  103. )
  104. // ============ Label (读) ============
  105. s.AddTool(
  106. mcp.NewTool("data_plane_v2_list_labels",
  107. mcp.WithDescription("列出项目标签列表(V2 Web API)"),
  108. ),
  109. handlePlaneV2ListLabels,
  110. )
  111. s.AddTool(
  112. mcp.NewTool("data_plane_v2_get_label",
  113. mcp.WithDescription("获取标签详情(V2 Web API)"),
  114. mcp.WithString("label_id", mcp.Required(), mcp.Description("标签 UUID")),
  115. ),
  116. handlePlaneV2GetLabel,
  117. )
  118. // ============ State (读) ============
  119. s.AddTool(
  120. mcp.NewTool("data_plane_v2_list_states",
  121. mcp.WithDescription("列出项目状态列表(V2 Web API)"),
  122. ),
  123. handlePlaneV2ListStates,
  124. )
  125. s.AddTool(
  126. mcp.NewTool("data_plane_v2_get_state",
  127. mcp.WithDescription("获取状态详情(V2 Web API)"),
  128. mcp.WithString("state_id", mcp.Required(), mcp.Description("状态 UUID")),
  129. ),
  130. handlePlaneV2GetState,
  131. )
  132. // ============ Comment (读) ============
  133. s.AddTool(
  134. mcp.NewTool("data_plane_v2_list_comments",
  135. mcp.WithDescription("列出工作项评论(V2 Web API)"),
  136. mcp.WithString("issue_id", mcp.Required(), mcp.Description("工作项 UUID")),
  137. ),
  138. handlePlaneV2ListComments,
  139. )
  140. s.AddTool(
  141. mcp.NewTool("data_plane_v2_get_comment",
  142. mcp.WithDescription("获取评论详情(V2 Web API)"),
  143. mcp.WithString("issue_id", mcp.Required(), mcp.Description("工作项 UUID")),
  144. mcp.WithString("comment_id", mcp.Required(), mcp.Description("评论 UUID")),
  145. ),
  146. handlePlaneV2GetComment,
  147. )
  148. // ============ Link (读) ============
  149. s.AddTool(
  150. mcp.NewTool("data_plane_v2_list_issue_links",
  151. mcp.WithDescription("列出工作项链接(V2 Web API)"),
  152. mcp.WithString("issue_id", mcp.Required(), mcp.Description("工作项 UUID")),
  153. ),
  154. handlePlaneV2ListIssueLinks,
  155. )
  156. // ============ Relation (读) ============
  157. s.AddTool(
  158. mcp.NewTool("data_plane_v2_list_issue_relations",
  159. mcp.WithDescription("列出工作项关联关系(V2 Web API)"),
  160. mcp.WithString("issue_id", mcp.Required(), mcp.Description("工作项 UUID")),
  161. ),
  162. handlePlaneV2ListIssueRelations,
  163. )
  164. // ============ Sticky (读) ============
  165. s.AddTool(
  166. mcp.NewTool("data_plane_v2_list_stickies",
  167. mcp.WithDescription("列出工作空间便签(V2 Web API)"),
  168. ),
  169. handlePlaneV2ListStickies,
  170. )
  171. s.AddTool(
  172. mcp.NewTool("data_plane_v2_get_sticky",
  173. mcp.WithDescription("获取便签详情(V2 Web API)"),
  174. mcp.WithString("sticky_id", mcp.Required(), mcp.Description("便签 UUID")),
  175. ),
  176. handlePlaneV2GetSticky,
  177. )
  178. // ============ Intake (读) ============
  179. s.AddTool(
  180. mcp.NewTool("data_plane_v2_list_intake_issues",
  181. mcp.WithDescription("列出收件箱工作项(V2 Web API)"),
  182. mcp.WithString("status", mcp.Description("状态过滤")),
  183. ),
  184. handlePlaneV2ListIntakeIssues,
  185. )
  186. s.AddTool(
  187. mcp.NewTool("data_plane_v2_get_intake_issue",
  188. mcp.WithDescription("获取收件箱工作项详情(V2 Web API)"),
  189. mcp.WithString("issue_id", mcp.Required(), mcp.Description("工作项 UUID")),
  190. ),
  191. handlePlaneV2GetIntakeIssue,
  192. )
  193. // ============ Asset (读) ============
  194. s.AddTool(
  195. mcp.NewTool("data_plane_v2_get_project_asset_url",
  196. mcp.WithDescription("获取项目资源的预签名访问 URL(V2 Web API)"),
  197. mcp.WithString("asset_id", mcp.Required(), mcp.Description("资源 UUID")),
  198. ),
  199. handlePlaneV2GetProjectAssetURL,
  200. )
  201. // ============ Page (读) ============
  202. s.AddTool(
  203. mcp.NewTool("data_plane_v2_list_pages",
  204. mcp.WithDescription("列出项目页面列表(V2 Web API)"),
  205. ),
  206. handlePlaneV2ListPages,
  207. )
  208. s.AddTool(
  209. mcp.NewTool("data_plane_v2_get_page",
  210. mcp.WithDescription("获取页面详情(V2 Web API)"),
  211. mcp.WithString("page_id", mcp.Required(), mcp.Description("页面 UUID")),
  212. ),
  213. handlePlaneV2GetPage,
  214. )
  215. s.AddTool(
  216. mcp.NewTool("data_plane_v2_get_page_description",
  217. mcp.WithDescription("获取页面描述内容(V2 Web API)"),
  218. mcp.WithString("page_id", mcp.Required(), mcp.Description("页面 UUID")),
  219. ),
  220. handlePlaneV2GetPageDescription,
  221. )
  222. // ============ Member (读) ============
  223. s.AddTool(
  224. mcp.NewTool("data_plane_v2_list_workspace_members",
  225. mcp.WithDescription("列出工作空间成员(V2 Web API)"),
  226. ),
  227. handlePlaneV2ListWorkspaceMembers,
  228. )
  229. s.AddTool(
  230. mcp.NewTool("data_plane_v2_get_workspace_member",
  231. mcp.WithDescription("获取工作空间成员详情(V2 Web API)"),
  232. mcp.WithString("member_id", mcp.Required(), mcp.Description("成员 UUID")),
  233. ),
  234. handlePlaneV2GetWorkspaceMember,
  235. )
  236. s.AddTool(
  237. mcp.NewTool("data_plane_v2_list_project_members",
  238. mcp.WithDescription("列出项目成员(V2 Web API)"),
  239. ),
  240. handlePlaneV2ListProjectMembers,
  241. )
  242. s.AddTool(
  243. mcp.NewTool("data_plane_v2_get_project_member",
  244. mcp.WithDescription("获取项目成员详情(V2 Web API)"),
  245. mcp.WithString("member_id", mcp.Required(), mcp.Description("成员 UUID")),
  246. ),
  247. handlePlaneV2GetProjectMember,
  248. )
  249. }