Blender 2.8 Python Addon: How to register a Button?
wm.context_toggle

For a simple toggle of a boolean property with a context path can use the bpy.ops.wm.context_toggle(data_path="") operator.  For the example in question

data_path = "scene.tool_settings.use_mesh_automerge"


To add as a layout element

op = layout.operator("wm.context_toggle")
op.data_path = "scene.tool_settings.use_mesh_automerge"


Removes the need to write an operator simply to toggle a property.

import bpy

def toggle_automerge_button(self, context):
    op = self.layout.operator(
        "wm.context_toggle",
        text="Toggle Automerge",
        icon='PLUGIN')
    op.data_path = "scene.tool_settings.use_mesh_automerge"

def register():
    bpy.types.VIEW3D_MT_edit_mesh.append(toggle_automerge_button)

def unregister():
    bpy.types.VIEW3D_MT_edit_mesh.remove(toggle_automerge_button)

if __name__ == "__main__":
    register()


Note could also simply set the property

def toggle_automerge_button(self, context):
    ts = context.scene.tool_settings
    layout = self.layout
    layout.prop(ts, "use_mesh_automerge", toggle=True)