Merge pull request #112 from modelcontextprotocol/devin/1734088716-fix-object-params
fix: properly handle object type parameters in tools
This commit is contained in:
commit
7edde5001b
1 changed files with 25 additions and 0 deletions
|
|
@ -174,6 +174,31 @@ const ToolsTab = ({
|
||||||
}
|
}
|
||||||
className="mt-1"
|
className="mt-1"
|
||||||
/>
|
/>
|
||||||
|
) :
|
||||||
|
/* @ts-expect-error value type is currently unknown */
|
||||||
|
value.type === "object" ? (
|
||||||
|
<Textarea
|
||||||
|
id={key}
|
||||||
|
name={key}
|
||||||
|
// @ts-expect-error value type is currently unknown
|
||||||
|
placeholder={value.description}
|
||||||
|
onChange={(e) => {
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(e.target.value);
|
||||||
|
setParams({
|
||||||
|
...params,
|
||||||
|
[key]: parsed,
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
// If invalid JSON, store as string - will be validated on submit
|
||||||
|
setParams({
|
||||||
|
...params,
|
||||||
|
[key]: e.target.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
className="mt-1"
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Input
|
<Input
|
||||||
// @ts-expect-error value type is currently unknown
|
// @ts-expect-error value type is currently unknown
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue