googleapis/mcp-toolbox · error

tool %q config error: parameter %q cannot copy value from it

Error message

tool %q config error: parameter %q cannot copy value from itself

What it means

A tool parameter's `valueFromParam` points to the parameter itself (refName == pName). Self-copying is a logical cycle that would produce no value, so it is explicitly rejected.

Source

Thrown at internal/server/config.go:520

			// Validate references
			for i, rawP := range paramsList {
				pMap, ok := rawP.(map[string]any)
				if !ok {
					continue
				}

				pName, _ := pMap["name"].(string)
				refName, _ := pMap["valueFromParam"].(string)

				if refName != "" {
					// Check if the referenced parameter exists
					if !validParamNames[refName] {
						return nil, fmt.Errorf("tool %q config error: parameter %q (index %d) references '%q' in the 'valueFromParam' field, which is not a defined parameter", name, pName, i, refName)
					}

					// Check for self-reference
					if refName == pName {
						return nil, fmt.Errorf("tool %q config error: parameter %q cannot copy value from itself", name, pName)
					}
				}
			}
		}
	}

	dec, err := util.NewStrictDecoder(r)
	if err != nil {
		return nil, fmt.Errorf("error creating decoder: %s", err)
	}
	toolCfg, err := tools.DecodeConfig(ctx, resourceType, name, dec)
	if err != nil {
		if errors.Is(err, tools.ErrUnknownToolType) && util.IgnoreUnknownToolsFromContext(ctx) {
			l, logErr := util.LoggerFromContext(ctx)
			if logErr == nil {
				l.WarnContext(ctx, fmt.Sprintf("Skipping unknown tool type %q for tool %q", resourceType, name))
			}
			return nil, nil

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point valueFromParam at a different, existing parameter
  2. Remove valueFromParam entirely if the parameter should hold its own value
  3. Give the parameter a default/placeholder through its normal mechanism instead

Example fix

// before
  - name: prompt
    type: string
    valueFromParam: prompt
// after
  - name: prompt
    type: string
    valueFromParam: default_prompt
Defensive patterns

Strategy: validation

Validate before calling

func validateNoSelfRef(params []map[string]any) error {
  for _, p := range params {
    n, _ := p["name"].(string)
    r, _ := p["valueFromParam"].(string)
    if r != "" && r == n { return fmt.Errorf("parameter %q cannot copy value from itself", n) }
  }
  return nil
}

Prevention

When it happens

Trigger: A tools entry has a parameter like `- name: prompt\n valueFromParam: prompt` — typically from a copy-paste where the valueFromParam line was left pointing at the same parameter.

Common situations: Duplicating a parameter block and editing the name but not valueFromParam; misunderstanding valueFromParam as a default-value mechanism and filling it with the same name.

Related errors


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