Class: TalkToYourApp::Plugins::Flipper::Tools::DisableFlag
- Defined in:
- lib/talk_to_your_app/plugins/flipper/tools/disable_flag.rb
Overview
Disables a flag. With no gate arguments it disables globally; supply actor_class+actor_id, group, or percentage (+ optional percentage_type) to clear that specific gate.
Instance Method Summary collapse
Methods inherited from Tool
argument, arguments, clear_custom_registry!, connection, custom_registry, default_arguments, description, dispatch, inherited, input_schema_hash, invoke, name, normalize_response, to_mcp_definition, to_mcp_tool, tool_name
Instance Method Details
#call(args, ctx) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/talk_to_your_app/plugins/flipper/tools/disable_flag.rb', line 25 def call(args, ctx) if ( = Flipper.(args)) return error() end gate = Flipper.gate_from(args) result = ctx.connection do Flipper.apply(:disable, args[:name], gate) Flipper.gate_values(args[:name]) end json(name: args[:name], enabled: Flipper.active?(result), gate_type: gate[:type], gates: result) rescue StandardError => e error("Flipper storage unavailable: #{e.class}: #{e.}") end |