(_ context.Context, _ *gomcp.CallToolRequest, input GetInput)
| 51 | } |
| 52 | |
| 53 | func handleGet(_ context.Context, _ *gomcp.CallToolRequest, input GetInput) (*gomcp.CallToolResult, any, error) { |
| 54 | if input.TaskID == "" { |
| 55 | return nil, nil, fmt.Errorf("task_id is required") |
| 56 | } |
| 57 | |
| 58 | taskDir := input.TaskDir |
| 59 | if taskDir == "" { |
| 60 | taskDir = "." |
| 61 | } |
| 62 | |
| 63 | taskScanner := scanner.NewScanner(taskDir, false, nil) |
| 64 | result, err := taskScanner.Scan() |
| 65 | if err != nil { |
| 66 | return nil, nil, fmt.Errorf("scan failed: %w", err) |
| 67 | } |
| 68 | |
| 69 | task := findTaskByID(input.TaskID, result.Tasks) |
| 70 | if task == nil { |
| 71 | return nil, nil, fmt.Errorf("task not found: %s", input.TaskID) |
| 72 | } |
| 73 | |
| 74 | out := buildGetOutput(task, result.Tasks) |
| 75 | |
| 76 | data, err := json.Marshal(out) |
| 77 | if err != nil { |
| 78 | return nil, nil, fmt.Errorf("json marshal failed: %w", err) |
| 79 | } |
| 80 | |
| 81 | return &gomcp.CallToolResult{ |
| 82 | Content: []gomcp.Content{&gomcp.TextContent{Text: string(data)}}, |
| 83 | }, nil, nil |
| 84 | } |
| 85 | |
| 86 | func findTaskByID(id string, tasks []*model.Task) *model.Task { |
| 87 | for _, t := range tasks { |
nothing calls this directly
no test coverage detected