diff --git a/clis/mysql/tool.gpt b/clis/mysql/tool.gpt new file mode 100644 index 000000000..8d93582c2 --- /dev/null +++ b/clis/mysql/tool.gpt @@ -0,0 +1,28 @@ +name: mysql +type: context +description: Provides the ability to interact with mysql databases using the mysql cli. +share tools: sys.exec +share credentials: github.com/gptscript-ai/credential as cli.mysql.password with MYSQL_PWD as env and password as field and "Please enter your mysql user's password:" as message +share credentials: github.com/gptscript-ai/credential as cli.mysql.username with MYSQL_USER as env and username as field and "Please enter your mysql username:" as message +share credentials: github.com/gptscript-ai/credential as cli.mysql.hostname with MYSQL_HOST as env and hostname as field and "Please enter your mysql hostname/ip:" as message + +#!/bin/bash + +if ! command -v mysql; then + echo 'The user does not have the mysql cli installed or it is not available on the PATH.' +else + echo 'The user has the mysql cli available. Use it to work with mysql.' + echo 'Always execute mysql statements non-interactively from the CLI using one of two options:' + echo '`-e "${SQL_QUERY}"` for single sql statements' + echo '`< /path/to/script.sql` for longer scripts' + echo 'The password is pre-set using the `$MYSQL_PWD` environment variable' + echo 'The username is pre-set using the `$MYSQL_USER` environment variable. You can pass that to the cli using `-u ${MYSQL_USER}`' + echo 'The hostname/ip is pre-set using the `$MYSQL_HOST` environment variable. You can pass that to the cli using `-h ${MYSQL_HOST}`' + + + echo 'The following text is the help output of the mysql cli:' + echo '```' + mysql --help + echo '```' +fi +