Skip to content

refactor: Update MCP tools to return human-readable text#22

Open
neptaco wants to merge 1 commit intomainfrom
feature/mcp-tools-text-output
Open

refactor: Update MCP tools to return human-readable text#22
neptaco wants to merge 1 commit intomainfrom
feature/mcp-tools-text-output

Conversation

@neptaco
Copy link
Owner

@neptaco neptaco commented Feb 4, 2026

Summary

  • Changed all MCP tool responses from structured JSON to formatted text output for improved readability in LLM interactions
  • Updated grep tool to display search results with contextual log lines in a readable format
  • Modified logs, ps, status, start, restart, and stop tools to use human-friendly text formatting
  • All tools now consistently use MCP content blocks with type "text"

Changes by Tool

grep

  • Replaced structured JSON matches with formatted text output
  • Shows context before/after matched lines with clear visual indicators (<<< MATCH)
  • Displays line numbers, timestamps, and content in a readable format

logs

  • Changed from JSON array to formatted text with clear headers
  • Added empty state handling with user-friendly message

ps

  • Transformed process list from JSON objects to formatted text sections
  • Separated processes with visual dividers
  • Conditionally displays optional fields (PID, ports, start time)

status

  • Converted detailed status information to readable text format
  • Organized information hierarchically with clear labels
  • Includes recent logs preview when available

start/restart

  • Updated to show process information in formatted text
  • Displays log context and matched lines in readable format
  • Shows success indicators with checkmarks (✓)
  • Improved timeout and failure messaging

stop

  • Simplified output to show operation status and message

Test plan

  • Test each MCP tool through the MCP interface
  • Verify output formatting is consistent and readable
  • Confirm all edge cases (no matches, no processes, failures) display appropriate messages
  • Validate ANSI code stripping works correctly in log outputs

🤖 Generated with Claude Code

Changed all MCP tool responses from structured JSON to formatted text
for better readability in LLM interactions. This includes:

- grep: Display matches with contextual log lines in readable format
- logs: Show process logs as formatted text with headers
- ps: List processes with clear formatting and section separators
- restart/start: Display process status and logs in structured text
- status: Show comprehensive process information in readable format
- stop: Present stop operation results as formatted text

All tools now use MCP content blocks with type "text" for consistent
output formatting across the toolset.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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