| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- package data
- import (
- "github.com/mark3labs/mcp-go/mcp"
- "github.com/mark3labs/mcp-go/server"
- )
- func registerPlaneApiTools(s *server.MCPServer) {
- // === Project ===
- s.AddTool(
- mcp.NewTool("data_plane_list_projects",
- mcp.WithDescription("列出 Plane 所有项目(V1 API)"),
- ),
- handlePlaneListProjects,
- )
- s.AddTool(
- mcp.NewTool("data_plane_get_project",
- mcp.WithDescription("获取 Plane 项目详情(V1 API)"),
- mcp.WithString("project_id", mcp.Required(), mcp.Description("项目 UUID")),
- ),
- handlePlaneGetProject,
- )
- s.AddTool(
- mcp.NewTool("data_plane_get_project_summary",
- mcp.WithDescription("获取 Plane 项目摘要统计(V1 API)"),
- mcp.WithString("project_id", mcp.Required(), mcp.Description("项目 UUID")),
- mcp.WithString("fields", mcp.Description("要获取的字段,逗号分隔")),
- ),
- handlePlaneGetProjectSummary,
- )
- // === Work Item ===
- s.AddTool(
- mcp.NewTool("data_plane_list_work_items",
- mcp.WithDescription("列出 Plane 工作项列表(V1 API)"),
- mcp.WithString("state", mcp.Description("状态ID过滤")),
- mcp.WithString("priority", mcp.Description("优先级过滤")),
- mcp.WithString("assignee", mcp.Description("指派人ID过滤")),
- mcp.WithString("label", mcp.Description("标签ID过滤")),
- ),
- handlePlaneListWorkItems,
- )
- s.AddTool(
- mcp.NewTool("data_plane_get_work_item",
- mcp.WithDescription("获取 Plane 工作项详情(V1 API)"),
- mcp.WithString("work_item_id", mcp.Required(), mcp.Description("工作项 UUID")),
- ),
- handlePlaneGetWorkItem,
- )
- s.AddTool(
- mcp.NewTool("data_plane_get_work_item_by_identifier",
- mcp.WithDescription("通过标识符获取工作项(如 PROJ-42)(V1 API)"),
- mcp.WithString("identifier", mcp.Required(), mcp.Description("项目标识符(如 PROJ)")),
- mcp.WithNumber("sequence_id", mcp.Required(), mcp.Description("序号(如 42)")),
- ),
- handlePlaneGetWorkItemByIdentifier,
- )
- s.AddTool(
- mcp.NewTool("data_plane_search_work_items",
- mcp.WithDescription("搜索 Plane 工作项(V1 API)"),
- mcp.WithString("query", mcp.Required(), mcp.Description("搜索关键字")),
- mcp.WithNumber("limit", mcp.Description("返回数量限制,默认20")),
- ),
- handlePlaneSearchWorkItems,
- )
- // === Cycle ===
- s.AddTool(
- mcp.NewTool("data_plane_list_cycles",
- mcp.WithDescription("列出 Plane 迭代列表(V1 API)"),
- ),
- handlePlaneListCycles,
- )
- s.AddTool(
- mcp.NewTool("data_plane_get_cycle",
- mcp.WithDescription("获取 Plane 迭代详情(V1 API)"),
- mcp.WithString("cycle_id", mcp.Required(), mcp.Description("迭代 UUID")),
- ),
- handlePlaneGetCycle,
- )
- s.AddTool(
- mcp.NewTool("data_plane_list_cycle_issues",
- mcp.WithDescription("列出 Plane 迭代中的工作项(V1 API)"),
- mcp.WithString("cycle_id", mcp.Required(), mcp.Description("迭代 UUID")),
- ),
- handlePlaneListCycleIssues,
- )
- // === Module ===
- s.AddTool(
- mcp.NewTool("data_plane_list_modules",
- mcp.WithDescription("列出 Plane 模块列表(V1 API)"),
- ),
- handlePlaneListModules,
- )
- s.AddTool(
- mcp.NewTool("data_plane_get_module",
- mcp.WithDescription("获取 Plane 模块详情(V1 API)"),
- mcp.WithString("module_id", mcp.Required(), mcp.Description("模块 UUID")),
- ),
- handlePlaneGetModule,
- )
- s.AddTool(
- mcp.NewTool("data_plane_list_module_issues",
- mcp.WithDescription("列出 Plane 模块中的工作项(V1 API)"),
- mcp.WithString("module_id", mcp.Required(), mcp.Description("模块 UUID")),
- ),
- handlePlaneListModuleIssues,
- )
- // === State / Label / Member ===
- s.AddTool(
- mcp.NewTool("data_plane_list_states",
- mcp.WithDescription("列出 Plane 项目状态列表(V1 API)"),
- ),
- handlePlaneListStates,
- )
- s.AddTool(
- mcp.NewTool("data_plane_list_labels",
- mcp.WithDescription("列出 Plane 项目标签列表(V1 API)"),
- ),
- handlePlaneListLabels,
- )
- s.AddTool(
- mcp.NewTool("data_plane_list_workspace_members",
- mcp.WithDescription("列出 Plane 工作空间成员(V1 API)"),
- ),
- handlePlaneListWorkspaceMembers,
- )
- s.AddTool(
- mcp.NewTool("data_plane_list_project_members",
- mcp.WithDescription("列出 Plane 项目成员(V1 API)"),
- ),
- handlePlaneListProjectMembers,
- )
- // === Comment / Activity / Attachment / Relation ===
- s.AddTool(
- mcp.NewTool("data_plane_list_work_item_comments",
- mcp.WithDescription("列出 Plane 工作项评论(V1 API)"),
- mcp.WithString("work_item_id", mcp.Required(), mcp.Description("工作项 UUID")),
- ),
- handlePlaneListWorkItemComments,
- )
- s.AddTool(
- mcp.NewTool("data_plane_list_work_item_activities",
- mcp.WithDescription("列出 Plane 工作项活动历史(V1 API)"),
- mcp.WithString("work_item_id", mcp.Required(), mcp.Description("工作项 UUID")),
- ),
- handlePlaneListWorkItemActivities,
- )
- s.AddTool(
- mcp.NewTool("data_plane_list_work_item_links",
- mcp.WithDescription("列出 Plane 工作项链接(V1 API)"),
- mcp.WithString("work_item_id", mcp.Required(), mcp.Description("工作项 UUID")),
- ),
- handlePlaneListWorkItemLinks,
- )
- s.AddTool(
- mcp.NewTool("data_plane_list_work_item_attachments",
- mcp.WithDescription("列出 Plane 工作项附件(V1 API)"),
- mcp.WithString("work_item_id", mcp.Required(), mcp.Description("工作项 UUID")),
- ),
- handlePlaneListWorkItemAttachments,
- )
- s.AddTool(
- mcp.NewTool("data_plane_list_work_item_relations",
- mcp.WithDescription("列出 Plane 工作项关系(V1 API)"),
- mcp.WithString("work_item_id", mcp.Required(), mcp.Description("工作项 UUID")),
- ),
- handlePlaneListWorkItemRelations,
- )
- // === Intake ===
- s.AddTool(
- mcp.NewTool("data_plane_get_intake_issue_list",
- mcp.WithDescription("查询 Plane Intake Issue 列表(V1 API)"),
- ),
- handlePlaneGetIntakeIssueList,
- )
- s.AddTool(
- mcp.NewTool("data_plane_get_intake_issue_detail",
- mcp.WithDescription("获取 Plane Intake Issue 详情(V1 API)"),
- mcp.WithString("intake_id", mcp.Required(), mcp.Description("Intake Issue UUID")),
- ),
- handlePlaneGetIntakeIssueDetail,
- )
- // === V2 Web API: Page ===
- s.AddTool(
- mcp.NewTool("data_plane_list_pages",
- mcp.WithDescription("列出 Plane 页面列表(V2 Web API)"),
- ),
- handlePlaneListPages,
- )
- s.AddTool(
- mcp.NewTool("data_plane_get_page",
- mcp.WithDescription("获取 Plane 页面详情(V2 Web API)"),
- mcp.WithString("page_id", mcp.Required(), mcp.Description("页面 UUID")),
- ),
- handlePlaneGetPage,
- )
- s.AddTool(
- mcp.NewTool("data_plane_get_page_description",
- mcp.WithDescription("获取 Plane 页面描述内容(V2 Web API)"),
- mcp.WithString("page_id", mcp.Required(), mcp.Description("页面 UUID")),
- ),
- handlePlaneGetPageDescription,
- )
- }
|