Skip to content

Conversation

@ARYPROGRAMMER
Copy link
Contributor

Summary

Implements Mermaid chart rendering in Goose's chat UI as requested in issue #4222. This adds support for rendering interactive Mermaid diagrams (flowcharts, sequence diagrams, Gantt charts, etc.) directly inline in conversations, eliminating the need to copy-paste to external tools.

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

Testing

  • Unit tests pass (cargo test -p goose-mcp test_render_mermaid)
  • Code compiles without warnings (cargo build --package goose-mcp)
  • Follows existing codebase patterns and conventions
  • Debug HTML generation works for development verification
  • MCP server integration tested

Related Issues

Relates to #4222
Discussion: #4222

Screenshots/Demos (for UX changes)

Before: Users had to copy-paste Mermaid code to external tools to visualize diagrams

After: Interactive Mermaid diagrams render directly inline in Goose's chat interface

Example diagram that will render:

graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
Loading

Changes

Core Implementation

  • Added render_mermaid tool to AutoVisualiser MCP server with proper MCP-UI integration
  • Created RenderMermaidParams struct for accepting Mermaid syntax as input
  • Built mermaid_template.html with Mermaid.js integration and responsive styling
  • Added mermaid.min.js (v10.9.0) to assets directory for client-side rendering

Documentation & Testing

  • Updated AutoVisualiser MCP documentation to include Mermaid diagrams in the visualization types table
  • Added test_render_mermaid unit test to verify tool functionality and MCP-UI resource generation
  • Updated tool descriptions in the AutoVisualiser instructions

Technical Details

The implementation follows the existing AutoVisualiser pattern:

  1. Accepts Mermaid syntax as string parameter via mermaid_code field
  2. Replaces placeholders in HTML template with code and JS library
  3. Returns base64-encoded HTML as MCP-UI resource for inline rendering
  4. Generates debug HTML file to /tmp/mermaid.html for development inspection

Files Changed

  • crates/goose-mcp/src/autovisualiser/mod.rs - Added tool implementation and tests
  • crates/goose-mcp/src/autovisualiser/templates/mermaid_template.html - New HTML template
  • crates/goose-mcp/src/autovisualiser/templates/assets/mermaid.min.js - Mermaid.js library
  • documentation/docs/mcp/autovisualiser-mcp.md - Updated documentation

Email: [email protected]

@ARYPROGRAMMER ARYPROGRAMMER requested a review from a team as a code owner October 25, 2025 19:25
@blackgirlbytes blackgirlbytes added the hacktoberfest Issues awarding points for Hacktoberfest 2025! label Oct 26, 2025
@blackgirlbytes
Copy link
Contributor

Hi @DOsinga , @alexhancock , @aharvard

This PR intends to add mermaid chart rendering via Autviz and MCP UI to goose. Flagging you all to review.

Thank you!

@blackgirlbytes blackgirlbytes added large Weight label for Hacktoberfest 2025 issues hacktoberfest-accepted labels Oct 26, 2025
@ARYPROGRAMMER
Copy link
Contributor Author

reminder to review, 1 test is failing as the github repo creds for api keys are not set. rest LGTM to me in recheck

@ARYPROGRAMMER
Copy link
Contributor Author

can this be completed today? @maintainers

@taniandjerry
Copy link
Contributor

Hi @ARYPROGRAMMER ! Thank you for waiting, the dev team will get to this as soon as they can!

Copy link
Collaborator

@alexhancock alexhancock left a comment

Choose a reason for hiding this comment

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

LGTM if it also does to @michaelneale

@alexhancock
Copy link
Collaborator

Test failures in https://github.com/block/goose/actions/runs/18807497526/job/53674602193?pr=5377 are likely unrelated

@michaelneale
Copy link
Collaborator

nice I like @ARYPROGRAMMER !

@alexhancock I just realised those failures are probably as forks don't have access to those secrets... need to think what systemic solution is for that (I think for forks we can skip that part of the job, keep it for branches)

@blackgirlbytes
Copy link
Contributor

i'm merging!

@blackgirlbytes blackgirlbytes merged commit 1156cbc into block:main Oct 27, 2025
13 of 14 checks passed
@alexhancock
Copy link
Collaborator

Nice! Thanks for this one, will be fun to use

michaelneale added a commit that referenced this pull request Oct 28, 2025
* main:
  Feat/add mermaid chart rendering (#5377)
  Set up Datadog metrics for prompt injection detection (#5385)
  fix: restore --resume functionality for most recent session (#5401)
  Gemini again (#5390)
  docs(prompt-library): add github-issue-labeler intermediate prompt (#5374)
  docs: add Linux and Windows paths to uninstall section (#5371)
  fix: --session-id shouldn't work without --resume, but --name should (#5360)
  Auto-compact Threshold UI improvements (#5354)
  Filter preserved user messages to be text only. (#5391)
  include sessionId in tool request (#5394)
  feat: add PR Impact Analyzer prompt (#5375)
  docs: add blog post on configuring goose for team environments (#5380)
  migrating back with new chatrecall non underscore name (#5223)
michaelneale added a commit that referenced this pull request Oct 29, 2025
* main: (30 commits)
  feat: add goose powered ai culinary innovation studio prompt to library (#5423)
  removing golang/temporal building
  testing tetrate with sonnet (#5428)
  Add Recipes Test Script (#5420)
  Don't die on strange chars (#5415)
  fix: allow subagent to run in parent --no-session mode (#5384)
  docs: analyze tool (#5418)
  fix: gracefully close goosed listening port (#5321)
  move history txt to state dir (#5410)
  Dont exit silently when storing api key fails (#5260)
  Make reply use the API (#5389)
  Fix/icon ii (#5413)
  Enable runtime access to provider name (#5399)
  fix: ensure trailing newline in files created by `text_editor` tool (#5336)
  docs: September 2025 Community All-Stars (#5411)
  make supports_cache_control async to avoid block in place (#5362)
  Send all the logs we output (#5363)
  Recipe variables (#5365)
  Feat/add mermaid chart rendering (#5377)
  Set up Datadog metrics for prompt injection detection (#5385)
  ...
katzdave added a commit that referenced this pull request Nov 3, 2025
* 'main' of github.com:block/goose: (132 commits)
  Fix/icon ii (#5413)
  Enable runtime access to provider name (#5399)
  fix: ensure trailing newline in files created by `text_editor` tool (#5336)
  docs: September 2025 Community All-Stars (#5411)
  make supports_cache_control async to avoid block in place (#5362)
  Send all the logs we output (#5363)
  Recipe variables (#5365)
  Feat/add mermaid chart rendering (#5377)
  Set up Datadog metrics for prompt injection detection (#5385)
  fix: restore --resume functionality for most recent session (#5401)
  Gemini again (#5390)
  docs(prompt-library): add github-issue-labeler intermediate prompt (#5374)
  docs: add Linux and Windows paths to uninstall section (#5371)
  fix: --session-id shouldn't work without --resume, but --name should (#5360)
  Auto-compact Threshold UI improvements (#5354)
  Filter preserved user messages to be text only. (#5391)
  include sessionId in tool request (#5394)
  feat: add PR Impact Analyzer prompt (#5375)
  docs: add blog post on configuring goose for team environments (#5380)
  migrating back with new chatrecall non underscore name (#5223)
  ...
BlairAllan pushed a commit to BlairAllan/goose that referenced this pull request Nov 29, 2025
Signed-off-by: Arya Pratap Singh <[email protected]>
Signed-off-by: Blair Allan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest Issues awarding points for Hacktoberfest 2025! hacktoberfest-accepted large Weight label for Hacktoberfest 2025 issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants