Skip to content

Commit 7edde50

Browse files
authored
Merge pull request #112 from modelcontextprotocol/devin/1734088716-fix-object-params
fix: properly handle object type parameters in tools
2 parents eb70539 + 14bda1f commit 7edde50

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

client/src/components/ToolsTab.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,31 @@ const ToolsTab = ({
174174
}
175175
className="mt-1"
176176
/>
177+
) :
178+
/* @ts-expect-error value type is currently unknown */
179+
value.type === "object" ? (
180+
<Textarea
181+
id={key}
182+
name={key}
183+
// @ts-expect-error value type is currently unknown
184+
placeholder={value.description}
185+
onChange={(e) => {
186+
try {
187+
const parsed = JSON.parse(e.target.value);
188+
setParams({
189+
...params,
190+
[key]: parsed,
191+
});
192+
} catch (err) {
193+
// If invalid JSON, store as string - will be validated on submit
194+
setParams({
195+
...params,
196+
[key]: e.target.value,
197+
});
198+
}
199+
}}
200+
className="mt-1"
201+
/>
177202
) : (
178203
<Input
179204
// @ts-expect-error value type is currently unknown

0 commit comments

Comments
 (0)