Skip to content

Commit 990bc0f

Browse files
committed
Fix formatting
1 parent 73c0c13 commit 990bc0f

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

client/src/components/DynamicJsonForm.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ const DynamicJsonForm = ({
124124
return (
125125
<JsonEditor
126126
value={JSON.stringify(
127-
currentValue ?? generateDefaultValue(propSchema, propertyName, parentSchema),
127+
currentValue ??
128+
generateDefaultValue(propSchema, propertyName, parentSchema),
128129
null,
129130
2,
130131
)}
@@ -143,7 +144,8 @@ const DynamicJsonForm = ({
143144
}
144145

145146
// Check if this property is required in the parent schema
146-
const isRequired = parentSchema?.required?.includes(propertyName || "") ?? false;
147+
const isRequired =
148+
parentSchema?.required?.includes(propertyName || "") ?? false;
147149

148150
switch (propSchema.type) {
149151
case "string":
@@ -223,14 +225,16 @@ const DynamicJsonForm = ({
223225
handleFieldChange(path, parsed);
224226
setJsonError(undefined);
225227
} catch (err) {
226-
setJsonError(err instanceof Error ? err.message : "Invalid JSON");
228+
setJsonError(
229+
err instanceof Error ? err.message : "Invalid JSON",
230+
);
227231
}
228232
}}
229233
error={jsonError}
230234
/>
231235
);
232236
}
233-
237+
234238
return (
235239
<div className="space-y-2 border rounded p-3">
236240
{Object.entries(propSchema.properties).map(([key, subSchema]) => (
@@ -263,7 +267,9 @@ const DynamicJsonForm = ({
263267
handleFieldChange(path, parsed);
264268
setJsonError(undefined);
265269
} catch (err) {
266-
setJsonError(err instanceof Error ? err.message : "Invalid JSON");
270+
setJsonError(
271+
err instanceof Error ? err.message : "Invalid JSON",
272+
);
267273
}
268274
}}
269275
error={jsonError}

client/src/components/ToolsTab.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ const ToolsTab = ({
4848
selectedTool?.inputSchema.properties ?? [],
4949
).map(([key, value]) => [
5050
key,
51-
generateDefaultValue(value as JsonSchemaType, key, selectedTool?.inputSchema as JsonSchemaType),
51+
generateDefaultValue(
52+
value as JsonSchemaType,
53+
key,
54+
selectedTool?.inputSchema as JsonSchemaType,
55+
),
5256
]);
5357
setParams(Object.fromEntries(params));
5458
}, [selectedTool]);
@@ -92,15 +96,19 @@ const ToolsTab = ({
9296
{Object.entries(selectedTool.inputSchema.properties ?? []).map(
9397
([key, value]) => {
9498
const prop = value as JsonSchemaType;
95-
const inputSchema = selectedTool.inputSchema as JsonSchemaType;
99+
const inputSchema =
100+
selectedTool.inputSchema as JsonSchemaType;
96101
const required = isPropertyRequired(key, inputSchema);
97102
return (
98103
<div key={key}>
99104
<Label
100105
htmlFor={key}
101106
className="block text-sm font-medium text-gray-700 dark:text-gray-300"
102107
>
103-
{key}{required && <span className="text-red-500 ml-1">*</span>}
108+
{key}
109+
{required && (
110+
<span className="text-red-500 ml-1">*</span>
111+
)}
104112
</Label>
105113
{prop.type === "boolean" ? (
106114
<div className="flex items-center space-x-2 mt-2">

client/src/utils/schemaUtils.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,15 @@ export function hasOutputSchema(toolName: string): boolean {
8888
export function generateDefaultValue(
8989
schema: JsonSchemaType,
9090
propertyName?: string,
91-
parentSchema?: JsonSchemaType
91+
parentSchema?: JsonSchemaType,
9292
): JsonValue {
9393
if ("default" in schema && schema.default !== undefined) {
9494
return schema.default;
9595
}
9696

9797
// Check if this property is required in the parent schema
98-
const isRequired = parentSchema?.required?.includes(propertyName || "") ?? false;
98+
const isRequired =
99+
parentSchema?.required?.includes(propertyName || "") ?? false;
99100

100101
switch (schema.type) {
101102
case "string":
@@ -136,7 +137,10 @@ export function generateDefaultValue(
136137
* @param schema The parent schema containing the required array
137138
* @returns true if the property is required, false otherwise
138139
*/
139-
export function isPropertyRequired(propertyName: string, schema: JsonSchemaType): boolean {
140+
export function isPropertyRequired(
141+
propertyName: string,
142+
schema: JsonSchemaType,
143+
): boolean {
140144
return schema.required?.includes(propertyName) ?? false;
141145
}
142146

0 commit comments

Comments
 (0)