{"record":{"id":"02d9552645c58c00","repo":"googleapis/mcp-toolbox","slug":"model-must-be-a-string-got-t","errorCode":null,"errorMessage":"'model' must be a string, got %T","messagePattern":"'model' must be a string, got %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/looker/lookercommon/lookercommon.go","lineNumber":175,"sourceCode":"\treturn parameters.Parameters{\n\t\tmodelParameter,\n\t\texploreParameter,\n\t\tfieldsParameter,\n\t\tfiltersParameter,\n\t\tpivotsParameter,\n\t\tsortsParameter,\n\t\tlimitParameter,\n\t\ttzParameter,\n\t\tfilterExpressionParameter,\n\t\tdynamicFieldsParameter,\n\t}\n}\n\nfunc ProcessFieldArgs(ctx context.Context, params parameters.ParamValues) (*string, *string, error) {\n\tmapParams := params.AsMap()\n\tmodel, ok := mapParams[\"model\"].(string)\n\tif !ok {\n\t\treturn nil, nil, fmt.Errorf(\"'model' must be a string, got %T\", mapParams[\"model\"])\n\t}\n\texplore, ok := mapParams[\"explore\"].(string)\n\tif !ok {\n\t\treturn nil, nil, fmt.Errorf(\"'explore' must be a string, got %T\", mapParams[\"explore\"])\n\t}\n\treturn &model, &explore, nil\n}\n\n// escapeUnquotedParameterValue escapes Looker filter-expression metacharacters\n// so the value reaches a type: unquoted parameter without being interpreted as\n// a wildcard pattern. Looker treats `_` as a single-character wildcard and `%`\n// as a multi-character wildcard, and rejects either inside unquoted-parameter\n// values; `,` is the filter-expression value separator; `^` is the escape\n// character itself. Already-escaped sequences (`^_`, `^%`, `^,`, `^^`) pass\n// through unchanged, which keeps the function idempotent for callers that pass\n// pre-escaped forms (e.g. round-tripping `default_filter_value` from the\n// explore metadata). Lone metacharacters get a `^` prefix; lone `^` is doubled\n// to `^^`. Walking rune-by-rune (not whole-string scanning) means a value with","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookercommon/lookercommon.go#L157-L193","documentation":"ProcessFieldArgs converts incoming parameter values to a map and asserts 'model' is a Go string. If the raw value has another dynamic type, the assertion fails and this error reports the actual %T type, since downstream Looker SDK calls require string model names.","triggerScenarios":"Invoke receives params where mapParams[\"model\"] is not a string (nil when the parameter is missing, a float/int from JSON numbers, or an object/array from a malformed request body).","commonSituations":"Client omitting 'model' or sending it as a number; MCP client serializing parameters with unexpected JSON types; calling the tool programmatically with wrong-typed arguments.","solutions":["Send 'model' as a JSON string, e.g. {\"model\": \"ecommerce\"}.","Ensure the parameter is present; do not omit it from the tool call.","If calling from code, pass a plain Go string rather than an interface value."],"exampleFix":"// before\n{\"model\": 123, \"explore\": \"orders\"}\n// after\n{\"model\": \"ecommerce\", \"explore\": \"orders\"}\n","handlingStrategy":"validation","validationCode":"// Client-side check before invoking\nconst model = \"ecommerce\";\nif (typeof model !== \"string\" || model.length === 0) {\n    throw new Error(\"'model' must be a non-empty string\");\n}","typeGuard":"m, ok := mapParams[\"model\"]\nif !ok {\n    model, isStr := m.(string)\n    if !isStr {\n        return fmt.Errorf(\"model must be string, got %T\", m)\n    }\n}","tryCatchPattern":"model, explore, err := lookercommon.ProcessFieldArgs(ctx, params)\nif err != nil {\n    return nil, util.NewInvalidArgumentError(\"check 'model' parameter: %v\", err)\n}","preventionTips":["Declare 'model' as a required string parameter in the tool manifest so clients send strings.","Quote model names in JSON payloads; avoid numeric ids.","Add a request-schema check in your MCP client wrapper."],"tags":["parameters","type-mismatch","looker"],"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"}