Skip to content

update_document returns full OCR content although it only updates metadata #8

Description

@afalter

Hi,

first of all, thank you for creating and maintaining this MCP server. It has been working really well for my Paperless-ngx setup and is very useful when using an AI agent with Paperless.

I noticed a small issue with the response of update_document that might be worth considering.

As far as I can see, update_document currently only accepts metadata fields such as title, correspondent, document type, tags, etc. It does not allow updating the document's content field.

However, after performing the PATCH request, the complete document returned by the Paperless API is passed back to the MCP client, including the full OCR content.

For example, if an AI agent only wants to change a document's title, the tool response may still contain the entire OCR text of the document. With large documents, this can result in a surprisingly large MCP response and unnecessarily consume context/tokens in the AI agent.

I noticed that list_documents and search_documents already use a summarized representation without the OCR content, so I was wondering if it would make sense to do something similar for update_document.

For example, the response could contain the updated metadata:

{
"id": 123,
"title": "Updated title",
"correspondent": 5,
"document_type": 2,
"tags": [3, 7]
}

while leaving the full OCR content available through get_document / get_document_content when it is explicitly requested.

Alternatively, if there is a reason why the full document response is intentional, perhaps an option to suppress content in the update_document response could be useful.

I'm mainly interested in avoiding unnecessary OCR data being passed back into the context of an AI agent when only document metadata was changed.

Thanks a lot for your help, and sorry if I misunderstood the code somewhere.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions