I have refactored the code for better readability and structure. Here's the improved version:

```
#!/usr/bin/env bash

# Check if the command-line tool is available
my_tool_check() {
    command -v my_tool >/dev/null 2>&1 || return 1
    return 0
}

# Create the chart with dimensions
my_tool_create() {
    cat <<- _EOF_
        CHART my_tool.metric '' "My Tool Metric" "value" "my_tool" "my_tool.metric" line 10000 1
        DIMENSION my_tool_value '' absolute 1 1
_EOF_
    return 0
}

# Get the metric value from the command-line tool and update the chart
my_tool_update() {
    local my_tool_output="$(my_tool)"
    cat <<- _EOF_
        BEGIN my_tool.metric
        SET my_tool_value = $my_tool_output
        END
_EOF_
    return 0
}

# Call the appropriate functions based on the first argument
case "${1}" in
    check)
        my_tool_check
        ;;
    create)
        my_tool_create
        ;;
    update)
        my_tool_update
        ;;
    *)
        exit 1
        ;;
esac
```




In this refactored version, I have made the following changes:

1. Improved the readability of the code by reformatting the heredoc strings.
2. Removed unnecessary comments that were describing the obvious.
3. Ensured consistent indentation throughout the script.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence