Skip to content

Return content array so tools like claude code can provide nice formatting of output #273

@machow

Description

@machow

Describe the bug

Currently, tool calls for services like gmail often return a response of form:

{ "result": "Retrieved X messages ... <long string>" }

However, I think things like claude code often expect, and can nicely format messages when they're this format:

{
  "result":  {
    "content": [ {"type": "text", "text": "Retrieved X messages ..."}, ...]
  }
}

For example, here is the mcp tool execution result example in the mcp docs.

I noticed that tools like https://github.com/GongRzhe/Gmail-MCP-Server use this content array format, and the outputs are nicely displayed. I'm loving using google_workspace_mcp but it's a bit tougher to glance at the results in claude code. WDYT of returning something like a content array?

In any event, thanks so much for this great tool!

To Reproduce

Run a gmail tool call in claude code (e.g. search_gmail_messages).

Expected behavior

The entries are cleanly separated with a blank line between them. Currently, I see something like this...

Image

In Gmail-MCP-Server it looks like this

Image

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