googleapis/mcp-toolbox · error

unable to parse value for key %q: %w

Error message

unable to parse value for key %q: %w

What it means

MapParameter.Parse iterates the map's entries and parses each value with a prototype parameter derived from valueType. This wrapping error fires at tool invocation time when one entry's value fails prototype parsing (e.g. wrong scalar type); the failing map key is named in the message and the cause is carried via %w.

Source

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

		}
		convertedMap, ok := convertedData.(map[string]any)
		if !ok {
			return nil, fmt.Errorf("internal error: ConvertNumbers should return a map, but got type %T", convertedData)
		}
		return convertedMap, nil
	}

	// Otherwise, get a prototype and parse each value in the map.
	prototype, err := getPrototypeParameter(p.ValueType)
	if err != nil {
		return nil, err
	}

	rtn := make(map[string]any, len(m))
	for key, val := range m {
		parsedVal, err := prototype.Parse(val)
		if err != nil {
			return nil, fmt.Errorf("unable to parse value for key %q: %w", key, err)
		}
		rtn[key] = parsedVal
	}
	return rtn, nil
}

func (p *MapParameter) GetAuthServices() []ParamAuthService {
	return p.AuthServices
}

func (p *MapParameter) GetDefault() any {
	if p.Default == nil {
		return nil
	}
	return *p.Default
}

func (p *MapParameter) GetValueType() string {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Inspect the wrapped cause to see why the value for the named key failed to parse
  2. Ensure each map value matches the parameter's valueType
  3. Correct or remove the offending key/value pair from the invocation arguments
Defensive patterns

Strategy: try-catch

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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