googleapis/mcp-toolbox · error

parameter %q is secure and must not be passed in standard ar

Error message

parameter %q is secure and must not be passed in standard arguments

What it means

During tools/call, validateAndMergeSecureParams enforces that parameters marked secure (secure=true in the tool's parameter definition) are supplied only via the SecureArguments extension field, never in the standard Arguments map. Passing a secure parameter in standard arguments is treated as an agent-side error (first return = agent error) because the value would be exposed in the non-secure payload.

Source

Thrown at internal/server/mcp/v20260728/method.go:891

		Result:  result,
	}, nil
}

// validateAndMergeSecureParams validates and merges standard and secure arguments.
func validateAndMergeSecureParams(ctx context.Context, req *CallToolRequest, paramDefs parameters.Parameters) (map[string]any, error, error) {
	secureParamMap := make(map[string]bool)
	urlParams, _ := util.UrlParamsFromContext(ctx)

	for _, p := range paramDefs {
		if p != nil && p.GetSecure() {
			secureParamMap[p.GetName()] = true
		}
	}

	// Validate that secure parameters are not passed in standard arguments (Agent error)
	for argName := range req.Params.Arguments {
		if secureParamMap[argName] {
			return nil, fmt.Errorf("parameter %q is secure and must not be passed in standard arguments", argName), nil
		}
	}

	// Validate that non-secure parameters are not passed in secureArguments (Protocol error)
	for argName := range req.Params.SecureArguments {
		if !secureParamMap[argName] {
			return nil, nil, fmt.Errorf("parameter %q is not secure and must not be passed in secureArguments", argName)
		}
	}

	// Validate that required secure parameters are present in secureArguments (Protocol error)
	for _, p := range paramDefs {
		if p != nil && p.GetSecure() {
			name := p.GetName()
			if p.GetValueFromParam() == "" {
				if _, bound := urlParams[name]; !bound {
					if parameters.CheckParamRequired(p.GetRequired(), p.GetDefault()) {
						if req.Params.SecureArguments == nil {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Move the secure parameter value into params.secureArguments and remove it from params.arguments
  2. Declare the client capability extension "com.google.cloud/toolbox.v1" in initialize capabilities and use secureArguments for secure params
  3. Change the parameter's secure: true flag in tools.yaml to false if the value is not actually sensitive (not recommended for secrets)

Example fix

// before
{"method": "tools/call", "params": {"name": "run_query", "arguments": {"password": "hunter2"}}}
// after
{"method": "tools/call", "params": {"name": "run_query", "arguments": {}, "secureArguments": {"password": "hunter2"}}}
Defensive patterns

Strategy: validation

Validate before calling

const secureNames = new Set(toolParams.filter(p => p.secure).map(p => p.name));
for (const key of Object.keys(args)) {
  if (secureNames.has(key)) throw new Error(`"${key}" is secure; send it in secureArguments, not arguments`);
}

Type guard

function hasNoSecureInStandard(args, secureNames) {
  return Object.keys(args).every(k => !secureNames.has(k));
}

Try / catch

try {
  await mcp.toolsCall({ name: tool, arguments: args, secureArguments: secureArgs });
} catch (e) {
  if (/is secure and must not be passed in standard arguments/.test(e.message)) {
    const key = e.message.match(/parameter "([^"]+)"/)?.[1];
    secureArgs[key] = args[key]; delete args[key]; // retry with split payloads
  } else { throw e; }
}

Prevention

When it happens

Trigger: A tools/call request includes a key in params.arguments whose name matches a parameter defined with secure: true, e.g. putting a password/api-key parameter in arguments instead of secureArguments.

Common situations: Clients not updated for the com.google.cloud/toolbox.v1 secure-arguments extension still sending all params in arguments; hand-written MCP clients; LLM agent copying all parameter values into the plain arguments object.

Related errors


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