googleapis/mcp-toolbox · error

%q is not valid type for a parameter

Error message

%q is not valid type for a parameter

What it means

This error is thrown at the fall-through of the parameter type switch in ParseParameter (internal/util/parameters/parameters.go:472): the 'type' field supplied for a tool parameter does not match any of the supported kinds (string, integer, boolean, array, map, float). It is a generic validation guard — the switch exhausted every known case, so the offending input is the paramType string read from the YAML/JSON tool configuration.

Source

Thrown at internal/util/parameters/parameters.go:472

		a := &ArrayParameter{}
		if err := dec.DecodeContext(ctx, a); err != nil {
			return nil, fmt.Errorf("unable to parse as %q: %w", paramType, err)
		}
		if a.GetEmbeddedBy() != "" {
			return nil, fmt.Errorf("parameter type %q cannot specify 'embeddedBy'", paramType)
		}
		return a, nil
	case TypeMap:
		a := &MapParameter{}
		if err := dec.DecodeContext(ctx, a); err != nil {
			return nil, fmt.Errorf("unable to parse as %q: %w", paramType, err)
		}
		if a.GetEmbeddedBy() != "" {
			return nil, fmt.Errorf("parameter type %q cannot specify 'embeddedBy'", paramType)
		}
		return a, nil
	}
	return nil, fmt.Errorf("%q is not valid type for a parameter", paramType)
}

func (ps Parameters) Manifest() []ParameterManifest {
	rtn := make([]ParameterManifest, 0, len(ps))
	for _, p := range ps {
		if p.GetValueFromParam() != "" {
			continue
		}
		rtn = append(rtn, p.Manifest())
	}
	return rtn
}

// ParameterManifest represents parameters when served as part of a ToolManifest.
type ParameterManifest struct {
	Name                 string             `json:"name"`
	Type                 string             `json:"type"`
	Required             bool               `json:"required"`

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Check the 'type' field of the failing parameter in the tool definition YAML and correct typos such as 'str', 'int', 'bools', or 'arrays' to the supported values: string, integer, boolean, array, map, float
  2. Verify you are using a supported parameter type; nested object parameters are not supported — model them as a 'map' type or separate parameters
  3. Ensure the type key is a plain scalar string and not accidentally a nested mapping or list in the YAML
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/util/parameters/parameters.go:472 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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