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 (已迁移到 plane_v2_api.go) === }