-
Notifications
You must be signed in to change notification settings - Fork 1
feat(core): Add Todos Management Tools #4
Description
Summary
Add todo management tools to the core entity for managing GitLab user todos (task reminders).
Motivation
GitLab todos are action items that appear when users are:
- Mentioned in issues/MRs
- Assigned to issues/MRs
- Set as reviewers
- Have items requiring attention
AI agents benefit from todo management to:
- Prioritize work by listing pending todos
- Clear completed items
- Track what needs attention
- Automate todo triage workflows
Design Considerations
Tool Consolidation Strategy
Due to MCP client tool limits, todos should use minimal tool count:
| Tool | Operations | Description |
|---|---|---|
list_todos |
LIST, FILTER | List todos with state/action/type filters |
manage_todos |
MARK_DONE, MARK_ALL_DONE, RESTORE | Bulk todo management via action parameter |
Total: 2 tools
Placement
Add to existing core entity (user-related functionality) rather than new entity.
API Reference
GitLab REST API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/todos |
GET | List current user's todos |
/todos/:id/mark_as_done |
POST | Mark single todo as done |
/todos/mark_all_as_done |
POST | Mark all todos as done |
/todos/:id/mark_as_pending |
POST | Restore a todo (undo mark as done) |
Tool Schemas
list_todos
```typescript
{
state?: "pending" | "done", // Filter by state
action?: "assigned" | "mentioned" | "build_failed" | "marked" |
"approval_required" | "unmergeable" | "directly_addressed" |
"merge_train_removed" | "review_requested" | "member_access_requested" |
"review_submitted",
type?: "Issue" | "MergeRequest" | "Commit" | "Epic" | "DesignManagement::Design" |
"AlertManagement::Alert",
project_id?: number, // Filter by project
group_id?: number, // Filter by group
author_id?: number, // Filter by author
per_page?: number, // Pagination (max 100)
page?: number
}
```
manage_todos
```typescript
{
action: "mark_done" | "mark_all_done" | "restore", // Required
id?: number // Required for mark_done/restore
}
```
Implementation Tasks
- Add Zod schemas to
src/entities/core/schema.ts - Add read-only schemas to
src/entities/core/schema-readonly.ts - Implement
list_todoshandler insrc/entities/core/index.ts - Implement
manage_todoshandler with action dispatch - Register tools in
src/entities/core/registry.ts - Export read-only tool names (
list_todos,manage_todoswith restore only) - Add unit tests for schemas
- Add integration tests
Read-Only Mode Support
In GITLAB_READ_ONLY_MODE:
list_todos- allowedmanage_todoswithaction: "restore"- blocked (modifies state)manage_todoswithaction: "mark_done" | "mark_all_done"- blocked
Note: All manage_todos actions modify state, so entire tool blocked in read-only mode.
Response Format
```typescript
interface Todo {
id: number;
project: { id: number; name: string; path_with_namespace: string };
author: { id: number; username: string; name: string };
action_name: string;
target_type: string;
target: { iid: number; title: string; state: string };
target_url: string;
body: string;
state: "pending" | "done";
created_at: string;
updated_at: string;
}
```
Testing Requirements
- Unit tests for Zod schemas
- Integration tests for listing with various filters
- Test mark_done and mark_all_done operations
- Verify pagination works correctly
- Test state transitions
Acceptance Criteria
-
list_todossupports all documented filters -
manage_todoshandles all three actions - Proper error handling for invalid todo IDs
- Read-only mode blocks all manage operations
- Tool descriptions are agent-friendly
- Total new tools: exactly 2