Skip to content

feat(toggl): add project CRUD tools - #60

Open
jack-arturo wants to merge 6 commits into
feat/time-entry-task-tools-refreshfrom
feat/project-crud-refresh
Open

feat(toggl): add project CRUD tools#60
jack-arturo wants to merge 6 commits into
feat/time-entry-task-tools-refreshfrom
feat/project-crud-refresh

Conversation

@jack-arturo

Copy link
Copy Markdown
Member

Summary

  • Refreshes/supersedes feat: add project CRUD tools #39 as a maintainer branch with Madison Rickert co-author attribution preserved in the cherry-picked commits.
  • Adds toggl_create_project, toggl_update_project, and toggl_delete_project MCP tools.
  • Reuses the shared write behavior from feat(toggl): add time entry task tools #58 instead of duplicating the successful-empty-body fix.
  • Invalidates workspace project cache entries after successful project writes.
  • Keeps direct project lookup optimization, but preserves non-404 Toggl errors during workspace fallback.
  • Adds server.json, cache, API, and MCP handler coverage for the new public tool surface.

Verification

  • npm run build
  • npm test
  • npm run test:coverage
  • npm run lint (passes with existing no-explicit-any warnings)
  • npm audit --audit-level=high (passes threshold; existing moderate brace-expansion advisory remains)
  • read-only review subagent pass after fixing the fallback error propagation issue

Related

madisonrickert and others added 6 commits June 4, 2026 03:05
getProject now accepts an optional workspace_id and uses the direct
GET /workspaces/{wid}/projects/{pid} endpoint, avoiding the workspace
fan-out fallback when the caller already knows the workspace. The
workspace-loop fallback remains for callers that pass only a project ID.

getProjects gains an optional active filter ('true' | 'false' | 'both')
mapping to Toggl's ?active query param.

Both improvements lifted from 84emllc/mcp-toggl@eef1bea.

Co-Authored-By: Andrew Miller <andrew@84em.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds createProject, updateProject, and deleteProject methods plus the
backing CreateProjectRequest, UpdateProjectRequest, and ProjectDeleteMode
type definitions. Defaults active=true and is_private=false on creation
to match Toggl's documented defaults. deleteProject accepts an optional
teDeletionMode controlling whether existing time entries are deleted or
unassigned.

Create/update lifted from 84emllc/mcp-toggl@eef1bea; delete is added on
top to round out the CRUD surface.

Co-Authored-By: Andrew Miller <andrew@84em.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds invalidateWorkspaceProjects so callers can drop the cached project
list and per-project entries for a workspace after a write. Mirrors
invalidateWorkspaceTags from the tag CRUD work in PR #37.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds toggl_create_project, toggl_update_project, and toggl_delete_project
tool definitions and handlers. Each handler resolves the workspace, calls
the matching TogglAPI method, and invalidates cached projects for the
workspace so subsequent toggl_list_projects reflects the change.

toggl_delete_project surfaces Toggl's optional teDeletionMode query
parameter as 'time_entry_deletion_mode' so callers can choose between
deleting the project's time entries or detaching them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 4, 2026 01:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds full project write support (create/update/delete) to the Toggl MCP server, extending the existing cached read surface with validated write handlers and cache invalidation so project listings reflect writes immediately.

Changes:

  • Added toggl_create_project, toggl_update_project, and toggl_delete_project MCP tools with argument validation and write-oriented annotations.
  • Extended TogglAPI with project CRUD methods and improved getProject lookup (direct workspace endpoint when workspaceId is known; workspace-fallback otherwise).
  • Implemented and tested workspace-scoped project cache invalidation after successful project writes; updated docs and server manifest.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/toggl-api.test.ts Adds API-level coverage for project CRUD, direct lookup, fallback behavior, and no-retry write semantics.
tests/mcp-server.test.ts Validates new tool schemas and end-to-end handler behavior (success + INVALID_ARGUMENT paths) for project tools.
tests/cache-manager.test.ts Adds coverage ensuring workspace project invalidation clears the right cache entries and forces refetch.
src/types.ts Introduces request/enum types for project create/update/delete inputs.
src/toggl-api.ts Implements project CRUD methods, active filter option for getProjects, and improved getProject lookup behavior.
src/index.ts Exposes new MCP tools + handlers, validates inputs, and invalidates project cache after writes.
src/cache-manager.ts Adds invalidateWorkspaceProjects() to clear per-workspace collections and per-project entries for that workspace.
server.json Registers the new public tool names/descriptions in the server manifest.
README.md Documents the new Project Management tools and their key parameters/semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants