Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
fix(agent): harden tool parameter parsing against LLM type mismatches (#1505)
caiyuze-cpud9ba7716b531
diff --git a/internal/agent/tools/param_cast.go b/internal/agent/tools/param_cast.goindex 9b0cf4a96..a87199dd8 100644--- a/internal/agent/tools/param_cast.go+++ b/internal/agent/tools/param_cast.go@@ -69,8 +69,13 @@ func CastParams(args json.RawMessage, schema json.RawMessage) json.RawMessage {func castValue(val interface{}, targetType string) (interface{}, bool) {switch targetType {case "array":- // Allow a single string to satisfy string-array parameters used by tools.if s, ok := val.(string); ok {+ // Try JSON parsing first (handles "[{...}]" → []interface{})+ var parsed []interface{}+ if err := json.Unmarshal([]byte(s), &parsed); err == nil {+ return parsed, true+ }+ // Fall back: single string → string arrayreturn []string{s}, true}diff --git a/internal/agent/tools/todo_write.go b/internal/agent/tools/todo_write.goindex 97d83e71f..570cd4022 100644--- a/internal/agent/tools/todo_write.go+++ b/internal/agent/tools/todo_write.go@@ -143,7 +143,7 @@ type TodoWriteTool struct {// TodoWriteInput defines the input parameters for todo_write tooltype TodoWriteInput struct {- Task string `json:"task" jsonschema:"The complex task or question you need to create a plan for"`+ Task string `json:"task,omitempty" jsonschema:"The complex task or question you need to create a plan for"`Steps []PlanStep `json:"steps" jsonschema:"Array of research plan steps with status tracking"`}