Skip to content

feat: render MCP tool response markdown in chat#1213

Open
sh1nj1 wants to merge 1 commit into
mainfrom
feat/mcp-markdown-response
Open

feat: render MCP tool response markdown in chat#1213
sh1nj1 wants to merge 1 commit into
mainfrom
feat/mcp-markdown-response

Conversation

@sh1nj1
Copy link
Copy Markdown
Owner

@sh1nj1 sh1nj1 commented Apr 16, 2026

Summary

  • MCP tool response JSON에 "markdown" 키가 있으면, action details 패널에서 raw JSON 대신 마크다운으로 렌더링
  • 기존 renderMarkdownInContainer 파이프라인을 재사용하여 syntax highlighting, mermaid, table 등 자동 지원
  • "markdown" 키가 없으면 기존 JSON pretty-print 동작 유지

Changes

  • comments_helper.rb: comment_action_markdown 헬퍼 추가 — JSON에서 markdown 키 추출
  • _comment.html.erb: markdown이 있으면 comment-content div로 렌더링, 없으면 기존 <pre> 유지

Test plan

  • Rubocop passed
  • All 806 files inspected, no offenses
  • Helper tests passed (42 runs, 0 failures)
  • Comments controller tests passed (46 runs, 0 failures)
  • Full test suite passed via pre-push hook

When an MCP tool response JSON contains a "markdown" key, render
its value as markdown in the action details panel instead of raw JSON.
Reuses the existing renderMarkdownInContainer pipeline via the
comment-content CSS class.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf5c1aac0c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +168 to +170
<% if action_md %>
<div class="comment-content comment-action-markdown"><%= action_md %></div>
<% else %>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve editable JSON source for markdown actions

When comment.action contains a markdown key, this branch removes the .comment-action-json element entirely, but the edit flow still depends on it: openActionEditor in comments/list_controller.js only opens the form when it can read container.querySelector('.comment-action-json') and populate the textarea from json.textContent. In pending-action comments (has_pending_action == true), clicking “edit action” becomes a no-op for markdown-backed actions, so users cannot modify the proposed action before approval.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant