How can I call the active brush within my script?
The value you get with brush = bpy.context.tool_settings.sculpt.brush is a Brush object:

&gt;&gt;&gt; type(bpy.context.tool_settings.sculpt.brush)
&lt;class 'bpy.types.Brush'&gt;


When you access bpy.data.brushes[brush] it expects a name string (i.e. brush.name). Instead you can simply use the brush itself:

def execute(self, context):

    setting = self.setting
    brush = bpy.context.tool_settings.sculpt.brush
    print(brush)

    if setting == 'use_accumulate':
        value = brush.use_accumulate
        print(value)
        brush.use_accumulate = not value
    return {"FINISHED"}


One more suggestion:

Use the supplied context of the operator, this is better than using bpy.context:

brush = context.tool_settings.sculpt.brush