feat: json view component

This commit is contained in:
cgoing
2025-03-25 01:48:29 +09:00
parent 2890e036ed
commit f0b28d4760
5 changed files with 226 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
import { ServerNotification } from "@modelcontextprotocol/sdk/types.js";
import { Copy } from "lucide-react";
import { useState } from "react";
import JsonView from "./JsonView";
const HistoryAndNotifications = ({
requestHistory,
@@ -75,7 +76,7 @@ const HistoryAndNotifications = ({
</button>
</div>
<pre className="whitespace-pre-wrap break-words bg-background p-2 rounded">
{JSON.stringify(JSON.parse(request.request), null, 2)}
<JsonView data={request.request} />
</pre>
</div>
{request.response && (
@@ -92,11 +93,7 @@ const HistoryAndNotifications = ({
</button>
</div>
<pre className="whitespace-pre-wrap break-words bg-background p-2 rounded">
{JSON.stringify(
JSON.parse(request.response),
null,
2,
)}
<JsonView data={request.response} />
</pre>
</div>
)}
@@ -147,7 +144,9 @@ const HistoryAndNotifications = ({
</button>
</div>
<pre className="whitespace-pre-wrap break-words bg-background p-2 rounded">
{JSON.stringify(notification, null, 2)}
<JsonView
data={JSON.stringify(notification, null, 2)}
/>
</pre>
</div>
)}