Skip to content

MCP tools crash on routes that reply with an empty body #8701

Closed

Description

@cstns

formatResponse in forge/ee/lib/mcp/toolLoader.js:26 calls response.json() on every reply. When a route answers success with an empty body, that throws, and the agent gets "An error occurred performing a platform automation request: Unexpected end of JSON input" for a call that actually worked.

Seen live with platform_upload_instance_file: the file lands in the instance, but the agent is told it failed. The upload route ends with a bare reply.send() (forge/ee/routes/staticAssets/index.js:255).

From reading the code, the same thing should happen with:

The new delete tools for instance files and http tokens work around it with an emptySuccessAsOkay helper (#8692), but it might be simpler to have formatResponse treat an empty success body as { status: "okay" } and drop the per-tool workaround.

Metadata

Metadata

Assignees

Labels

area:aiAI relatedtype:bugSomething isn't working

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions