Commit ec824f1
authored
feat: add collection write tools (folders, ratings, custom fields) (#9)
* feat: add collection write tools (folders, ratings, custom fields)
Add 11 new MCP tools for modifying Discogs collections:
Folder management:
- list_folders, create_folder, edit_folder, delete_folder
Collection items:
- add_to_collection, remove_from_collection, move_release
Ratings:
- rate_release
Custom fields:
- list_custom_fields, edit_custom_field
All write operations invalidate the user's collection cache to
ensure subsequent reads reflect the changes. Custom field edits
skip cache invalidation since they don't affect collection structure.
Client layer (discogs.ts): 9 new API methods wrapping Discogs v2
endpoints with OAuth 1.0a auth, throttling, and retry.
Cached layer (cachedDiscogs.ts): Pass-through wrappers that call
invalidateUserCache() after mutations.
Tools layer (authenticated.ts): 11 new server.tool() registrations
following existing patterns (auth guard, Zod validation, consistent
response format).
* chore: update package-lock.json
* test: add tests for collection write tools and fix tool count assertion
Add unit tests for new DiscogsClient write methods (folders, ratings,
custom fields) and CachedDiscogsClient cache invalidation behavior.
Fix hardcoded tool count in integration test (8 → 18).
* feat: add create_custom_field tool
Adds createCustomField() to DiscogsClient and CachedDiscogsClient (with
cache invalidation), registers the create_custom_field MCP tool, and
adds full test coverage — success, body shape, cache invalidation, and
429 rate limit tests. Bumps wrangler to ^4.76.0.
* Revert "feat: add create_custom_field tool"
This reverts commit c893031.1 parent bda8748 commit ec824f1
7 files changed
Lines changed: 1579 additions & 7 deletions
File tree
- src
- clients
- mcp/tools
- test
- clients
- integration
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
429 | 431 | | |
430 | 432 | | |
431 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
432 | 556 | | |
433 | 557 | | |
434 | 558 | | |
| |||
0 commit comments