mirror of
https://github.com/sst/opencode.git
synced 2025-08-22 14:04:07 +00:00
fix: add type checking for MCP tool path parameters
Prevents panic when MCP servers send path parameters as arrays instead of strings by safely checking the type before conversion
This commit is contained in:
parent
863ae6fa7d
commit
bae929c38a
1 changed files with 3 additions and 1 deletions
|
@ -903,7 +903,9 @@ func renderArgs(args *map[string]any, titleKey string) string {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if key == "filePath" || key == "path" {
|
if key == "filePath" || key == "path" {
|
||||||
value = util.Relative(value.(string))
|
if strValue, ok := value.(string); ok {
|
||||||
|
value = util.Relative(strValue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if key == titleKey {
|
if key == titleKey {
|
||||||
title = fmt.Sprintf("%s", value)
|
title = fmt.Sprintf("%s", value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue