KosmoKrator

data

Mysql CLI for AI Agents

Use the Mysql CLI from KosmoKrator to call Mysql tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

Mysql CLI Setup

Mysql can be configured headlessly with `kosmokrator integrations:configure mysql`.

Install, configure, and verify
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure mysql --set api_key="$MYSQL_API_KEY" --set host="$MYSQL_HOST" --enable --read allow --write ask --json
kosmokrator integrations:doctor mysql --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
api_key MYSQL_API_KEY Secret secret yes API Key
host MYSQL_HOST URL url yes Host URL

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call mysql.mysql_query '{"sql":"example_sql"}' --json
Provider shortcut
kosmo integrations:mysql mysql_query '{"sql":"example_sql"}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs mysql --json
kosmo integrations:docs mysql.mysql_query --json
kosmo integrations:schema mysql.mysql_query --json
kosmo integrations:search "Mysql" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

mysql.mysql_query

Execute a raw SQL query on the MySQL database. Supports SELECT, INSERT, UPDATE, DELETE, and other SQL statements. Use for custom queries, joins, aggregations, and complex data retrieval.

Read read
Parameters
sql
Generic call
kosmo integrations:call mysql.mysql_query '{"sql":"example_sql"}' --json
Shortcut
kosmo integrations:mysql mysql_query '{"sql":"example_sql"}' --json

mysql.mysql_list_databases

List all databases accessible to the authenticated MySQL user. Use this to discover which databases are available before querying or exploring tables.

Read read
Parameters
none
Generic call
kosmo integrations:call mysql.mysql_list_databases '{}' --json
Shortcut
kosmo integrations:mysql mysql_list_databases '{}' --json

mysql.mysql_list_tables

List all tables in a MySQL database. Use this to discover which tables exist before querying or describing their structure.

Read read
Parameters
database
Generic call
kosmo integrations:call mysql.mysql_list_tables '{"database":"example_database"}' --json
Shortcut
kosmo integrations:mysql mysql_list_tables '{"database":"example_database"}' --json

mysql.mysql_describe_table

Get the column structure of a MySQL table. Returns column names, types, nullable status, keys, defaults, and extra info. Use this before inserting or updating data to understand the schema.

Read read
Parameters
database, table
Generic call
kosmo integrations:call mysql.mysql_describe_table '{"database":"example_database","table":"example_table"}' --json
Shortcut
kosmo integrations:mysql mysql_describe_table '{"database":"example_database","table":"example_table"}' --json

mysql.mysql_insert

Insert a new row into a MySQL table. Provide column names and values as key-value pairs. Use mysql_describe_table first to understand the schema if needed.

Write write
Parameters
database, table, data
Generic call
kosmo integrations:call mysql.mysql_insert '{"database":"example_database","table":"example_table","data":"example_data"}' --json
Shortcut
kosmo integrations:mysql mysql_insert '{"database":"example_database","table":"example_table","data":"example_data"}' --json

mysql.mysql_update

Update rows in a MySQL table that match a filter. Provide a filter to identify which rows to update and a data object with the new column values. Use mysql_describe_table first to understand the schema if needed.

Write write
Parameters
database, table, filter, data
Generic call
kosmo integrations:call mysql.mysql_update '{"database":"example_database","table":"example_table","filter":"example_filter","data":"example_data"}' --json
Shortcut
kosmo integrations:mysql mysql_update '{"database":"example_database","table":"example_table","filter":"example_filter","data":"example_data"}' --json

mysql.mysql_delete

Delete rows from a MySQL table that match a filter. Provide a filter with column-value pairs to identify which rows to delete. This action is irreversible — use with caution.

Write write
Parameters
database, table, filter
Generic call
kosmo integrations:call mysql.mysql_delete '{"database":"example_database","table":"example_table","filter":"example_filter"}' --json
Shortcut
kosmo integrations:mysql mysql_delete '{"database":"example_database","table":"example_table","filter":"example_filter"}' --json

mysql.mysql_get_current_user

Get information about the currently authenticated MySQL user. Useful for verifying credentials and connection status.

Read read
Parameters
none
Generic call
kosmo integrations:call mysql.mysql_get_current_user '{}' --json
Shortcut
kosmo integrations:mysql mysql_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

mysql.mysql_query 1 parameters
Schema command
kosmo integrations:schema mysql.mysql_query --json
ParameterTypeRequiredDescription
sql string yes The SQL query to execute (e.g., "SELECT * FROM users WHERE active = 1 LIMIT 10").
mysql.mysql_list_databases 0 parameters
Schema command
kosmo integrations:schema mysql.mysql_list_databases --json
ParameterTypeRequiredDescription
No parameters.
mysql.mysql_list_tables 1 parameters
Schema command
kosmo integrations:schema mysql.mysql_list_tables --json
ParameterTypeRequiredDescription
database string yes The database name (e.g., "my_app").
mysql.mysql_describe_table 2 parameters
Schema command
kosmo integrations:schema mysql.mysql_describe_table --json
ParameterTypeRequiredDescription
database string yes The database name (e.g., "my_app").
table string yes The table name (e.g., "users").
mysql.mysql_insert 3 parameters
Schema command
kosmo integrations:schema mysql.mysql_insert --json
ParameterTypeRequiredDescription
database string yes The database name (e.g., "my_app").
table string yes The table name (e.g., "users").
data object yes Column-value pairs to insert (e.g., {"name": "Alice", "email": "alice@example.com"}).
mysql.mysql_update 4 parameters
Schema command
kosmo integrations:schema mysql.mysql_update --json
ParameterTypeRequiredDescription
database string yes The database name (e.g., "my_app").
table string yes The table name (e.g., "users").
filter object yes Column-value pairs to match rows for update (e.g., {"id": 42}).
data object yes Column-value pairs to update (e.g., {"name": "Bob", "status": "active"}).
mysql.mysql_delete 3 parameters
Schema command
kosmo integrations:schema mysql.mysql_delete --json
ParameterTypeRequiredDescription
database string yes The database name (e.g., "my_app").
table string yes The table name (e.g., "users").
filter object yes Column-value pairs to match rows for deletion (e.g., {"id": 42}).
mysql.mysql_get_current_user 0 parameters
Schema command
kosmo integrations:schema mysql.mysql_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.