Opened 43 hours ago

Closed 42 hours ago

#19211 closed defect (fixed)

REST server returns text/plain MIME type instead of application/json

Reported by: a.rohou@… Owned by: Eric Pettersen
Priority: moderate Milestone:
Component: Input/Output Version:
Keywords: Cc: Tom Goddard
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Alexis Rohou notes that the ChimeraX REST server is returing mime type data text/plain instead of application/json when JSON return values are requested. This may impair Claude AI from controlling ChimeraX using the REST server. Seems simple to fix if this really is incorrect.

Begin forwarded message:

From: Alexis Rohou
Subject: Re: Claude AI controlling ChimeraX
Date: October 21, 2025 at 10:46:28 PM PDT
To: Tom Goddard
Cc: Zach Pearson , chimerax-programmers

Hi Tom,

...

Incidentally, I think I may have found a bug along the way. The rest_server was returning content with a Content-Type fixed as "text/plain" regardless of whether json was true or false. This caused me grief on the MCP bridge side of things. The fix was to change line 292 of rest_server/src/server.py from:

self._header(200, "text/plain", len(data))

to:

content_type = "application/json" if self.server.chimerax_restserver.json else "text/plain"
self._header(200, content_type, len(data))

...

Cheers,
Alexis

Change History (2)

comment:1 by Eric Pettersen, 42 hours ago

Status: assignedaccepted

comment:2 by Eric Pettersen, 42 hours ago

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.