Skip to content

mcp: appendBoolFlag silently drops explicit false values #3705

@Elvand-Lie

Description

@Elvand-Lie

Bug

appendBoolFlag in pkg/mcp/tools.go only appends the flag when *value == true:

func appendBoolFlag(args []string, flag string, value *bool) []string {
    if value != nil && *value {
        return append(args, flag)
    }
    return args
}

When the AI agent explicitly sends {"push": false}, the pointer is non-nil but the value is false, so the flag is silently dropped. For boolean flags like --push, --remote, and --registry-insecure, there is no way for the MCP client to explicitly disable a flag that was previously set via func.yaml or defaults.

Example scenario:

  1. User deploys with --push enabled (value saved in func.yaml)
  2. AI agent sends {"push": false} to disable push on the next deploy
  3. appendBoolFlag drops the flag entirely
  4. func deploy reads func.yaml and pushes anyway

Impact

The MCP client cannot explicitly disable a boolean option that was previously enabled. The underlying CLI supports --push=false to explicitly override defaults, but the MCP layer cannot express that intent.

Fix

When value != nil && !*value, append flag=false (e.g. --push=false) instead of dropping the flag silently.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions