{"record":{"id":"334d59c576f04764","repo":"googleapis/mcp-toolbox","slug":"invalid-s-parameter-expected-a-boolean","errorCode":null,"errorMessage":"invalid '%s' parameter; expected a boolean","messagePattern":"invalid '(.+?)' parameter; expected a boolean","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/cloudhealthcare/common/util.go","lineNumber":78,"sourceCode":"// search methods.\nfunc ParseDICOMSearchParameters(params parameters.ParamValues, paramKeys []string) ([]googleapi.CallOption, error) {\n\tvar opts []googleapi.CallOption\n\tfor k, v := range params.AsMap() {\n\t\tif k == IncludeAttributesKey {\n\t\t\tif _, ok := v.([]any); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid '%s' parameter; expected a string array\", k)\n\t\t\t}\n\t\t\tattributeIDsSlice, err := parameters.ConvertAnySliceToTyped(v.([]any), \"string\")\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"can't convert '%s' to array of strings: %s\", k, err)\n\t\t\t}\n\t\t\tattributeIDs := attributeIDsSlice.([]string)\n\t\t\tif len(attributeIDs) != 0 {\n\t\t\t\topts = append(opts, googleapi.QueryParameter(k, strings.Join(attributeIDs, \",\")))\n\t\t\t}\n\t\t} else if k == EnablePatientNameFuzzyMatchingKey {\n\t\t\tif _, ok := v.(bool); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid '%s' parameter; expected a boolean\", k)\n\t\t\t}\n\t\t\topts = append(opts, googleapi.QueryParameter(k, fmt.Sprintf(\"%t\", v.(bool))))\n\t\t} else if slices.Contains(paramKeys, k) {\n\t\t\tif _, ok := v.(string); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid '%s' parameter; expected a string\", k)\n\t\t\t}\n\t\t\tif v.(string) != \"\" {\n\t\t\t\topts = append(opts, googleapi.QueryParameter(k, v.(string)))\n\t\t\t}\n\t\t}\n\t}\n\treturn opts, nil\n}\n","sourceCodeStart":60,"sourceCodeEnd":92,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudhealthcare/common/util.go#L60-L92","documentation":"The `fuzzymatching` DICOM search option must be a JSON boolean. ParseDICOMSearchParameters asserts v.(bool) and returns this error when the value is a string like \"true\" or any other non-boolean type.","triggerScenarios":"Invoking a DICOM search tool with `fuzzymatching` set to \"true\"/\"false\" as a string, or as 1/0, instead of a real boolean.","commonSituations":"Form-encoded or template-substituted inputs turning booleans into strings; LLM quoting the boolean in JSON; clients built from older schemas that used strings.","solutions":["Send `fuzzymatching` as a JSON boolean: true or false (unquoted).","Remove surrounding quotes from the value in the request payload.","Coerce \"true\"/\"false\" strings to booleans client-side before invoking.","Validate the payload against the tool's parameter schema."],"exampleFix":"// before\n{\"fuzzymatching\": \"true\"}\n// after\n{\"fuzzymatching\": true}","handlingStrategy":"type-guard","validationCode":"function toBool(v) {\n  if (typeof v === 'boolean') return v;\n  if (v === 'true') return true;\n  if (v === 'false') return false;\n  throw new Error('fuzzymatching must be a boolean');\n}","typeGuard":"function isBool(v) { return typeof v === 'boolean'; }","tryCatchPattern":null,"preventionTips":["Send booleans unquoted in JSON","Avoid template string substitution that stringifies booleans","Enable strict JSON schema validation on the client","Write a serializer test for boolean params"],"tags":["go","parameter-validation","dicom","type-mismatch"],"backgroundTag":"parameter-type-mismatch","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}