Skip to content

Commit d0ad677

Browse files
Update ToolsTab.tsx
Linting on originally approved commit
1 parent a87bd17 commit d0ad677

File tree

1 file changed

+2
-43
lines changed

1 file changed

+2
-43
lines changed

client/src/components/ToolsTab.tsx

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,13 @@ import { Textarea } from "@/components/ui/textarea";
77
import {
88
ListToolsResult,
99
Tool,
10-
TextContentSchema,
11-
ImageContentSchema,
12-
ResultSchema,
13-
EmbeddedResourceSchema,
10+
CallToolResultSchema,
1411
} from "@modelcontextprotocol/sdk/types.js";
1512
import { AlertCircle, Send } from "lucide-react";
1613
import { useEffect, useState } from "react";
1714
import ListPane from "./ListPane";
1815

1916
import { CompatibilityCallToolResult } from "@modelcontextprotocol/sdk/types.js";
20-
import { z } from "zod";
21-
22-
// Define the AudioContent schema
23-
export const AudioContentSchema = z
24-
.object({
25-
type: z.literal("audio"),
26-
data: z.string().base64(),
27-
mimeType: z.string(),
28-
})
29-
.passthrough();
30-
31-
// Extend the CallToolResult schema to include audio content
32-
export const ExtendedCallToolResultSchema = ResultSchema.extend({
33-
content: z.array(
34-
z.discriminatedUnion("type", [
35-
TextContentSchema,
36-
ImageContentSchema,
37-
AudioContentSchema,
38-
EmbeddedResourceSchema,
39-
]),
40-
),
41-
isError: z.boolean().default(false).optional(),
42-
});
43-
44-
// Export the types
45-
export type AudioContent = z.infer<typeof AudioContentSchema>;
46-
export type ExtendedCallToolResult = z.infer<
47-
typeof ExtendedCallToolResultSchema
48-
>;
4917

5018
const ToolsTab = ({
5119
tools,
@@ -77,7 +45,7 @@ const ToolsTab = ({
7745
if (!toolResult) return null;
7846

7947
if ("content" in toolResult) {
80-
const parsedResult = ExtendedCallToolResultSchema.safeParse(toolResult);
48+
const parsedResult = CallToolResultSchema.safeParse(toolResult);
8149
if (!parsedResult.success) {
8250
return (
8351
<>
@@ -119,15 +87,6 @@ const ToolsTab = ({
11987
className="max-w-full h-auto"
12088
/>
12189
)}
122-
{item.type === "audio" && (
123-
<audio
124-
controls
125-
src={`data:${item.mimeType};base64,${item.data}`}
126-
className="w-full"
127-
>
128-
<p>Your browser does not support audio playback</p>
129-
</audio>
130-
)}
13190
{item.type === "resource" &&
13291
(item.resource?.mimeType?.startsWith("audio/") ? (
13392
<audio

0 commit comments

Comments
 (0)