feat(toggl): add client CRUD tools - #61
Open
jack-arturo wants to merge 6 commits into
Open
Conversation
Adds createClient, updateClient, and deleteClient methods plus the backing CreateClientRequest and UpdateClientRequest types. Toggl's PUT endpoint requires name on every update, so UpdateClientRequest reflects that. Create lifted from 84emllc/mcp-toggl@eef1bea; update and delete are added on top to round out the CRUD surface. Toggl's archive/restore endpoints (premium-only) are intentionally out of scope for this PR. Co-Authored-By: Andrew Miller <andrew@84em.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds invalidateWorkspaceClients so callers can drop the cached client list and per-client 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_client, toggl_update_client, and toggl_delete_client tool definitions and handlers. Each handler resolves the workspace, calls the matching TogglAPI method, and invalidates cached clients for the workspace so subsequent toggl_list_clients reflects the change. toggl_update_client surfaces Toggl's name-required-on-PUT semantics in its schema and runtime guard so callers do not silently null-out the client's name. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class client CRUD support to the mcp-toggl server by extending the Toggl API wrapper, exposing new MCP tools, and ensuring cache consistency after writes. This refreshes prior work by reusing the existing single-attempt write request behavior and adds test coverage across API, server handlers, and cache invalidation.
Changes:
- Add
createClient,updateClient, anddeleteClienttoTogglAPI, plus request types for client writes. - Expose
toggl_create_client,toggl_update_client,toggl_delete_clientMCP tools with argument validation and workspace client cache invalidation. - Add/extend tests and documentation to cover the new tool surface and cache behavior.
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 tests for client POST/PUT/DELETE behavior and write retry semantics. |
| tests/mcp-server.test.ts | Extends mock API + handler tests to cover tool schemas, CRUD execution, and validation errors. |
| tests/cache-manager.test.ts | Adds coverage verifying workspace client cache invalidation behavior. |
| src/types.ts | Introduces CreateClientRequest / UpdateClientRequest types for client write payloads. |
| src/toggl-api.ts | Implements client CRUD methods using single-attempt write requests. |
| src/index.ts | Registers MCP client CRUD tools and implements handlers with input validation + cache invalidation. |
| src/cache-manager.ts | Adds invalidateWorkspaceClients to clear workspace collections and per-client entries for a workspace. |
| server.json | Publishes the new tool names in the server manifest. |
| README.md | Documents the new client management tools and usage expectations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fix: remove explicit any warnings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
toggl_create_client,toggl_update_client, andtoggl_delete_clientMCP tools.server.json, cache, API, and MCP handler coverage for the new public tool surface.Verification
npm run buildnpm testnpm run test:coveragenpm run lint(passes with existingno-explicit-anywarnings)npm audit --audit-level=high(passes threshold; existing moderatebrace-expansionadvisory remains)Related
feat/time-entry-task-tools-refresh