googleapis/mcp-toolbox · error

fail to get map params: %w

Error message

fail to get map params: %w

What it means

RunSQL wraps any failure from getMapParamsType (which translates the tool's declared parameter types into Bigtable SQLTypes) with this message. The root cause is virtually always error 511 — an unsupported or misspelled parameter type — so the wrapped error names the offending type. It fires before any statement is sent to Bigtable.

Source

Thrown at internal/sources/bigtable/bigtable.go:171

			}
			btParamTypes[p.GetName()] = bigtable.ArraySQLType{
				ElemType: itemType,
			}
			continue
		}
		paramType, err := getBigtableType(p.GetType())
		if err != nil {
			return nil, err
		}
		btParamTypes[p.GetName()] = paramType
	}
	return btParamTypes, nil
}

func (s *Source) RunSQL(ctx context.Context, statement string, configParam parameters.Parameters, params parameters.ParamValues) (any, error) {
	mapParamsType, err := getMapParamsType(configParam)
	if err != nil {
		return nil, fmt.Errorf("fail to get map params: %w", err)
	}

	ps, err := s.BigtableClient().PrepareStatement(
		ctx,
		statement,
		mapParamsType,
	)
	if err != nil {
		return nil, fmt.Errorf("unable to prepare statement: %w", err)
	}

	bs, err := ps.Bind(params.AsMap())
	if err != nil {
		return nil, fmt.Errorf("unable to bind: %w", err)
	}

	out := []any{}
	var rowErr error

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Read the wrapped error to find the offending type name and fix the tool parameter type to boolean/string/integer/float/array
  2. Fix the array parameter's items.type if the failing param is an array
  3. Validate the tool config before deploying (declare only supported types for Bigtable-backed tools)

Example fix

// before (tools.yaml)
parameters:
  - name: filters
    type: object
// after
parameters:
  - name: filter_value
    type: string
Defensive patterns

Strategy: validation

Validate before calling

for _, p := range toolParams {
	t := p.GetType()
	if t != "boolean" && t != "string" && t != "integer" && t != "float" && t != "array" {
		return fmt.Errorf("param %q type %q unsupported before calling RunSQL", p.GetName(), t)
	}
}

Try / catch

res, err := src.RunSQL(ctx, statement, cfgParams, paramValues)
if err != nil {
	var target *bigtableSrcErr
	if strings.Contains(err.Error(), "fail to get map params") {
		// unwrap to find the offending type in the tool config
	}
	return err
}

Prevention

When it happens

Trigger: RunSQL is invoked with a `configParam` (parameters.Parameters) containing a param whose type or array items.type is not boolean/string/integer/float/array; getMapParamsType returns an error which is wrapped here.

Common situations: Tool config declares `type: number` or `type: object` for a parameter used by a Bigtable execute_sql tool; nested array item type unsupported; typo'd type in tools.yaml discovered only at query time.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/0b88e33f90935ee8. Report an issue: GitHub.