openclaw - ✅(Solved) Fix [Bug]: messages_read and conversations_list MCP tools return count only — data hidden in structuredContent [2 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#77024Fetched 2026-05-04 04:59:21
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
2
Author
Timeline (top)
commented ×2cross-referenced ×2labeled ×2closed ×1

Version: OpenClaw 2026.5.2 (8b2a6e5)

Description: The messages_read and conversations_list MCP tools return actual data inside structuredContent instead of the primary tool response content. MCP clients (including Claude.ai) only read the primary content field, making the actual message objects invisible.

Current return shape in mcp-cli-Du6woLyX.js:

return { ...summarizeResult("messages", messages.length), structuredContent: { messages } };

Expected: Full message objects returned in primary content field.

Impact: MCP clients cannot read conversation history or list sessions programmatically. Breaks any autonomous agent loop that relies on Claude reading Rivet responses via MCP.

Workaround: None without modifying minified dist.

Root Cause

Version: OpenClaw 2026.5.2 (8b2a6e5)

Description: The messages_read and conversations_list MCP tools return actual data inside structuredContent instead of the primary tool response content. MCP clients (including Claude.ai) only read the primary content field, making the actual message objects invisible.

Current return shape in mcp-cli-Du6woLyX.js:

return { ...summarizeResult("messages", messages.length), structuredContent: { messages } };

Expected: Full message objects returned in primary content field.

Impact: MCP clients cannot read conversation history or list sessions programmatically. Breaks any autonomous agent loop that relies on Claude reading Rivet responses via MCP.

Workaround: None without modifying minified dist.

Fix Action

Fix / Workaround

Workaround: None without modifying minified dist.

PR fix notes

PR #17: fix(mcp): include full data in conversations_list and messages_read content field

Description (problem / solution / changelog)

What and why

conversations_list and messages_read were returning actual data only in structuredContent, with the primary content field containing just a count summary ("conversations: 5", "messages: 3"). MCP clients including Claude.ai only read the primary content field and cannot access structuredContent, so the real data was invisible to them.

Root cause: both tools spread summarizeResult(label, count) which produces content: [{type: "text", text: "label: N"}], then appended structuredContent: {data}. Clients that don't support structuredContent see only the count.

Fix

Replace the summarizeResult spread with a content entry that serializes the full data as JSON, keeping structuredContent in place for clients that do support it. Two-line change in channel-tools.ts.

  • conversations_list: content now contains the full conversations array as JSON
  • messages_read: content now contains the full messages array as JSON

Other tools (attachments_fetch, events_poll, permissions_list_open) follow the same pattern but are not reported as broken - left for a separate PR to keep this minimal.

Testing

  • Added two regression tests in channel-server.test.ts that call both tools via mcp.client.callTool(), parse content[0].text as JSON, and assert the data is present
  • Both tests use attachReadyGateway with a mock gateway request fn so no live gateway is needed

Fixes #77024


Generated by Claude Code

<!-- devin-review-badge-begin -->
<a href="https://app.devin.ai/review/suboss87/openclaw/pull/17" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open in Devin Review"> </picture> </a> <!-- devin-review-badge-end -->

Changed files

  • src/mcp/channel-server.test.ts (modified, +48/-0)
  • src/mcp/channel-tools.ts (modified, +2/-2)

PR #77041: [AI-assisted] fix(mcp): return tool data in primary content field (#77024)

Description (problem / solution / changelog)

Summary

Fixes #77024

The MCP channel tools (conversations_list, messages_read, attachments_fetch, events_poll, permissions_list_open) were returning actual data exclusively in structuredContent, which MCP clients (including Claude.ai) cannot read. Only the primary content field is consumed by MCP clients, so they saw only a count like "messages: 5" with no actual data.

Root Cause

summarizeResult() in src/mcp/channel-shared.ts produced only a count summary string in the content field. The real data was placed in a structuredContent property that is not part of the MCP tool response specification consumed by clients.

Changes

  • src/mcp/channel-shared.ts: Added an optional data parameter to summarizeResult(). When provided, the data is JSON-serialized and appended to the content text after the count summary line.
  • src/mcp/channel-tools.ts: Updated all 5 call sites (conversations_list, messages_read, attachments_fetch, events_poll, permissions_list_open) to pass their data arrays to summarizeResult().
  • structuredContent is preserved unchanged for backward compatibility with any clients that do read it.

Regression Test Plan

  • Added src/mcp/channel-shared-summarize.test.ts with 4 tests covering: count-only (no data), data serialization, empty array, and undefined data.
  • All existing tests pass (4/4 passed).

Security Impact

None. This change only affects the text representation of data that was already being returned in structuredContent. No new data is exposed.

Changed files

  • src/mcp/channel-shared-summarize.test.ts (added, +29/-0)
  • src/mcp/channel-shared.ts (modified, +4/-1)
  • src/mcp/channel-tools.ts (modified, +5/-5)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

Yes

Summary

Version: OpenClaw 2026.5.2 (8b2a6e5)

Description: The messages_read and conversations_list MCP tools return actual data inside structuredContent instead of the primary tool response content. MCP clients (including Claude.ai) only read the primary content field, making the actual message objects invisible.

Current return shape in mcp-cli-Du6woLyX.js:

return { ...summarizeResult("messages", messages.length), structuredContent: { messages } };

Expected: Full message objects returned in primary content field.

Impact: MCP clients cannot read conversation history or list sessions programmatically. Breaks any autonomous agent loop that relies on Claude reading Rivet responses via MCP.

Workaround: None without modifying minified dist.

Steps to reproduce

  1. Connect Claude.ai to OpenClaw via MCP (supergateway + Tailscale Funnel)
  2. Call messages_read tool with a valid session_key
  3. Observe tool response in Claude

Expected behavior

Full message objects returned in primary content field — array of messages with id, role, content, timestamp

Actual behavior

Returns "messages: 5" (count only). Actual data is in structuredContent which MCP clients cannot access.

OpenClaw version

2026.5.2 (8b2a6e5)

Operating system

Ubuntu Linux (Hyper-V VM on Windows 11)

Install method

No response

Model

claude-haiku-4-5-20251001

Provider / routing chain

Claude.ai → Tailscale Funnel → supergateway → OpenClaw MCP server

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

Modify the mcp-cli-Du6woLyX.js file to return full message objects in the primary content field instead of the structuredContent field.

Guidance

  • Identify the return statement in mcp-cli-Du6woLyX.js and modify it to return the messages object directly in the primary content field.
  • Verify that the modified return statement is correctly returning the full message objects by checking the response in Claude.ai.
  • Test the modified code with different inputs to ensure it works as expected and does not break any other functionality.
  • Consider creating a temporary workaround by modifying the MCP client to access the structuredContent field, but this may require significant changes to the client code.

Example

return {
  messages: messages
};

Instead of:

return {
  ...summarizeResult("messages", messages.length),
  structuredContent: { messages }
};

Notes

The provided solution assumes that the messages object is already correctly populated with the required data. If this is not the case, additional modifications may be needed to ensure the correct data is being returned.

Recommendation

Apply workaround: Modify the mcp-cli-Du6woLyX.js file to return full message objects in the primary content field, as this is the most direct way to resolve the issue without waiting for a new version of OpenClaw.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Full message objects returned in primary content field — array of messages with id, role, content, timestamp

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: messages_read and conversations_list MCP tools return count only — data hidden in structuredContent [2 pull requests, 2 comments, 3 participants]