|
@@ -11,291 +11,217 @@ import (
|
|
|
// === Workspace Handlers ===
|
|
// === Workspace Handlers ===
|
|
|
|
|
|
|
|
func handlePlaneV2ListWorkspaces(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2ListWorkspaces(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- data, err := planeV2.ListWorkspaces()
|
|
|
|
|
|
|
+ data, err := planeV2Svc.ListWorkspaces()
|
|
|
return planeRawResult(data, err, "列出工作空间")
|
|
return planeRawResult(data, err, "列出工作空间")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func handlePlaneV2GetWorkspace(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2GetWorkspace(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- data, err := planeV2.GetWorkspace(planeV2Workspace)
|
|
|
|
|
- return planeRawResult(data, err, "获取工作空间详情")
|
|
|
|
|
|
|
+ slug, err := req.RequireString("workspace_slug")
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return helper.ParamError("workspace_slug"), nil
|
|
|
|
|
+ }
|
|
|
|
|
+ data, apiErr := planeV2Svc.GetWorkspace(slug)
|
|
|
|
|
+ return planeRawResult(data, apiErr, "获取工作空间详情")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// === Project Handlers ===
|
|
// === Project Handlers ===
|
|
|
|
|
|
|
|
func handlePlaneV2ListProjects(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2ListProjects(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- data, err := planeV2.ListProjects(planeV2Workspace)
|
|
|
|
|
- return planeRawResult(data, err, "列出项目")
|
|
|
|
|
|
|
+ slug, err := req.RequireString("workspace_slug")
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return helper.ParamError("workspace_slug"), nil
|
|
|
|
|
+ }
|
|
|
|
|
+ data, apiErr := planeV2Svc.ListProjects(slug)
|
|
|
|
|
+ return planeRawResult(data, apiErr, "列出项目")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func handlePlaneV2GetProject(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2GetProject(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- id, err := req.RequireString("project_id")
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, err := req.RequireString("project_id")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return helper.ParamError("project_id"), nil
|
|
return helper.ParamError("project_id"), nil
|
|
|
}
|
|
}
|
|
|
- data, apiErr := planeV2.GetProject(planeV2Workspace, id)
|
|
|
|
|
|
|
+ data, apiErr := planeV2Svc.GetProject(slug, projectId)
|
|
|
return planeRawResult(data, apiErr, "获取项目详情")
|
|
return planeRawResult(data, apiErr, "获取项目详情")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// === Issue Handlers ===
|
|
// === Issue Handlers ===
|
|
|
|
|
|
|
|
func handlePlaneV2ListIssues(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2ListIssues(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- data, err := planeV2.ListIssues(planeV2Workspace, planeV2Project)
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ data, err := planeV2Svc.ListIssues(slug, projectId)
|
|
|
return planeRawResult(data, err, "列出工作项")
|
|
return planeRawResult(data, err, "列出工作项")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func handlePlaneV2GetIssue(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2GetIssue(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- id, err := req.RequireString("issue_id")
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ issueId, err := req.RequireString("issue_id")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return helper.ParamError("issue_id"), nil
|
|
return helper.ParamError("issue_id"), nil
|
|
|
}
|
|
}
|
|
|
- data, apiErr := planeV2.GetIssue(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
|
|
+ data, apiErr := planeV2Svc.GetIssue(slug, projectId, issueId)
|
|
|
return planeRawResult(data, apiErr, "获取工作项详情")
|
|
return planeRawResult(data, apiErr, "获取工作项详情")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func handlePlaneV2GetSubIssues(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2GetSubIssues(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- id, err := req.RequireString("issue_id")
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ issueId, err := req.RequireString("issue_id")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return helper.ParamError("issue_id"), nil
|
|
return helper.ParamError("issue_id"), nil
|
|
|
}
|
|
}
|
|
|
- data, apiErr := planeV2.GetSubIssues(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
|
|
+ data, apiErr := planeV2Svc.GetSubIssues(slug, projectId, issueId)
|
|
|
return planeRawResult(data, apiErr, "获取子工作项")
|
|
return planeRawResult(data, apiErr, "获取子工作项")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func handlePlaneV2GetIssueActivity(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2GetIssueActivity(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- id, err := req.RequireString("issue_id")
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ issueId, err := req.RequireString("issue_id")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return helper.ParamError("issue_id"), nil
|
|
return helper.ParamError("issue_id"), nil
|
|
|
}
|
|
}
|
|
|
- data, apiErr := planeV2.GetIssueActivity(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
|
|
+ data, apiErr := planeV2Svc.GetIssueActivity(slug, projectId, issueId)
|
|
|
return planeRawResult(data, apiErr, "获取工作项活动历史")
|
|
return planeRawResult(data, apiErr, "获取工作项活动历史")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// === Intake Handlers ===
|
|
|
|
|
+
|
|
|
|
|
+func handlePlaneV2ListIntakeIssues(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ status := req.GetString("status", "")
|
|
|
|
|
+ data, err := planeV2Svc.ListIntakeIssues(slug, projectId, status)
|
|
|
|
|
+ return planeRawResult(data, err, "列出收件箱工作项")
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func handlePlaneV2GetIntakeIssue(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ issueId, err := req.RequireString("issue_id")
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return helper.ParamError("issue_id"), nil
|
|
|
|
|
+ }
|
|
|
|
|
+ data, apiErr := planeV2Svc.GetIntakeIssue(slug, projectId, issueId)
|
|
|
|
|
+ return planeRawResult(data, apiErr, "获取收件箱工作项详情")
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// === Cycle Handlers ===
|
|
// === Cycle Handlers ===
|
|
|
|
|
|
|
|
func handlePlaneV2ListCycles(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2ListCycles(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- data, err := planeV2.ListCycles(planeV2Workspace, planeV2Project)
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ data, err := planeV2Svc.ListCycles(slug, projectId)
|
|
|
return planeRawResult(data, err, "列出周期")
|
|
return planeRawResult(data, err, "列出周期")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func handlePlaneV2GetCycle(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2GetCycle(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- id, err := req.RequireString("cycle_id")
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ cycleId, err := req.RequireString("cycle_id")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return helper.ParamError("cycle_id"), nil
|
|
return helper.ParamError("cycle_id"), nil
|
|
|
}
|
|
}
|
|
|
- data, apiErr := planeV2.GetCycle(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
|
|
+ data, apiErr := planeV2Svc.GetCycle(slug, projectId, cycleId)
|
|
|
return planeRawResult(data, apiErr, "获取周期详情")
|
|
return planeRawResult(data, apiErr, "获取周期详情")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func handlePlaneV2ListCycleIssues(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("cycle_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("cycle_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- data, apiErr := planeV2.ListCycleIssues(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "列出周期工作项")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// === Module Handlers ===
|
|
// === Module Handlers ===
|
|
|
|
|
|
|
|
func handlePlaneV2ListModules(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2ListModules(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- data, err := planeV2.ListModules(planeV2Workspace, planeV2Project)
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ data, err := planeV2Svc.ListModules(slug, projectId)
|
|
|
return planeRawResult(data, err, "列出模块")
|
|
return planeRawResult(data, err, "列出模块")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func handlePlaneV2GetModule(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2GetModule(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- id, err := req.RequireString("module_id")
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ moduleId, err := req.RequireString("module_id")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return helper.ParamError("module_id"), nil
|
|
return helper.ParamError("module_id"), nil
|
|
|
}
|
|
}
|
|
|
- data, apiErr := planeV2.GetModule(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
|
|
+ data, apiErr := planeV2Svc.GetModule(slug, projectId, moduleId)
|
|
|
return planeRawResult(data, apiErr, "获取模块详情")
|
|
return planeRawResult(data, apiErr, "获取模块详情")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func handlePlaneV2ListModuleIssues(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("module_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("module_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- data, apiErr := planeV2.ListModuleIssues(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "列出模块工作项")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// === Label Handlers ===
|
|
// === Label Handlers ===
|
|
|
|
|
|
|
|
func handlePlaneV2ListLabels(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2ListLabels(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- data, err := planeV2.ListLabels(planeV2Workspace, planeV2Project)
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ data, err := planeV2Svc.ListLabels(slug, projectId)
|
|
|
return planeRawResult(data, err, "列出标签")
|
|
return planeRawResult(data, err, "列出标签")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func handlePlaneV2GetLabel(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("label_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("label_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- data, apiErr := planeV2.GetLabel(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "获取标签详情")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// === State Handlers ===
|
|
// === State Handlers ===
|
|
|
|
|
|
|
|
func handlePlaneV2ListStates(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2ListStates(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- data, err := planeV2.ListStates(planeV2Workspace, planeV2Project)
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ data, err := planeV2Svc.ListStates(slug, projectId)
|
|
|
return planeRawResult(data, err, "列出状态")
|
|
return planeRawResult(data, err, "列出状态")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func handlePlaneV2GetState(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("state_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("state_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- data, apiErr := planeV2.GetState(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "获取状态详情")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// === Comment Handlers ===
|
|
|
|
|
-
|
|
|
|
|
-func handlePlaneV2ListComments(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("issue_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("issue_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- data, apiErr := planeV2.ListComments(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "列出评论")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func handlePlaneV2GetComment(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- issueID, err := req.RequireString("issue_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("issue_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- commentID, err := req.RequireString("comment_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("comment_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- data, apiErr := planeV2.GetComment(planeV2Workspace, planeV2Project, issueID, commentID)
|
|
|
|
|
- return planeRawResult(data, apiErr, "获取评论详情")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// === Link Handlers ===
|
|
|
|
|
-
|
|
|
|
|
-func handlePlaneV2ListIssueLinks(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("issue_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("issue_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- data, apiErr := planeV2.ListIssueLinks(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "列出工作项链接")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// === Relation Handlers ===
|
|
|
|
|
-
|
|
|
|
|
-func handlePlaneV2ListIssueRelations(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("issue_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("issue_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- data, apiErr := planeV2.ListIssueRelations(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "列出工作项关联")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// === Sticky Handlers ===
|
|
|
|
|
-
|
|
|
|
|
-func handlePlaneV2ListStickies(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- data, err := planeV2.ListStickies(planeV2Workspace)
|
|
|
|
|
- return planeRawResult(data, err, "列出便签")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func handlePlaneV2GetSticky(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("sticky_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("sticky_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- data, apiErr := planeV2.GetSticky(planeV2Workspace, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "获取便签详情")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// === Intake Handlers ===
|
|
|
|
|
-
|
|
|
|
|
-func handlePlaneV2ListIntakeIssues(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- status := req.GetString("status", "")
|
|
|
|
|
- data, err := planeV2.ListIntakeIssues(planeV2Workspace, planeV2Project, status)
|
|
|
|
|
- return planeRawResult(data, err, "列出收件箱工作项")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func handlePlaneV2GetIntakeIssue(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("issue_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("issue_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- data, apiErr := planeV2.GetIntakeIssue(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "获取收件箱工作项详情")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// === Asset Handlers ===
|
|
|
|
|
-
|
|
|
|
|
-func handlePlaneV2GetProjectAssetURL(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("asset_id")
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return helper.ParamError("asset_id"), nil
|
|
|
|
|
- }
|
|
|
|
|
- url, apiErr := planeV2.GetProjectAssetURL(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
- if apiErr != nil {
|
|
|
|
|
- return helper.ServiceError("获取资源URL", apiErr), nil
|
|
|
|
|
- }
|
|
|
|
|
- return helper.TextResult(url), nil
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// === Page Handlers ===
|
|
// === Page Handlers ===
|
|
|
|
|
|
|
|
func handlePlaneV2ListPages(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2ListPages(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- data, err := planeV2.ListPages(planeV2Workspace, planeV2Project)
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ data, err := planeV2Svc.ListPages(slug, projectId)
|
|
|
return planeRawResult(data, err, "列出页面")
|
|
return planeRawResult(data, err, "列出页面")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func handlePlaneV2GetPage(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2GetPage(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- id, err := req.RequireString("page_id")
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ pageId, err := req.RequireString("page_id")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return helper.ParamError("page_id"), nil
|
|
return helper.ParamError("page_id"), nil
|
|
|
}
|
|
}
|
|
|
- data, apiErr := planeV2.GetPage(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
|
|
+ data, apiErr := planeV2Svc.GetPage(slug, projectId, pageId)
|
|
|
return planeRawResult(data, apiErr, "获取页面详情")
|
|
return planeRawResult(data, apiErr, "获取页面详情")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func handlePlaneV2GetPageDescription(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2GetPageDescription(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- id, err := req.RequireString("page_id")
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ pageId, err := req.RequireString("page_id")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return helper.ParamError("page_id"), nil
|
|
return helper.ParamError("page_id"), nil
|
|
|
}
|
|
}
|
|
|
- data, apiErr := planeV2.GetPageDescription(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "获取页面描述")
|
|
|
|
|
|
|
+ data, apiErr := planeV2Svc.GetPageDescription(slug, projectId, pageId)
|
|
|
|
|
+ return planeRawResult(data, apiErr, "获取页面描述内容")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// === Member Handlers ===
|
|
// === Member Handlers ===
|
|
|
|
|
|
|
|
func handlePlaneV2ListWorkspaceMembers(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2ListWorkspaceMembers(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- data, err := planeV2.ListWorkspaceMembers(planeV2Workspace)
|
|
|
|
|
- return planeRawResult(data, err, "列出工作空间成员")
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func handlePlaneV2GetWorkspaceMember(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("member_id")
|
|
|
|
|
|
|
+ slug, err := req.RequireString("workspace_slug")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
- return helper.ParamError("member_id"), nil
|
|
|
|
|
|
|
+ return helper.ParamError("workspace_slug"), nil
|
|
|
}
|
|
}
|
|
|
- data, apiErr := planeV2.GetWorkspaceMember(planeV2Workspace, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "获取工作空间成员详情")
|
|
|
|
|
|
|
+ data, apiErr := planeV2Svc.ListWorkspaceMembers(slug)
|
|
|
|
|
+ return planeRawResult(data, apiErr, "列出工作空间成员")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func handlePlaneV2ListProjectMembers(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
func handlePlaneV2ListProjectMembers(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
- data, err := planeV2.ListProjectMembers(planeV2Workspace, planeV2Project)
|
|
|
|
|
|
|
+ slug, _ := req.RequireString("workspace_slug")
|
|
|
|
|
+ projectId, _ := req.RequireString("project_id")
|
|
|
|
|
+ data, err := planeV2Svc.ListProjectMembers(slug, projectId)
|
|
|
return planeRawResult(data, err, "列出项目成员")
|
|
return planeRawResult(data, err, "列出项目成员")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func handlePlaneV2GetProjectMember(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
- id, err := req.RequireString("member_id")
|
|
|
|
|
|
|
+// === Sticky Handlers ===
|
|
|
|
|
+
|
|
|
|
|
+func handlePlaneV2ListStickies(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
|
|
|
+ slug, err := req.RequireString("workspace_slug")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
- return helper.ParamError("member_id"), nil
|
|
|
|
|
|
|
+ return helper.ParamError("workspace_slug"), nil
|
|
|
}
|
|
}
|
|
|
- data, apiErr := planeV2.GetProjectMember(planeV2Workspace, planeV2Project, id)
|
|
|
|
|
- return planeRawResult(data, apiErr, "获取项目成员详情")
|
|
|
|
|
|
|
+ data, apiErr := planeV2Svc.ListStickies(slug)
|
|
|
|
|
+ return planeRawResult(data, apiErr, "列出便签")
|
|
|
}
|
|
}
|