Skip to content

Commit a87bd17

Browse files
committed
❯ npx prettier --check .
Checking formatting... [warn] client/src/components/ToolsTab.tsx [warn] Code style issues found in the above file. Run Prettier with --write to fix. inspector on  feature/audio-rendering [$⇡] is 📦 v0.3.0 via  v22.11.0 ❯ npx prettier --write client/src/components/ToolsTab.tsx client/src/components/ToolsTab.tsx 109ms
1 parent afe14bc commit a87bd17

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

client/src/components/ToolsTab.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ import { CompatibilityCallToolResult } from "@modelcontextprotocol/sdk/types.js"
2020
import { z } from "zod";
2121

2222
// Define the AudioContent schema
23-
export const AudioContentSchema = z.object({
24-
type: z.literal("audio"),
25-
data: z.string().base64(),
26-
mimeType: z.string(),
27-
}).passthrough();
23+
export const AudioContentSchema = z
24+
.object({
25+
type: z.literal("audio"),
26+
data: z.string().base64(),
27+
mimeType: z.string(),
28+
})
29+
.passthrough();
2830

2931
// Extend the CallToolResult schema to include audio content
3032
export const ExtendedCallToolResultSchema = ResultSchema.extend({
@@ -34,14 +36,16 @@ export const ExtendedCallToolResultSchema = ResultSchema.extend({
3436
ImageContentSchema,
3537
AudioContentSchema,
3638
EmbeddedResourceSchema,
37-
])
39+
]),
3840
),
3941
isError: z.boolean().default(false).optional(),
4042
});
4143

4244
// Export the types
4345
export type AudioContent = z.infer<typeof AudioContentSchema>;
44-
export type ExtendedCallToolResult = z.infer<typeof ExtendedCallToolResultSchema>;
46+
export type ExtendedCallToolResult = z.infer<
47+
typeof ExtendedCallToolResultSchema
48+
>;
4549

4650
const ToolsTab = ({
4751
tools,
@@ -116,16 +120,16 @@ const ToolsTab = ({
116120
/>
117121
)}
118122
{item.type === "audio" && (
119-
<audio
123+
<audio
120124
controls
121125
src={`data:${item.mimeType};base64,${item.data}`}
122126
className="w-full"
123127
>
124128
<p>Your browser does not support audio playback</p>
125-
</audio>
129+
</audio>
126130
)}
127-
{item.type === "resource" && (
128-
item.resource?.mimeType?.startsWith("audio/") ? (
131+
{item.type === "resource" &&
132+
(item.resource?.mimeType?.startsWith("audio/") ? (
129133
<audio
130134
controls
131135
src={`data:${item.resource.mimeType};base64,${item.resource.blob}`}
@@ -137,8 +141,7 @@ const ToolsTab = ({
137141
<pre className="bg-gray-50 dark:bg-gray-800 dark:text-gray-100 whitespace-pre-wrap break-words p-4 rounded text-sm overflow-auto max-h-64">
138142
{JSON.stringify(item.resource, null, 2)}
139143
</pre>
140-
)
141-
)}
144+
))}
142145
</div>
143146
))}
144147
</>

0 commit comments

Comments
 (0)