modelcontextprotocol / modelcontextprotocol/inspector
Same JSON-body pretty-print logic is duplicated verbatim in four places
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.9k
- Forks
- 1.5k
- Avg merge
- 6h 17m
- Merged PRs (30d)
- 151
Description
Which version line?
v2 — current (@modelcontextprotocol/inspector@latest)
Which client?
TUI
Inspector version
2.7.0 (git tag) — static code-review finding, not run locally
Node version
N/A — static code review, no live run performed
Operating system (and browser, for the web client)
N/A — static code review
Transport
Not applicable / never connected
MCP server under inspection
N/A — this is a static code-review finding against the 2.7.0 tag source (clients/tui/src/App.tsx, clients/tui/src/components/RequestsTab.tsx), not a live reproduction against a running MCP server.
Steps to reproduce
Found via static review of the 2.7.0 tag source, not a live run.
- The JSON body pretty-print logic (splitting a stringified tool-call result into lines for Ink rendering) appears verbatim in four places:
App.tsx(x2) andRequestsTab.tsx(x2). - Beyond the size-cap gap tracked separately (#2407), any future fix (syntax highlighting, a max-line count, wrap behavior) has to be applied by hand in all four places, and it is easy to miss one.
I have not modified one copy to watch the others diverge live; flagging the duplication itself as the maintenance risk, and as a likely source of a future "why does this tab render bodies differently" report.
Expected behavior
The JSON body pretty-print logic lives in one shared helper that all four call sites use, so a future fix (size cap, syntax highlighting, wrap behavior) is applied once.
Actual behavior
The same pretty-print logic is copy-pasted across App.tsx (x2) and RequestsTab.tsx (x2).
Suggested fix: extract a shared formatting helper used by all four sites, ideally alongside the related size-cap fix (#2407).
Logs, errors, or screenshots
No response
Already prototyped a fix?
No response
Before you submit
- I searched existing issues and this is not a duplicate.
- This is not a security vulnerability report (those go through the private advisory process).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the four duplicated JSON body formatting call sites in clients/tui/src/App.tsx and clients/tui/src/components/RequestsTab.tsx, alongside the related size-cap issue #2407. Extract the shared formatting helper and update all four sites to use it; done means the logic has one implementation while preserving the existing TUI rendering behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100