How to disable every MCP Tool Http Request result getting wrapped in an array?

Describe the problem/error/question

In an MCP Server workflow, I have many HTTP tools for requesting different resources. As according to REST, there are tools for getting a single resource by id (/res/1), or many resources (/res). But, for some unknown and really, really, really frustrating reason, the single resource call result gets wrapped in an array no matter what. So it goes against well-established web standards, and both the single resource and many resources calls result in an array of objects. So now, for each of the many tools, I have to specify in the description to be careful because this endpoint, unexpectedly, returns an array, even though it is a request by id. It would be fine, even if weird, if the array would get wrapped into another array, and then the result is consistently in the first element, with the correct type.

The API DOES return in the correct data type for both endpoints, there are no problems there.

Share the output returned by the last node

I wanted to copy it, but the copy button in the JSON view seems to copy an empty array, even though, in the UI, there is definitelly a lot of content inside that array. So I will include some mock data.

Get Clients (HTTP Request MCP Tool Node)

[
  {
    "response": [
      {
        "id": 1,
        "name": "Acme Corp"
      },
      {
        "id": 2,
        "name": "Test Comp"
      }
    ]
  }
]

Get Client - ID 1 (HTTP Request MCP Tool Node)

[
  {
    "response": [
      {
        "id": 1,
        "name": "Acme Corp"
      }
    ]
  }
]

Information on your n8n setup

  • n8n version: 1.115.3
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Docker
1 Like

I think you have a valid point here. Although in n8n I think it makes sense that the data is wrapped in an array, because that’s a design pattern commonly used when nodes interact with each other.

But it seems strange, that the same “internal” format is returned by the MCP server when a tool is called from an AI agent.

Agreed makes it not compatible with external clients as they expect a single item.