8000 chore: add mysql tool by drpebcak · Pull Request #10 · obot-platform/tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: add mysql tool #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions clis/mysql/tool.gpt
Original file line number Diff line number Diff line change
@@ -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

0