Skip to content

fix: strip MCP-only params from bulk_edit delete request to Paperless#100

Merged
baruchiro merged 2 commits into
mainfrom
claude/tender-wozniak-L8WLR
May 18, 2026
Merged

fix: strip MCP-only params from bulk_edit delete request to Paperless#100
baruchiro merged 2 commits into
mainfrom
claude/tender-wozniak-L8WLR

Conversation

@baruchiro
Copy link
Copy Markdown
Owner

Closes #91

Summary

  • When method: "delete", Paperless's delete() action accepts no extra kwargs. The MCP wrapper was forwarding confirm (and potentially delete_originals) in the parameters object, causing a 400 Bad Request from Paperless.
  • confirm is an MCP-side safety guardrail and was already being stripped by destructuring on the handler line; however delete_originals was still included in the spread ...parameters.
  • Fix: for the delete method, pass an empty parameters: {} object to the Paperless API instead of the user-supplied parameter spread.

Test plan

  • Run existing test suite — all 10 tests pass
  • Manually call bulk_edit_documents with method: "delete" and confirm: true — should succeed (no parameters forwarded)
  • Call with method: "delete", confirm: true, and delete_originals: true — should no longer 400
  • Call with a non-delete method (e.g. add_tag) — parameters still forwarded correctly

Generated by Claude Code

When method is "delete", the Paperless bulk-edit endpoint's delete()
action accepts no extra kwargs. Forwarding confirm or delete_originals
in the parameters object caused a 400 from Paperless. Now an empty
parameters object is sent for the delete method.

Closes #91
https://claude.ai/code/session_018wRYWcNE4fmxKQ4qrSHaFX
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 18, 2026

🦋 Changeset detected

Latest commit: e32afbe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@baruchiro/paperless-mcp Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Warning

Rate limit exceeded

@baruchiro has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 75b26b58-8775-47e4-a781-eb9bc204f3be

📥 Commits

Reviewing files that changed from the base of the PR and between 04f29b5 and e32afbe.

📒 Files selected for processing (2)
  • .changeset/fix-bulk-delete-parameters.md
  • src/tools/documents.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/tender-wozniak-L8WLR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@baruchiro baruchiro merged commit 1c1ec60 into main May 18, 2026
3 checks passed
@baruchiro baruchiro deleted the claude/tender-wozniak-L8WLR branch May 18, 2026 05:52
baruchiro added a commit that referenced this pull request May 24, 2026
Closes #101

## Summary

- **`docker-compose.e2e.yml`** — Paperless-ngx 2.14 + Redis fixture
stack with auto-created admin user
- **`e2e/e2e.test.ts`** — Deterministic `tools/call` tests (no LLM)
using Node's native `node:test` covering all tools from the issue:
`list_tags`, `create_tag`, `list_correspondents`,
`create_correspondent`, `list_document_types`, `create_document_type`,
`list_documents`, `get_document`, `search_documents`,
`download_document` (regression for #87), `get_document_thumbnail`,
`bulk_edit_documents` (regression for #100, #89), `post_document`
- **`e2e/client.ts`** — SDK `StreamableHTTPClientTransport` factory
- **`e2e/paperless.ts`** — Direct Paperless REST client for seeding test
data in `before()` hooks
- **`.github/workflows/e2e.yml`** — Matrix job (CLI + Docker) triggered
on every PR and push to `main`
- **`README.md`** — Testing section with unit and E2E run instructions
- **`package.json`** — `npm run test:e2e` script

## Test plan

- [ ] Verify CI passes on this PR (E2E matrix job: cli + docker)
- [ ] Check that `list_tags` finds the seeded tag
- [ ] Check that `download_document` returns a `paperless://` URI
(regression #87)
- [ ] Check that `bulk_edit_documents` modify_tags round-trip works
(regression #100)
- [ ] Confirm Docker image job also passes (builds image then runs same
test file)
- [ ] Review README Testing section renders correctly

https://claude.ai/code/session_01LActHt6HMhygRppaphFRzQ

---
_Generated by [Claude
Code](https://claude.ai/code/session_01LActHt6HMhygRppaphFRzQ)_

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Tests**
* Added a comprehensive E2E test suite that runs locally and in CI
against a real Paperless-ngx instance, exercising
tag/correspondent/document-type management, document operations
(list/get/search/download/thumbnail), bulk tag edits, and uploads.

* **Documentation**
* Added a “Testing” section with prerequisites and instructions for
running unit and E2E tests and cleanup steps.

* **Chores**
* Added CI workflow, Docker Compose for E2E, and an npm script to run
E2E tests; excluded E2E from regular TypeScript compilation.

* **Bug Fixes**
* Bulk-edit behavior now initializes tag fields by default for
tag-modify operations to ensure robust payloads.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/baruchiro/paperless-mcp/pull/104?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

bulk_edit_documents with method=delete fails with 400 — confirm` parameter passed through to Paperless API

2 participants