Skip to content

Commit 8267e51

Browse files
committed
fix: prettier write
1 parent 18438db commit 8267e51

File tree

2 files changed

+38
-22
lines changed

2 files changed

+38
-22
lines changed

client/src/components/DynamicJsonForm.tsx

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ const DynamicJsonForm = ({
215215
return;
216216
}
217217

218-
const updateArray = (array: JsonValue[], path: string[], value: JsonValue): JsonValue[] => {
218+
const updateArray = (
219+
array: JsonValue[],
220+
path: string[],
221+
value: JsonValue,
222+
): JsonValue[] => {
219223
const [index, ...restPath] = path;
220224
const arrayIndex = Number(index);
221225

@@ -232,7 +236,7 @@ const DynamicJsonForm = ({
232236
}
233237

234238
const newArray = [...array];
235-
239+
236240
if (restPath.length === 0) {
237241
newArray[arrayIndex] = value;
238242
} else {
@@ -242,22 +246,30 @@ const DynamicJsonForm = ({
242246
newArray.length = arrayIndex + 1;
243247
newArray.fill(null, array.length, arrayIndex);
244248
}
245-
newArray[arrayIndex] = updateValue(newArray[arrayIndex], restPath, value);
249+
newArray[arrayIndex] = updateValue(
250+
newArray[arrayIndex],
251+
restPath,
252+
value,
253+
);
246254
}
247255
return newArray;
248256
};
249257

250-
const updateObject = (obj: JsonObject, path: string[], value: JsonValue): JsonObject => {
258+
const updateObject = (
259+
obj: JsonObject,
260+
path: string[],
261+
value: JsonValue,
262+
): JsonObject => {
251263
const [key, ...restPath] = path;
252-
264+
253265
// Validate object key
254-
if (typeof key !== 'string') {
266+
if (typeof key !== "string") {
255267
console.error(`Invalid object key: ${key}`);
256268
return obj;
257269
}
258270

259271
const newObj = { ...obj };
260-
272+
261273
if (restPath.length === 0) {
262274
newObj[key] = value;
263275
} else {
@@ -271,7 +283,11 @@ const DynamicJsonForm = ({
271283
return newObj;
272284
};
273285

274-
const updateValue = (current: JsonValue, path: string[], value: JsonValue): JsonValue => {
286+
const updateValue = (
287+
current: JsonValue,
288+
path: string[],
289+
value: JsonValue,
290+
): JsonValue => {
275291
if (path.length === 0) return value;
276292

277293
try {
@@ -282,14 +298,17 @@ const DynamicJsonForm = ({
282298
// Type checking
283299
if (Array.isArray(current)) {
284300
return updateArray(current, path, value);
285-
} else if (typeof current === 'object' && current !== null) {
301+
} else if (typeof current === "object" && current !== null) {
286302
return updateObject(current, path, value);
287303
} else {
288-
console.error(`Cannot update path ${path.join('.')} in non-object/array value:`, current);
304+
console.error(
305+
`Cannot update path ${path.join(".")} in non-object/array value:`,
306+
current,
307+
);
289308
return current;
290309
}
291310
} catch (error) {
292-
console.error(`Error updating value at path ${path.join('.')}:`, error);
311+
console.error(`Error updating value at path ${path.join(".")}:`, error);
293312
return current;
294313
}
295314
};
@@ -298,7 +317,7 @@ const DynamicJsonForm = ({
298317
const newValue = updateValue(value, path, fieldValue);
299318
onChange(newValue);
300319
} catch (error) {
301-
console.error('Failed to update form value:', error);
320+
console.error("Failed to update form value:", error);
302321
// Keep the original value unchanged
303322
onChange(value);
304323
}

client/src/components/ToolsTab.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import ListPane from "./ListPane";
1717

1818
import { CompatibilityCallToolResult } from "@modelcontextprotocol/sdk/types.js";
1919

20-
2120
const ToolsTab = ({
2221
tools,
2322
listTools,
@@ -206,17 +205,15 @@ const ToolsTab = ({
206205
}
207206
className="mt-1"
208207
/>
209-
) : prop.type === "object"|| prop.type === "array" ? (
208+
) : prop.type === "object" || prop.type === "array" ? (
210209
<div className="mt-1">
211210
<DynamicJsonForm
212-
schema={
213-
{
214-
type: prop.type,
215-
properties: prop.properties,
216-
description: prop.description,
217-
items:prop.items
218-
}
219-
}
211+
schema={{
212+
type: prop.type,
213+
properties: prop.properties,
214+
description: prop.description,
215+
items: prop.items,
216+
}}
220217
value={(params[key] as JsonValue) ?? {}}
221218
onChange={(newValue: JsonValue) => {
222219
setParams({

0 commit comments

Comments
 (0)