Skip to content

Commit 8f28ea7

Browse files
committed
Aligned naming
1 parent 159a049 commit 8f28ea7

File tree

4 files changed

+54
-51
lines changed

4 files changed

+54
-51
lines changed

client/src/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ const App = () => {
808808
const callTool = async (
809809
name: string,
810810
params: Record<string, unknown>,
811-
meta?: Record<string, unknown>,
811+
metadata?: Record<string, unknown>,
812812
) => {
813813
lastToolCallOriginTabRef.current = currentTabRef.current;
814814

@@ -824,7 +824,7 @@ const App = () => {
824824
const mergedMeta = {
825825
...metadata, // General metadata first
826826
progressToken: progressTokenRef.current++,
827-
...(meta ?? {}), // Tool-specific metadata overrides
827+
...(metadata ?? {}), // Tool-specific metadata overrides
828828
};
829829

830830
const response = await sendMCPRequest(
@@ -1148,11 +1148,11 @@ const App = () => {
11481148
callTool={async (
11491149
name: string,
11501150
params: Record<string, unknown>,
1151-
meta?: Record<string, unknown>,
1151+
metadata?: Record<string, unknown>,
11521152
) => {
11531153
clearError("tools");
11541154
setToolResult(null);
1155-
await callTool(name, params, meta);
1155+
await callTool(name, params, metadata);
11561156
}}
11571157
selectedTool={selectedTool}
11581158
setSelectedTool={(tool) => {

client/src/components/ToolsTab.tsx

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const ToolsTab = ({
6363
callTool: (
6464
name: string,
6565
params: Record<string, unknown>,
66-
meta?: Record<string, unknown>,
66+
metadata?: Record<string, unknown>,
6767
) => Promise<void>;
6868
selectedTool: Tool | null;
6969
setSelectedTool: (tool: Tool | null) => void;
@@ -76,8 +76,8 @@ const ToolsTab = ({
7676
const [params, setParams] = useState<Record<string, unknown>>({});
7777
const [isToolRunning, setIsToolRunning] = useState(false);
7878
const [isOutputSchemaExpanded, setIsOutputSchemaExpanded] = useState(false);
79-
const [isMetaExpanded, setIsMetaExpanded] = useState(false);
80-
const [metaEntries, setMetaEntries] = useState<
79+
const [isMetadataExpanded, setIsMetadataExpanded] = useState(false);
80+
const [metadataEntries, setMetadataEntries] = useState<
8181
{ id: string; key: string; value: string }[]
8282
>([]);
8383
const [hasValidationErrors, setHasValidationErrors] = useState(false);
@@ -400,7 +400,7 @@ const ToolsTab = ({
400400
variant="outline"
401401
className="h-6 px-2"
402402
onClick={() =>
403-
setMetaEntries((prev) => [
403+
setMetadataEntries((prev) => [
404404
...prev,
405405
{
406406
id:
@@ -419,30 +419,30 @@ const ToolsTab = ({
419419
Add Pair
420420
</Button>
421421
</div>
422-
{metaEntries.length === 0 ? (
422+
{metadataEntries.length === 0 ? (
423423
<p className="text-xs text-muted-foreground">
424-
No meta pairs.
424+
No metadata pairs.
425425
</p>
426426
) : (
427427
<div className="space-y-2">
428-
{metaEntries.map((entry, index) => (
428+
{metadataEntries.map((entry, index) => (
429429
<div
430430
key={entry.id}
431431
className="flex items-center gap-2 w-full"
432432
>
433433
<Label
434-
htmlFor={`meta-key-${entry.id}`}
434+
htmlFor={`metadata-key-${entry.id}`}
435435
className="text-xs shrink-0"
436436
>
437437
Key
438438
</Label>
439439
<Input
440-
id={`meta-key-${entry.id}`}
440+
id={`metadata-key-${entry.id}`}
441441
value={entry.key}
442442
placeholder="e.g. requestId"
443443
onChange={(e) => {
444444
const value = e.target.value;
445-
setMetaEntries((prev) =>
445+
setMetadataEntries((prev) =>
446446
prev.map((m, i) =>
447447
i === index ? { ...m, key: value } : m,
448448
),
@@ -451,18 +451,18 @@ const ToolsTab = ({
451451
className="h-8 flex-1"
452452
/>
453453
<Label
454-
htmlFor={`meta-value-${entry.id}`}
454+
htmlFor={`metadata-value-${entry.id}`}
455455
className="text-xs shrink-0"
456456
>
457457
Value
458458
</Label>
459459
<Input
460-
id={`meta-value-${entry.id}`}
460+
id={`metadata-value-${entry.id}`}
461461
value={entry.value}
462462
placeholder="e.g. 12345"
463463
onChange={(e) => {
464464
const value = e.target.value;
465-
setMetaEntries((prev) =>
465+
setMetadataEntries((prev) =>
466466
prev.map((m, i) =>
467467
i === index ? { ...m, value } : m,
468468
),
@@ -475,7 +475,7 @@ const ToolsTab = ({
475475
variant="ghost"
476476
className="h-8 w-8 p-0 ml-auto shrink-0"
477477
onClick={() =>
478-
setMetaEntries((prev) =>
478+
setMetadataEntries((prev) =>
479479
prev.filter((_, i) => i !== index),
480480
)
481481
}
@@ -533,10 +533,12 @@ const ToolsTab = ({
533533
<Button
534534
size="sm"
535535
variant="ghost"
536-
onClick={() => setIsMetaExpanded(!isMetaExpanded)}
536+
onClick={() =>
537+
setIsMetadataExpanded(!isMetadataExpanded)
538+
}
537539
className="h-6 px-2"
538540
>
539-
{isMetaExpanded ? (
541+
{isMetadataExpanded ? (
540542
<>
541543
<ChevronUp className="h-3 w-3 mr-1" />
542544
Collapse
@@ -551,7 +553,9 @@ const ToolsTab = ({
551553
</div>
552554
<div
553555
className={`transition-all ${
554-
isMetaExpanded ? "" : "max-h-[8rem] overflow-y-auto"
556+
isMetadataExpanded
557+
? ""
558+
: "max-h-[8rem] overflow-y-auto"
555559
}`}
556560
>
557561
<JsonView data={selectedTool._meta} />
@@ -565,17 +569,16 @@ const ToolsTab = ({
565569

566570
try {
567571
setIsToolRunning(true);
568-
const meta = metaEntries.reduce<Record<string, unknown>>(
569-
(acc, { key, value }) => {
570-
if (key.trim() !== "") acc[key] = value;
571-
return acc;
572-
},
573-
{},
574-
);
572+
const metadata = metadataEntries.reduce<
573+
Record<string, unknown>
574+
>((acc, { key, value }) => {
575+
if (key.trim() !== "") acc[key] = value;
576+
return acc;
577+
}, {});
575578
await callTool(
576579
selectedTool.name,
577580
params,
578-
Object.keys(meta).length ? meta : undefined,
581+
Object.keys(metadata).length ? metadata : undefined,
579582
);
580583
} finally {
581584
setIsToolRunning(false);

client/src/components/__tests__/ToolsTab.test.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -716,10 +716,10 @@ describe("ToolsTab", () => {
716716
});
717717
});
718718

719-
describe("Meta Display", () => {
720-
const toolWithMeta = {
719+
describe("Metadata Display", () => {
720+
const toolWithMetadata = {
721721
name: "metaTool",
722-
description: "Tool with meta",
722+
description: "Tool with metadata",
723723
inputSchema: {
724724
type: "object" as const,
725725
properties: {
@@ -732,10 +732,10 @@ describe("ToolsTab", () => {
732732
},
733733
} as unknown as Tool;
734734

735-
it("should display meta section when tool has _meta", () => {
735+
it("should display metadata section when tool has _meta", () => {
736736
renderToolsTab({
737-
tools: [toolWithMeta],
738-
selectedTool: toolWithMeta,
737+
tools: [toolWithMetadata],
738+
selectedTool: toolWithMetadata,
739739
});
740740

741741
expect(screen.getByText("Meta:")).toBeInTheDocument();
@@ -744,10 +744,10 @@ describe("ToolsTab", () => {
744744
).toBeInTheDocument();
745745
});
746746

747-
it("should toggle meta schema expansion", () => {
747+
it("should toggle metadata schema expansion", () => {
748748
renderToolsTab({
749-
tools: [toolWithMeta],
750-
selectedTool: toolWithMeta,
749+
tools: [toolWithMetadata],
750+
selectedTool: toolWithMetadata,
751751
});
752752

753753
// There might be multiple Expand buttons (Output Schema, Meta). We need the one within Meta section
@@ -777,13 +777,13 @@ describe("ToolsTab", () => {
777777
});
778778
});
779779

780-
describe("Meta submission", () => {
781-
it("should send meta values when provided", async () => {
780+
describe("Metadata submission", () => {
781+
it("should send metadata values when provided", async () => {
782782
const callToolMock = jest.fn(async () => {});
783783

784784
renderToolsTab({ selectedTool: mockTools[0], callTool: callToolMock });
785785

786-
// Add a meta key/value pair
786+
// Add a metadata key/value pair
787787
const addPairButton = screen.getByRole("button", { name: /add pair/i });
788788
await act(async () => {
789789
fireEvent.click(addPairButton);
@@ -815,19 +815,19 @@ describe("ToolsTab", () => {
815815
});
816816
});
817817

818-
describe("ToolResults Meta", () => {
819-
it("should display meta information when present in toolResult", () => {
820-
const resultWithMeta = {
818+
describe("ToolResults Metadata", () => {
819+
it("should display metadata information when present in toolResult", () => {
820+
const resultWithMetadata = {
821821
content: [],
822822
_meta: { info: "details", version: 2 },
823823
};
824824

825825
renderToolsTab({
826826
selectedTool: mockTools[0],
827-
toolResult: resultWithMeta,
827+
toolResult: resultWithMetadata,
828828
});
829829

830-
// Only ToolResults meta should be present since selectedTool has no _meta
830+
// Only ToolResults metadata should be present since selectedTool has no _meta
831831
expect(screen.getAllByText("Meta:")).toHaveLength(1);
832832
expect(screen.getByText(/info/i)).toBeInTheDocument();
833833
expect(screen.getByText(/version/i)).toBeInTheDocument();

client/src/lib/hooks/useConnection.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ export function useConnection({
167167

168168
// Add metadata to the request if available, but skip for tool calls
169169
// as they handle metadata merging separately
170-
const shouldAddGeneralMeta =
170+
const shouldAddGeneralMetadata =
171171
request.method !== "tools/call" && Object.keys(metadata).length > 0;
172-
const requestWithMeta = shouldAddGeneralMeta
172+
const requestWithMetadata = shouldAddGeneralMetadata
173173
? {
174174
...request,
175175
params: {
@@ -208,16 +208,16 @@ export function useConnection({
208208
let response;
209209
try {
210210
response = await mcpClient.request(
211-
requestWithMeta,
211+
requestWithMetadata,
212212
schema,
213213
mcpRequestOptions,
214214
);
215215

216-
pushHistory(requestWithMeta, response);
216+
pushHistory(requestWithMetadata, response);
217217
} catch (error) {
218218
const errorMessage =
219219
error instanceof Error ? error.message : String(error);
220-
pushHistory(requestWithMeta, { error: errorMessage });
220+
pushHistory(requestWithMetadata, { error: errorMessage });
221221
throw error;
222222
}
223223

0 commit comments

Comments
 (0)