KosmoKrator

other

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.

8 functions 5 read 3 write API key auth

Mysql CLI Setup

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

# 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 use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

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

Call Mysql Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call mysql.mysql_query '{
  "sql": "example_sql"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:mysql mysql_query '{
  "sql": "example_sql"
}' --json

Agent Discovery Commands

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

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

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Mysql.

mysql.mysql_query

Read read

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.

Parameters
sql

Generic CLI call

kosmo integrations:call mysql.mysql_query '{"sql":"example_sql"}' --json

Provider shortcut

kosmo integrations:mysql mysql_query '{"sql":"example_sql"}' --json

mysql.mysql_list_databases

Read read

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

Parameters
none

Generic CLI call

kosmo integrations:call mysql.mysql_list_databases '{}' --json

Provider shortcut

kosmo integrations:mysql mysql_list_databases '{}' --json

mysql.mysql_list_tables

Read read

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

Parameters
database

Generic CLI call

kosmo integrations:call mysql.mysql_list_tables '{"database":"example_database"}' --json

Provider shortcut

kosmo integrations:mysql mysql_list_tables '{"database":"example_database"}' --json

mysql.mysql_describe_table

Read read

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.

Parameters
database, table

Generic CLI call

kosmo integrations:call mysql.mysql_describe_table '{"database":"example_database","table":"example_table"}' --json

Provider shortcut

kosmo integrations:mysql mysql_describe_table '{"database":"example_database","table":"example_table"}' --json

mysql.mysql_insert

Write write

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.

Parameters
database, table, data

Generic CLI call

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

Provider shortcut

kosmo integrations:mysql mysql_insert '{"database":"example_database","table":"example_table","data":"example_data"}' --json

mysql.mysql_update

Write write

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.

Parameters
database, table, filter, data

Generic CLI call

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

Provider shortcut

kosmo integrations:mysql mysql_update '{"database":"example_database","table":"example_table","filter":"example_filter","data":"example_data"}' --json

mysql.mysql_delete

Write write

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.

Parameters
database, table, filter

Generic CLI call

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

Provider shortcut

kosmo integrations:mysql mysql_delete '{"database":"example_database","table":"example_table","filter":"example_filter"}' --json

mysql.mysql_get_current_user

Read read

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

Parameters
none

Generic CLI call

kosmo integrations:call mysql.mysql_get_current_user '{}' --json

Provider 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

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.

Operation
Read read
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

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

Operation
Read read
Schema command
kosmo integrations:schema mysql.mysql_list_databases --json
ParameterTypeRequiredDescription
No parameters.

mysql.mysql_list_tables

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

Operation
Read read
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

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.

Operation
Read read
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

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.

Operation
Write write
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": "[email protected]"}).

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.

Operation
Write write
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

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.

Operation
Write write
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

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

Operation
Read read
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.