Skip to content

Conversation

@kevinswint
Copy link

@kevinswint kevinswint commented Jan 2, 2026

Summary

Adds a new MCP tool that captures output from Roblox Studio's Output window during both Edit and Play modes. This enables Claude to see print statements, warnings, and errors, significantly improving debugging workflows.

Features

  • ✅ Captures all output via LogService.MessageOut
  • ✅ Filters by message level (all, print, warn, error)
  • ✅ Configurable max_lines parameter (default: 1000)
  • ✅ Optional buffer clearing with clear_after_read parameter (default: true)
  • ✅ 10,000-line FIFO buffer prevents memory issues
  • ✅ Silent buffering prevents feedback loops
  • ✅ Survives Play mode transitions

Implementation

  • New OutputCapture.luau module: Persistent LogService connection with silent buffering
  • New ReadOutput.luau tool handler: Follows existing tool patterns
  • Updated Types.luau: Added ReadOutputArgs type definition
  • Updated Main.server.luau: Initializes OutputCapture at plugin startup
  • Updated rbx_studio_server.rs: Added Rust MCP tool definition

Testing

All functionality has been thoroughly tested:

  • Basic capture (print/warn/error messages)
  • Feedback loop prevention (rapid reads don't cause growth)
  • Filter parameter (correctly isolates message types)
  • Buffer parameters (max_lines limiting, clear_after_read behavior)
  • Play mode capture (output persists across mode transitions)
  • FIFO buffer eviction (correctly caps at 10,000 with oldest removed)

Updates

  • Added thread-safety documentation
  • Added plugin unload handling to prevent memory leaks
  • Extracted magic numbers to named constants
  • Added dropped message counter and warnings
  • Added getStats() for buffer monitoring
  • Improved filter validation error messages
  • Enhanced Rust tool descriptions

Example Usage

-- Generate output
print("Debug message")
warn("Warning message")

Then call read_output tool:
[Captured 2 messages (filter: all, cleared: true)]

[OUTPUT] Debug message
[WARNING] Warning message

Kevin Swint and others added 2 commits January 2, 2026 07:48
Adds a new MCP tool that captures output from Roblox Studio's Output window
during both Edit and Play modes. This enables Claude to see print statements,
warnings, and errors for better debugging workflows.

Features:
- Captures all output via LogService.MessageOut
- Filters by message level (all/print/warn/error)
- Configurable max_lines parameter (default: 1000)
- Optional buffer clearing with clear_after_read parameter
- 10,000-line FIFO buffer prevents memory issues
- Silent buffering prevents feedback loops

Implementation:
- New OutputCapture.luau module for persistent LogService connection
- New ReadOutput.luau tool handler following existing patterns
- Updates to Types.luau and Main.server.luau for integration
- Rust MCP tool definition in rbx_studio_server.rs
- Add thread-safety documentation explaining Luau's single-threaded model
- Add plugin.Unloading handler to properly disconnect LogService connection
- Extract magic numbers to named constants (MAX_BUFFER_SIZE, DEFAULT_MAX_LINES)
- Track dropped message count for backpressure visibility
- Add getStats() method for buffer health monitoring
- Improve filter validation with clearer error messages showing valid options
- Include dropped message warnings in read_output responses
- Document timestamp format (os.clock() for relative timing)
- Enhance Rust tool descriptions with usage hints

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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