diff --git a/skills/cloud-sql-postgres-admin/SKILL.md b/skills/cloud-sql-postgres-admin/SKILL.md index 0d09be9..186fc87 100644 --- a/skills/cloud-sql-postgres-admin/SKILL.md +++ b/skills/cloud-sql-postgres-admin/SKILL.md @@ -27,7 +27,7 @@ Clone an existing Cloud SQL instance into a new instance. The clone can be a dir | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| project | string | The project ID | Yes | | | sourceInstanceName | string | The name of the instance to be cloned. | Yes | | | destinationInstanceName | string | The name of the new instance that will be created by cloning the source instance. | Yes | | | pointInTime | string | The timestamp in RFC 3339 format to which the source instance should be cloned. | No | | @@ -39,13 +39,13 @@ Clone an existing Cloud SQL instance into a new instance. The clone can be a dir ### create_database - +Creates a new database in a Cloud SQL instance. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| project | string | The project ID | Yes | | | instance | string | The ID of the instance where the database will be created. | Yes | | | name | string | The name for the new database. Must be unique within the instance. | Yes | | @@ -54,13 +54,13 @@ Clone an existing Cloud SQL instance into a new instance. The clone can be a dir ### create_instance - +Creates a Postgres instance using `Production` and `Development` presets. For the `Development` template, it chooses a 2 vCPU, 16 GiB RAM, 100 GiB SSD configuration with Non-HA/zonal availability. For the `Production` template, it chooses an 8 vCPU, 64 GiB RAM, 250 GiB SSD configuration with HA/regional availability. The Enterprise Plus edition is used in both cases. The default database version is `POSTGRES_17`. The agent should ask the user if they want to use a different version. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| project | string | The project ID | Yes | | | name | string | The name of the instance | Yes | | | databaseVersion | string | The database version for Postgres. If not specified, defaults to the latest available version (e.g., POSTGRES_17). | No | `POSTGRES_17` | | rootPassword | string | The root password for the instance | Yes | | @@ -71,13 +71,13 @@ Clone an existing Cloud SQL instance into a new instance. The clone can be a dir ### create_user - +Creates a new user in a Cloud SQL instance. Both built-in and IAM users are supported. IAM users require an email account as the user name. IAM is the more secure and recommended way to manage users. The agent should always ask the user what type of user they want to create. For more information, see https://cloud.google.com/sql/docs/postgres/add-manage-iam-users #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| project | string | The project ID | Yes | | | instance | string | The ID of the instance where the user will be created. | Yes | | | name | string | The name for the new user. Must be unique within the instance. | Yes | | | password | string | A secure password for the new user. Not required for IAM users. | No | | @@ -88,13 +88,13 @@ Clone an existing Cloud SQL instance into a new instance. The clone can be a dir ### get_instance - +Gets a particular cloud sql instance. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| projectId | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| projectId | string | The project ID | Yes | | | instanceId | string | The instance ID | Yes | | @@ -108,7 +108,7 @@ Lists all databases for a Cloud SQL instance. | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| project | string | The project ID | Yes | | | instance | string | The instance ID | Yes | | @@ -122,20 +122,20 @@ Lists all type of Cloud SQL instances for a project. | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| project | string | The project ID | Yes | | --- ### wait_for_operation - +This will poll on operations API until the operation is done. For checking operation status we need projectId and operationId. Once instance is created give follow up steps on how to use the variables to bring data plane MCP server up in local and remote setup. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| project | string | The project ID | Yes | | | operation | string | The operation ID | Yes | | diff --git a/skills/cloud-sql-postgres-admin/scripts/clone_instance.js b/skills/cloud-sql-postgres-admin/scripts/clone_instance.js index 5c34f38..279adeb 100755 --- a/skills/cloud-sql-postgres-admin/scripts/clone_instance.js +++ b/skills/cloud-sql-postgres-admin/scripts/clone_instance.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-admin/scripts/create_database.js b/skills/cloud-sql-postgres-admin/scripts/create_database.js index 7b74296..92306af 100755 --- a/skills/cloud-sql-postgres-admin/scripts/create_database.js +++ b/skills/cloud-sql-postgres-admin/scripts/create_database.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-admin/scripts/create_instance.js b/skills/cloud-sql-postgres-admin/scripts/create_instance.js index 00025ad..6efd1d5 100755 --- a/skills/cloud-sql-postgres-admin/scripts/create_instance.js +++ b/skills/cloud-sql-postgres-admin/scripts/create_instance.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-admin/scripts/create_user.js b/skills/cloud-sql-postgres-admin/scripts/create_user.js index 61763cf..82af144 100755 --- a/skills/cloud-sql-postgres-admin/scripts/create_user.js +++ b/skills/cloud-sql-postgres-admin/scripts/create_user.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-admin/scripts/get_instance.js b/skills/cloud-sql-postgres-admin/scripts/get_instance.js index aa6655c..33e7927 100755 --- a/skills/cloud-sql-postgres-admin/scripts/get_instance.js +++ b/skills/cloud-sql-postgres-admin/scripts/get_instance.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-admin/scripts/list_databases.js b/skills/cloud-sql-postgres-admin/scripts/list_databases.js index d6a1b0a..6eeca1e 100755 --- a/skills/cloud-sql-postgres-admin/scripts/list_databases.js +++ b/skills/cloud-sql-postgres-admin/scripts/list_databases.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-admin/scripts/list_instances.js b/skills/cloud-sql-postgres-admin/scripts/list_instances.js index fe97252..3bbedf3 100755 --- a/skills/cloud-sql-postgres-admin/scripts/list_instances.js +++ b/skills/cloud-sql-postgres-admin/scripts/list_instances.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-admin/scripts/wait_for_operation.js b/skills/cloud-sql-postgres-admin/scripts/wait_for_operation.js index 9bbf399..f334722 100755 --- a/skills/cloud-sql-postgres-admin/scripts/wait_for_operation.js +++ b/skills/cloud-sql-postgres-admin/scripts/wait_for_operation.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-data/SKILL.md b/skills/cloud-sql-postgres-data/SKILL.md index e3ce68e..9cc2fef 100644 --- a/skills/cloud-sql-postgres-data/SKILL.md +++ b/skills/cloud-sql-postgres-data/SKILL.md @@ -40,9 +40,9 @@ Lists available user indexes in the database, excluding system schemas (pg_catal | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| schema_name | string | Optional: a text to filter results by schema name. The input is used within a LIKE clause. | No | `` | -| table_name | string | Optional: a text to filter results by table name. The input is used within a LIKE clause. | No | `` | -| index_name | string | Optional: a text to filter results by index name. The input is used within a LIKE clause. | No | `` | +| schema_name | string | Optional: a text to filter results by schema name. The input is used within a LIKE clause. | No | | +| table_name | string | Optional: a text to filter results by table name. The input is used within a LIKE clause. | No | | +| index_name | string | Optional: a text to filter results by index name. The input is used within a LIKE clause. | No | | | only_unused | boolean | Optional: If true, only returns indexes that have never been used. | No | `false` | | limit | integer | Optional: The maximum number of rows to return. Default is 50 | No | `50` | @@ -57,8 +57,8 @@ Lists all schemas in the database ordered by schema name and excluding system an | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| schema_name | string | Optional: A specific schema name pattern to search for. | No | `` | -| owner | string | Optional: A specific schema owner name pattern to search for. | No | `` | +| schema_name | string | Optional: A specific schema name pattern to search for. | No | | +| owner | string | Optional: A specific schema owner name pattern to search for. | No | | | limit | integer | Optional: The maximum number of schemas to return. | No | `10` | @@ -72,8 +72,8 @@ Lists sequences in the database. Returns sequence name, schema name, sequence ow | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| schema_name | string | Optional: A specific schema name pattern to search for. | No | `` | -| sequence_name | string | Optional: A specific sequence name pattern to search for. | No | `` | +| schema_name | string | Optional: A specific schema name pattern to search for. | No | | +| sequence_name | string | Optional: A specific sequence name pattern to search for. | No | | | limit | integer | Optional: The maximum number of rows to return. Default is 50 | No | `50` | @@ -102,7 +102,7 @@ Lists detailed schema information (object type, columns, constraints, indexes, t | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| table_names | string | Optional: A comma-separated list of table names. If empty, details for all tables will be listed. | No | `` | +| table_names | string | Optional: A comma-separated list of table names. If empty, details for all tables will be listed. | No | | | output_format | string | Optional: Use 'simple' for names only or 'detailed' for full info. | No | `detailed` | @@ -116,9 +116,9 @@ Lists all non-internal triggers in a database. Returns trigger name, schema name | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| trigger_name | string | Optional: A specific trigger name pattern to search for. | No | `` | -| schema_name | string | Optional: A specific schema name pattern to search for. | No | `` | -| table_name | string | Optional: A specific table name pattern to search for. | No | `` | +| trigger_name | string | Optional: A specific trigger name pattern to search for. | No | | +| schema_name | string | Optional: A specific schema name pattern to search for. | No | | +| table_name | string | Optional: A specific table name pattern to search for. | No | | | limit | integer | Optional: The maximum number of rows to return. | No | `50` | @@ -132,8 +132,8 @@ Lists views in the database from pg_views with a default limit of 50 rows. Retur | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| view_name | string | Optional: A specific view name to search for. | No | `` | -| schema_name | string | Optional: A specific schema name to search for. | No | `` | +| view_name | string | Optional: A specific view name to search for. | No | | +| schema_name | string | Optional: A specific schema name to search for. | No | | | limit | integer | Optional: The maximum number of rows to return. | No | `50` | diff --git a/skills/cloud-sql-postgres-data/scripts/execute_sql.js b/skills/cloud-sql-postgres-data/scripts/execute_sql.js index b0711f5..827b32a 100755 --- a/skills/cloud-sql-postgres-data/scripts/execute_sql.js +++ b/skills/cloud-sql-postgres-data/scripts/execute_sql.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-data/scripts/list_indexes.js b/skills/cloud-sql-postgres-data/scripts/list_indexes.js index 4bd05b7..adc99a5 100755 --- a/skills/cloud-sql-postgres-data/scripts/list_indexes.js +++ b/skills/cloud-sql-postgres-data/scripts/list_indexes.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-data/scripts/list_schemas.js b/skills/cloud-sql-postgres-data/scripts/list_schemas.js index 75e9c9e..32ef9e0 100755 --- a/skills/cloud-sql-postgres-data/scripts/list_schemas.js +++ b/skills/cloud-sql-postgres-data/scripts/list_schemas.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-data/scripts/list_sequences.js b/skills/cloud-sql-postgres-data/scripts/list_sequences.js index 8886e4f..edac00c 100755 --- a/skills/cloud-sql-postgres-data/scripts/list_sequences.js +++ b/skills/cloud-sql-postgres-data/scripts/list_sequences.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-data/scripts/list_stored_procedure.js b/skills/cloud-sql-postgres-data/scripts/list_stored_procedure.js index e1caba8..14b8eb1 100755 --- a/skills/cloud-sql-postgres-data/scripts/list_stored_procedure.js +++ b/skills/cloud-sql-postgres-data/scripts/list_stored_procedure.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-data/scripts/list_tables.js b/skills/cloud-sql-postgres-data/scripts/list_tables.js index e871600..735edba 100755 --- a/skills/cloud-sql-postgres-data/scripts/list_tables.js +++ b/skills/cloud-sql-postgres-data/scripts/list_tables.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-data/scripts/list_triggers.js b/skills/cloud-sql-postgres-data/scripts/list_triggers.js index 74d85fe..199876a 100755 --- a/skills/cloud-sql-postgres-data/scripts/list_triggers.js +++ b/skills/cloud-sql-postgres-data/scripts/list_triggers.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-data/scripts/list_views.js b/skills/cloud-sql-postgres-data/scripts/list_views.js index c1a55d7..4cbe565 100755 --- a/skills/cloud-sql-postgres-data/scripts/list_views.js +++ b/skills/cloud-sql-postgres-data/scripts/list_views.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-health/SKILL.md b/skills/cloud-sql-postgres-health/SKILL.md index 2a90905..61ca5f9 100644 --- a/skills/cloud-sql-postgres-health/SKILL.md +++ b/skills/cloud-sql-postgres-health/SKILL.md @@ -19,194 +19,108 @@ Note: The scripts automatically load the environment variables from various .env ## Scripts -### get_query_metrics - -Fetches query level cloudmonitoring data (timeseries metrics) for queries running in Postgres instance using a PromQL query. Take projectID and instanceID from the user for which the metrics timeseries data needs to be fetched. -To use this tool, you must provide the Google Cloud `projectId` and a PromQL `query`. - -Generate PromQL `query` for Postgres query metrics. Use the provided metrics and rules to construct queries, Get the labels like `instance_id`, `query_hash` from user intent. If query_hash is provided then use the per_query metrics. Query hash and query id are same. - -Defaults: -1. Interval: Use a default interval of `5m` for `_over_time` aggregation functions unless a different window is specified by the user. - -PromQL Query Examples: -1. Basic Time Series: `avg_over_time({"__name__"="cloudsql.googleapis.com/database/postgresql/insights/aggregate/execution_time","monitored_resource"="cloudsql_instance_database","project_id"="my-projectId","resource_id"="my-projectId:my-instanceId"}[5m])` -2. Top K: `topk(30, avg_over_time({"__name__"="cloudsql.googleapis.com/database/postgresql/insights/aggregate/execution_time","monitored_resource"="cloudsql_instance_database","project_id"="my-projectId","resource_id"="my-projectId:my-instanceId"}[5m]))` -3. Mean: `avg(avg_over_time({"__name__"="cloudsql.googleapis.com/database/postgresql/insights/aggregate/execution_time","monitored_resource"="cloudsql_instance_database","project_id"="my-projectId","resource_id"="my-projectId:my-instanceId"}[5m]))` -4. Minimum: `min(min_over_time({"__name__"="cloudsql.googleapis.com/database/postgresql/insights/aggregate/execution_time","monitored_resource"="cloudsql_instance_database","project_id"="my-projectId","resource_id"="my-projectId:my-instanceId"}[5m]))` -5. Maximum: `max(max_over_time({"__name__"="cloudsql.googleapis.com/database/postgresql/insights/aggregate/execution_time","monitored_resource"="cloudsql_instance_database","project_id"="my-projectId","resource_id"="my-projectId:my-instanceId"}[5m]))` -6. Sum: `sum(avg_over_time({"__name__"="cloudsql.googleapis.com/database/postgresql/insights/aggregate/execution_time","monitored_resource"="cloudsql_instance_database","project_id"="my-projectId","resource_id"="my-projectId:my-instanceId"}[5m]))` -7. Count streams: `count(avg_over_time({"__name__"="cloudsql.googleapis.com/database/postgresql/insights/aggregate/execution_time","monitored_resource"="cloudsql_instance_database","project_id"="my-projectId","resource_id"="my-projectId:my-instanceId"}[5m]))` -8. Percentile with groupby on resource_id, database: `quantile by ("resource_id","database")(0.99,avg_over_time({"__name__"="cloudsql.googleapis.com/database/postgresql/insights/aggregate/execution_time","monitored_resource"="cloudsql_instance_database","project_id"="my-projectId","resource_id"="my-projectId:my-instanceId"}[5m]))` - -Available Metrics List: metricname. description. monitored resource. labels. resource_id label format is `project_id:instance_id` which is actually instance id only. aggregate is the aggregated values for all query stats, Use aggregate metrics if query id is not provided. For perquery metrics do not fetch querystring unless specified by user specifically. Have the aggregation on query hash to avoid fetching the querystring. Do not use latency metrics for anything. -1. `cloudsql.googleapis.com/database/postgresql/insights/aggregate/latencies`: Aggregated query latency distribution. `cloudsql_instance_database`. `user`, `client_addr`, `project_id`, `resource_id`. -2. `cloudsql.googleapis.com/database/postgresql/insights/aggregate/execution_time`: Accumulated aggregated query execution time since the last sample. `cloudsql_instance_database`. `user`, `client_addr`, `project_id`, `resource_id`. -3. `cloudsql.googleapis.com/database/postgresql/insights/aggregate/io_time`: Accumulated aggregated IO time since the last sample. `cloudsql_instance_database`. `user`, `client_addr`, `io_type`, `project_id`, `resource_id`. -4. `cloudsql.googleapis.com/database/postgresql/insights/aggregate/lock_time`: Accumulated aggregated lock wait time since the last sample. `cloudsql_instance_database`. `user`, `client_addr`, `lock_type`, `project_id`, `resource_id`. -5. `cloudsql.googleapis.com/database/postgresql/insights/aggregate/row_count`: Aggregated number of retrieved or affected rows since the last sample. `cloudsql_instance_database`. `user`, `client_addr`, `project_id`, `resource_id`. -6. `cloudsql.googleapis.com/database/postgresql/insights/aggregate/shared_blk_access_count`: Aggregated shared blocks accessed by statement execution. `cloudsql_instance_database`. `user`, `client_addr`, `access_type`, `project_id`, `resource_id`. -7. `cloudsql.googleapis.com/database/postgresql/insights/perquery/latencies`: Per query latency distribution. `cloudsql_instance_database`. `user`, `client_addr`, `querystring`, `query_hash`, `project_id`, `resource_id`. -8. `cloudsql.googleapis.com/database/postgresql/insights/perquery/execution_time`: Accumulated execution times per user per database per query. `cloudsql_instance_database`. `user`, `client_addr`, `querystring`, `query_hash`, `project_id`, `resource_id`. -9. `cloudsql.googleapis.com/database/postgresql/insights/perquery/io_time`: Accumulated IO time since the last sample per query. `cloudsql_instance_database`. `user`, `client_addr`, `io_type`, `querystring`, `query_hash`, `project_id`, `resource_id`. -10. `cloudsql.googleapis.com/database/postgresql/insights/perquery/lock_time`: Accumulated lock wait time since the last sample per query. `cloudsql_instance_database`. `user`, `client_addr`, `lock_type`, `querystring`, `query_hash`, `project_id`, `resource_id`. -11. `cloudsql.googleapis.com/database/postgresql/insights/perquery/row_count`: The number of retrieved or affected rows since the last sample per query. `cloudsql_instance_database`. `user`, `client_addr`, `querystring`, `query_hash`, `project_id`, `resource_id`. -12. `cloudsql.googleapis.com/database/postgresql/insights/perquery/shared_blk_access_count`: Shared blocks accessed by statement execution per query. `cloudsql_instance_database`. `user`, `client_addr`, `access_type`, `querystring`, `query_hash`, `project_id`, `resource_id`. -13. `cloudsql.googleapis.com/database/postgresql/insights/pertag/latencies`: Query latency distribution. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `tag_hash`, `project_id`, `resource_id`. -14. `cloudsql.googleapis.com/database/postgresql/insights/pertag/execution_time`: Accumulated execution times since the last sample. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `tag_hash`, `project_id`, `resource_id`. -15. `cloudsql.googleapis.com/database/postgresql/insights/pertag/io_time`: Accumulated IO time since the last sample per tag. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `io_type`, `tag_hash`, `project_id`, `resource_id`. -16. `cloudsql.googleapis.com/database/postgresql/insights/pertag/lock_time`: Accumulated lock wait time since the last sample per tag. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `lock_type`, `tag_hash`, `project_id`, `resource_id`. -17. `cloudsql.googleapis.com/database/postgresql/insights/pertag/shared_blk_access_count`: Shared blocks accessed by statement execution per tag. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `access_type`, `tag_hash`, `project_id`, `resource_id`. -18. `cloudsql.googleapis.com/database/postgresql/insights/pertag/row_count`: The number of retrieved or affected rows since the last sample per tag. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `tag_hash`, `project_id`, `resource_id`. +### database_overview +Fetches the current state of the PostgreSQL server, returning the version, whether it's a replica, uptime duration, maximum connection limit, number of current connections, number of active connections, and the percentage of connections in use. -#### Parameters - -| Name | Type | Description | Required | Default | -| :--- | :--- | :--- | :--- | :--- | -| projectId | string | The Id of the Google Cloud project. | Yes | | -| query | string | The promql query to execute. | Yes | | --- -### get_query_plan +### get_column_cardinality -Generate a PostgreSQL EXPLAIN plan in JSON format for a single SQL statement—without executing it. This returns the optimizer's estimated plan, costs, and rows (no ANALYZE, no extra options). Use in production safely for plan inspection, regression checks, and query tuning workflows. +Estimates the number of unique values (cardinality) quickly for one or all columns in a specific PostgreSQL table by using the database's internal statistics, returning the results in descending order of estimated cardinality. Please run ANALYZE on the table before using this tool to get accurate results. The tool returns the column_name and the estimated_cardinality. If the column_name is not provided, the tool returns all columns along with their estimated cardinality. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| query | string | The SQL statement for which you want to generate plan (omit the EXPLAIN keyword). | Yes | | +| schema_name | string | Optional: The schema name in which the table is present. | No | | +| table_name | string | Required: The table name in which the column is present. | Yes | | +| column_name | string | Optional: The column name for which the cardinality is to be found. If not provided, cardinality for all columns will be returned. | No | | --- -### get_system_metrics - -Fetches system level cloudmonitoring data (timeseries metrics) for a Postgres instance using a PromQL query. Take projectId and instanceId from the user for which the metrics timeseries data needs to be fetched. -To use this tool, you must provide the Google Cloud `projectId` and a PromQL `query`. - -Generate PromQL `query` for Postgres system metrics. Use the provided metrics and rules to construct queries, Get the labels like `instance_id` from user intent. - -Defaults: -1. Interval: Use a default interval of `5m` for `_over_time` aggregation functions unless a different window is specified by the user. - -PromQL Query Examples: -1. Basic Time Series: `avg_over_time({"__name__"="cloudsql.googleapis.com/database/cpu/utilization","monitored_resource"="cloudsql_database","project_id"="my-projectId","database_id"="my-projectId:my-instanceId"}[5m])` -2. Top K: `topk(30, avg_over_time({"__name__"="cloudsql.googleapis.com/database/cpu/utilization","monitored_resource"="cloudsql_database","project_id"="my-projectId","database_id"="my-projectId:my-instanceId"}[5m]))` -3. Mean: `avg(avg_over_time({"__name__"="cloudsql.googleapis.com/database/cpu/utilization","monitored_resource"="cloudsql_database","project_id"="my-projectId","database_id"="my-projectId:my-instanceId"}[5m]))` -4. Minimum: `min(min_over_time({"__name__"="cloudsql.googleapis.com/database/cpu/utilization","monitored_resource"="cloudsql_database","project_id"="my-projectId","database_id"="my-projectId:my-instanceId"}[5m]))` -5. Maximum: `max(max_over_time({"__name__"="cloudsql.googleapis.com/database/cpu/utilization","monitored_resource"="cloudsql_database","project_id"="my-projectId","database_id"="my-projectId:my-instanceId"}[5m]))` -6. Sum: `sum(avg_over_time({"__name__"="cloudsql.googleapis.com/database/cpu/utilization","monitored_resource"="cloudsql_database","project_id"="my-projectId","database_id"="my-projectId:my-instanceId"}[5m]))` -7. Count streams: `count(avg_over_time({"__name__"="cloudsql.googleapis.com/database/cpu/utilization","monitored_resource"="cloudsql_database","project_id"="my-projectId","database_id"="my-projectId:my-instanceId"}[5m]))` -8. Percentile with groupby on database_id: `quantile by ("database_id")(0.99,avg_over_time({"__name__"="cloudsql.googleapis.com/database/cpu/utilization","monitored_resource"="cloudsql_database","project_id"="my-projectId","database_id"="my-projectId:my-instanceId"}[5m]))` - -Available Metrics List: metricname. description. monitored resource. labels. database_id is actually the instance id and the format is `project_id:instance_id`. -1. `cloudsql.googleapis.com/database/postgresql/new_connection_count`: Count of new connections added to the postgres instance. `cloudsql_database`. `database`, `project_id`, `database_id`. -2. `cloudsql.googleapis.com/database/postgresql/backends_in_wait`: Number of backends in wait in postgres instance. `cloudsql_database`. `backend_type`, `wait_event`, `wait_event_type`, `project_id`, `database_id`. -3. `cloudsql.googleapis.com/database/postgresql/transaction_count`: Delta count of number of transactions. `cloudsql_database`. `database`, `transaction_type`, `project_id`, `database_id`. -4. `cloudsql.googleapis.com/database/memory/components`: Memory stats components in percentage as usage, cache and free memory for the database. `cloudsql_database`. `component`, `project_id`, `database_id`. -5. `cloudsql.googleapis.com/database/postgresql/external_sync/max_replica_byte_lag`: Replication lag in bytes for Postgres External Server (ES) replicas. Aggregated across all DBs on the replica. `cloudsql_database`. `project_id`, `database_id`. -6. `cloudsql.googleapis.com/database/cpu/utilization`: Current CPU utilization represented as a percentage of the reserved CPU that is currently in use. Values are typically numbers between 0.0 and 1.0 (but might exceed 1.0). Charts display the values as a percentage between 0% and 100% (or more). `cloudsql_database`. `project_id`, `database_id`. -7. `cloudsql.googleapis.com/database/disk/bytes_used_by_data_type`: Data utilization in bytes. `cloudsql_database`. `data_type`, `project_id`, `database_id`. -8. `cloudsql.googleapis.com/database/disk/read_ops_count`: Delta count of data disk read IO operations. `cloudsql_database`. `project_id`, `database_id`. -9. `cloudsql.googleapis.com/database/disk/write_ops_count`: Delta count of data disk write IO operations. `cloudsql_database`. `project_id`, `database_id`. -10. `cloudsql.googleapis.com/database/postgresql/num_backends_by_state`: Number of connections to the Cloud SQL PostgreSQL instance, grouped by its state. `cloudsql_database`. `database`, `state`, `project_id`, `database_id`. -11. `cloudsql.googleapis.com/database/postgresql/num_backends`: Number of connections to the Cloud SQL PostgreSQL instance. `cloudsql_database`. `database`, `project_id`, `database_id`. -12. `cloudsql.googleapis.com/database/network/received_bytes_count`: Delta count of bytes received through the network. `cloudsql_database`. `project_id`, `database_id`. -13. `cloudsql.googleapis.com/database/network/sent_bytes_count`: Delta count of bytes sent through the network. `cloudsql_database`. `destination`, `project_id`, `database_id`. -14. `cloudsql.googleapis.com/database/postgresql/deadlock_count`: Number of deadlocks detected for this database. `cloudsql_database`. `database`, `project_id`, `database_id`. -15. `cloudsql.googleapis.com/database/postgresql/blocks_read_count`: Number of disk blocks read by this database. The source field distingushes actual reads from disk versus reads from buffer cache. `cloudsql_database`. `database`, `source`, `project_id`, `database_id`. -16. `cloudsql.googleapis.com/database/postgresql/tuples_processed_count`: Number of tuples(rows) processed for a given database for operations like insert, update or delete. `cloudsql_database`. `operation_type`, `database`, `project_id`, `database_id`. -17. `cloudsql.googleapis.com/database/postgresql/tuple_size`: Number of tuples (rows) in the database. `cloudsql_database`. `database`, `tuple_state`, `project_id`, `database_id`. -18. `cloudsql.googleapis.com/database/postgresql/vacuum/oldest_transaction_age`: Age of the oldest transaction yet to be vacuumed in the Cloud SQL PostgreSQL instance, measured in number of transactions that have happened since the oldest transaction. `cloudsql_database`. `oldest_transaction_type`, `project_id`, `database_id`. -19. `cloudsql.googleapis.com/database/replication/log_archive_success_count`: Number of successful attempts for archiving replication log files. `cloudsql_database`. `project_id`, `database_id`. -20. `cloudsql.googleapis.com/database/replication/log_archive_failure_count`: Number of failed attempts for archiving replication log files. `cloudsql_database`. `project_id`, `database_id`. -21. `cloudsql.googleapis.com/database/postgresql/transaction_id_utilization`: Current utilization represented as a percentage of transaction IDs consumed by the Cloud SQL PostgreSQL instance. Values are typically numbers between 0.0 and 1.0. Charts display the values as a percentage between 0% and 100% . `cloudsql_database`. `project_id`, `database_id`. -22. `cloudsql.googleapis.com/database/postgresql/num_backends_by_application`: Number of connections to the Cloud SQL PostgreSQL instance, grouped by applications. `cloudsql_database`. `application`, `project_id`, `database_id`. -23. `cloudsql.googleapis.com/database/postgresql/tuples_fetched_count`: Total number of rows fetched as a result of queries per database in the PostgreSQL instance. `cloudsql_database`. `database`, `project_id`, `database_id`. -24. `cloudsql.googleapis.com/database/postgresql/tuples_returned_count`: Total number of rows scanned while processing the queries per database in the PostgreSQL instance. `cloudsql_database`. `database`, `project_id`, `database_id`. -25. `cloudsql.googleapis.com/database/postgresql/temp_bytes_written_count`: Total amount of data (in bytes) written to temporary files by the queries per database. `cloudsql_database`. `database`, `project_id`, `database_id`. -26. `cloudsql.googleapis.com/database/postgresql/temp_files_written_count`: Total number of temporary files used for writing data while performing algorithms such as join and sort. `cloudsql_database`. `database`, `project_id`, `database_id`. +### list_autovacuum_configurations +List PostgreSQL autovacuum-related configurations (name and current setting) from pg_settings. -#### Parameters - -| Name | Type | Description | Required | Default | -| :--- | :--- | :--- | :--- | :--- | -| projectId | string | The Id of the Google Cloud project. | Yes | | -| query | string | The promql query to execute. | Yes | | --- -### list_active_queries +### list_invalid_indexes -List the top N (default 50) currently running queries (state='active') from pg_stat_activity, ordered by longest-running first. Returns pid, user, database, application_name, client_addr, state, wait_event_type/wait_event, backend/xact/query start times, computed query_duration, and the SQL text. +Lists all invalid PostgreSQL indexes which are taking up disk space but are unusable by the query planner. Typically created by failed CREATE INDEX CONCURRENTLY operations. -#### Parameters - -| Name | Type | Description | Required | Default | -| :--- | :--- | :--- | :--- | :--- | -| min_duration | string | Optional: Only show queries running at least this long (e.g., '1 minute', '1 second', '2 seconds'). | No | `1 minute` | -| exclude_application_names | string | Optional: A comma-separated list of application names to exclude from the query results. This is useful for filtering out queries from specific applications (e.g., 'psql', 'pgAdmin', 'DBeaver'). The match is case-sensitive. Whitespace around commas and names is automatically handled. If this parameter is omitted, no applications are excluded. | No | `` | -| limit | integer | Optional: The maximum number of rows to return. | No | `50` | --- -### list_database_stats - +### list_pg_settings +Lists configuration parameters for the postgres server ordered lexicographically, with a default limit of 50 rows. It returns the parameter name, its current setting, unit of measurement, a short description, the source of the current setting (e.g., default, configuration file, session), and whether a restart is required when the parameter value is changed. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| database_name | string | Optional: A specific database name pattern to search for. | No | `` | -| include_templates | boolean | Optional: Whether to include template databases in the results. | No | `false` | -| database_owner | string | Optional: A specific database owner name pattern to search for. | No | `` | -| default_tablespace | string | Optional: A specific default tablespace name pattern to search for. | No | `` | -| order_by | string | Optional: The field to order the results by. Valid values are 'size' and 'commit'. | No | `` | -| limit | integer | Optional: The maximum number of rows to return. | No | `10` | +| setting_name | string | Optional: A specific configuration parameter name pattern to search for. | No | | +| limit | integer | Optional: The maximum number of rows to return. | No | `50` | --- -### list_locks +### list_table_stats + +Lists the user table statistics in the database ordered by number of + sequential scans with a default limit of 50 rows. Returns the following + columns: schema name, table name, table size in bytes, number of + sequential scans, number of index scans, idx_scan_ratio_percent (showing + the percentage of total scans that utilized an index, where a low ratio + indicates missing or ineffective indexes), number of live rows, number + of dead rows, dead_row_ratio_percent (indicating potential table bloat), + total number of rows inserted, updated, and deleted, the timestamps + for the last_vacuum, last_autovacuum, and last_autoanalyze operations. -Identifies all locks held by active processes showing the process ID, user, query text, and an aggregated list of all transactions and specific locks (relation, mode, grant status) associated with each process. +#### Parameters +| Name | Type | Description | Required | Default | +| :--- | :--- | :--- | :--- | :--- | +| schema_name | string | Optional: A specific schema name to filter by | No | | +| table_name | string | Optional: A specific table name to filter by | No | | +| owner | string | Optional: A specific owner to filter by | No | | +| sort_by | string | Optional: The column to sort by | No | | +| limit | integer | Optional: The maximum number of results to return | No | `50` | --- -### list_query_stats +### list_tablespaces -Lists performance statistics for executed queries ordered by total time, filtering by database name pattern if provided. This tool requires the pg_stat_statements extension to be installed. The tool returns the database name, query text, execution count, timing metrics (total, min, max, mean), rows affected, and buffer cache I/O statistics (hits and reads). +Lists all tablespaces in the database. Returns the tablespace name, owner name, size in bytes(if the current user has CREATE privileges on the tablespace, otherwise NULL), internal object ID, the access control list regarding permissions, and any specific tablespace options. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| database_name | string | Optional: The database name to list query stats for. | No | `` | -| limit | integer | Optional: The maximum number of results to return. Defaults to 50. | No | `50` | +| tablespace_name | string | Optional: a text to filter results by tablespace name. The input is used within a LIKE clause. | No | | +| limit | integer | Optional: The maximum number of rows to return. | No | `50` | --- -### long_running_transactions +### list_top_bloated_tables + +List the top tables by dead-tuple (approximate bloat signal), returning schema, table, live/dead tuples, percentage, and last vacuum/analyze times. -Identifies and lists database transactions that exceed a specified time limit. For each of the long running transactions, the output contains the process id, database name, user name, application name, client address, state, connection age, transaction age, query age, last activity age, wait event type, wait event, and query string. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| min_duration | string | Optional: Only show transactions running at least this long (e.g., '1 minute', '15 minutes', '30 seconds'). | No | `5 minutes` | -| limit | integer | Optional: The maximum number of long-running transactions to return. Defaults to 20. | No | `20` | +| limit | integer | The maximum number of results to return. | No | `50` | --- diff --git a/skills/cloud-sql-postgres-health/scripts/database_overview.js b/skills/cloud-sql-postgres-health/scripts/database_overview.js new file mode 100755 index 0000000..3cbd5ad --- /dev/null +++ b/skills/cloud-sql-postgres-health/scripts/database_overview.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "database_overview"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-health/scripts/get_column_cardinality.js b/skills/cloud-sql-postgres-health/scripts/get_column_cardinality.js new file mode 100755 index 0000000..84886ce --- /dev/null +++ b/skills/cloud-sql-postgres-health/scripts/get_column_cardinality.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "get_column_cardinality"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-health/scripts/list_autovacuum_configurations.js b/skills/cloud-sql-postgres-health/scripts/list_autovacuum_configurations.js new file mode 100755 index 0000000..17643b0 --- /dev/null +++ b/skills/cloud-sql-postgres-health/scripts/list_autovacuum_configurations.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "list_autovacuum_configurations"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-health/scripts/list_invalid_indexes.js b/skills/cloud-sql-postgres-health/scripts/list_invalid_indexes.js new file mode 100755 index 0000000..89f6c5c --- /dev/null +++ b/skills/cloud-sql-postgres-health/scripts/list_invalid_indexes.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "list_invalid_indexes"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-health/scripts/list_pg_settings.js b/skills/cloud-sql-postgres-health/scripts/list_pg_settings.js new file mode 100755 index 0000000..7d9bcd7 --- /dev/null +++ b/skills/cloud-sql-postgres-health/scripts/list_pg_settings.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "list_pg_settings"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-health/scripts/list_table_stats.js b/skills/cloud-sql-postgres-health/scripts/list_table_stats.js new file mode 100755 index 0000000..c6c588f --- /dev/null +++ b/skills/cloud-sql-postgres-health/scripts/list_table_stats.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "list_table_stats"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-health/scripts/list_tablespaces.js b/skills/cloud-sql-postgres-health/scripts/list_tablespaces.js new file mode 100755 index 0000000..257e763 --- /dev/null +++ b/skills/cloud-sql-postgres-health/scripts/list_tablespaces.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "list_tablespaces"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-health/scripts/list_top_bloated_tables.js b/skills/cloud-sql-postgres-health/scripts/list_top_bloated_tables.js new file mode 100755 index 0000000..423180e --- /dev/null +++ b/skills/cloud-sql-postgres-health/scripts/list_top_bloated_tables.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "list_top_bloated_tables"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-lifecycle/SKILL.md b/skills/cloud-sql-postgres-lifecycle/SKILL.md index 9f79412..26f43c8 100644 --- a/skills/cloud-sql-postgres-lifecycle/SKILL.md +++ b/skills/cloud-sql-postgres-lifecycle/SKILL.md @@ -27,7 +27,7 @@ Creates a backup on a Cloud SQL instance. | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| project | string | The project ID | Yes | | | instance | string | Cloud SQL instance ID. This does not include the project ID. | Yes | | | location | string | Location of the backup run. | No | | | backup_description | string | The description of this backup run. | No | | @@ -45,13 +45,13 @@ Fetches the current state of the PostgreSQL server, returning the version, wheth ### get_instance - +Gets a particular cloud sql instance. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| projectId | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| projectId | string | The project ID | Yes | | | instanceId | string | The instance ID | Yes | | @@ -65,7 +65,7 @@ Lists all type of Cloud SQL instances for a project. | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| project | string | The project ID | Yes | | --- @@ -96,7 +96,7 @@ Restores a backup on a Cloud SQL instance. | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| target_project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| target_project | string | The project ID | Yes | | | target_instance | string | Cloud SQL instance ID of the target instance. This does not include the project ID. | Yes | | | backup_id | string | Identifier of the backup being restored. Can be a BackupRun ID, backup name, or BackupDR backup name. Use the full backup ID as provided, do not try to parse it | Yes | | | source_project | string | GCP project ID of the instance that the backup belongs to. Only required if the backup_id is a BackupRun ID. | No | | @@ -107,13 +107,13 @@ Restores a backup on a Cloud SQL instance. ### wait_for_operation - +This will poll on operations API until the operation is done. For checking operation status we need projectId and operationId. Once instance is created give follow up steps on how to use the variables to bring data plane MCP server up in local and remote setup. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| project | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| project | string | The project ID | Yes | | | operation | string | The operation ID | Yes | | diff --git a/skills/cloud-sql-postgres-lifecycle/scripts/create_backup.js b/skills/cloud-sql-postgres-lifecycle/scripts/create_backup.js index 87c2f06..154242f 100755 --- a/skills/cloud-sql-postgres-lifecycle/scripts/create_backup.js +++ b/skills/cloud-sql-postgres-lifecycle/scripts/create_backup.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-lifecycle/scripts/database_overview.js b/skills/cloud-sql-postgres-lifecycle/scripts/database_overview.js index db64594..3cbd5ad 100755 --- a/skills/cloud-sql-postgres-lifecycle/scripts/database_overview.js +++ b/skills/cloud-sql-postgres-lifecycle/scripts/database_overview.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-lifecycle/scripts/get_instance.js b/skills/cloud-sql-postgres-lifecycle/scripts/get_instance.js index aa6655c..33e7927 100755 --- a/skills/cloud-sql-postgres-lifecycle/scripts/get_instance.js +++ b/skills/cloud-sql-postgres-lifecycle/scripts/get_instance.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-lifecycle/scripts/list_instances.js b/skills/cloud-sql-postgres-lifecycle/scripts/list_instances.js index fe97252..3bbedf3 100755 --- a/skills/cloud-sql-postgres-lifecycle/scripts/list_instances.js +++ b/skills/cloud-sql-postgres-lifecycle/scripts/list_instances.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-lifecycle/scripts/postgres_upgrade_precheck.js b/skills/cloud-sql-postgres-lifecycle/scripts/postgres_upgrade_precheck.js index 1695cb0..32eecc2 100755 --- a/skills/cloud-sql-postgres-lifecycle/scripts/postgres_upgrade_precheck.js +++ b/skills/cloud-sql-postgres-lifecycle/scripts/postgres_upgrade_precheck.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-lifecycle/scripts/restore_backup.js b/skills/cloud-sql-postgres-lifecycle/scripts/restore_backup.js index 24f4e3f..d213eed 100755 --- a/skills/cloud-sql-postgres-lifecycle/scripts/restore_backup.js +++ b/skills/cloud-sql-postgres-lifecycle/scripts/restore_backup.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-lifecycle/scripts/wait_for_operation.js b/skills/cloud-sql-postgres-lifecycle/scripts/wait_for_operation.js index 9bbf399..f334722 100755 --- a/skills/cloud-sql-postgres-lifecycle/scripts/wait_for_operation.js +++ b/skills/cloud-sql-postgres-lifecycle/scripts/wait_for_operation.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-monitor/SKILL.md b/skills/cloud-sql-postgres-monitor/SKILL.md index 393fc61..434fd0f 100644 --- a/skills/cloud-sql-postgres-monitor/SKILL.md +++ b/skills/cloud-sql-postgres-monitor/SKILL.md @@ -151,7 +151,7 @@ List the top N (default 50) currently running queries (state='active') from pg_s | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | | min_duration | string | Optional: Only show queries running at least this long (e.g., '1 minute', '1 second', '2 seconds'). | No | `1 minute` | -| exclude_application_names | string | Optional: A comma-separated list of application names to exclude from the query results. This is useful for filtering out queries from specific applications (e.g., 'psql', 'pgAdmin', 'DBeaver'). The match is case-sensitive. Whitespace around commas and names is automatically handled. If this parameter is omitted, no applications are excluded. | No | `` | +| exclude_application_names | string | Optional: A comma-separated list of application names to exclude from the query results. This is useful for filtering out queries from specific applications (e.g., 'psql', 'pgAdmin', 'DBeaver'). The match is case-sensitive. Whitespace around commas and names is automatically handled. If this parameter is omitted, no applications are excluded. | No | | | limit | integer | Optional: The maximum number of rows to return. | No | `50` | @@ -159,17 +159,17 @@ List the top N (default 50) currently running queries (state='active') from pg_s ### list_database_stats - +Lists the key performance and activity statistics for each PostgreSQL databasein the instance, offering insights into cache efficiency, transaction throughputrow-level activity, temporary file usage, and contention. It returns: the database name, whether the database is connectable, database owner, default tablespace name, the percentage of data blocks found in the buffer cache rather than being read from disk (a higher value indicates better cache performance), the total number of disk blocks read from disk, the total number of times disk blocks were found already in the cache; the total number of committed transactions, the total number of rolled back transactions, the percentage of rolled back transactions compared to the total number of completed transactions, the total number of rows returned by queries, the total number of live rows fetched by scans, the total number of rows inserted, the total number of rows updated, the total number of rows deleted, the number of temporary files created by queries, the total size of all temporary files created by queries in bytes, the number of query cancellations due to conflicts with recovery, the number of deadlocks detected, the current number of active connections to the database, the timestamp of the last statistics reset, and total database size in bytes. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| database_name | string | Optional: A specific database name pattern to search for. | No | `` | +| database_name | string | Optional: A specific database name pattern to search for. | No | | | include_templates | boolean | Optional: Whether to include template databases in the results. | No | `false` | -| database_owner | string | Optional: A specific database owner name pattern to search for. | No | `` | -| default_tablespace | string | Optional: A specific default tablespace name pattern to search for. | No | `` | -| order_by | string | Optional: The field to order the results by. Valid values are 'size' and 'commit'. | No | `` | +| database_owner | string | Optional: A specific database owner name pattern to search for. | No | | +| default_tablespace | string | Optional: A specific default tablespace name pattern to search for. | No | | +| order_by | string | Optional: The field to order the results by. Valid values are 'size' and 'commit'. | No | | | limit | integer | Optional: The maximum number of rows to return. | No | `10` | @@ -191,7 +191,7 @@ Lists performance statistics for executed queries ordered by total time, filteri | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| database_name | string | Optional: The database name to list query stats for. | No | `` | +| database_name | string | Optional: The database name to list query stats for. | No | | | limit | integer | Optional: The maximum number of results to return. Defaults to 50. | No | `50` | diff --git a/skills/cloud-sql-postgres-monitor/scripts/get_query_metrics.js b/skills/cloud-sql-postgres-monitor/scripts/get_query_metrics.js index 507c8f8..1edb96b 100755 --- a/skills/cloud-sql-postgres-monitor/scripts/get_query_metrics.js +++ b/skills/cloud-sql-postgres-monitor/scripts/get_query_metrics.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-monitor/scripts/get_query_plan.js b/skills/cloud-sql-postgres-monitor/scripts/get_query_plan.js index df020c8..1f0ccb4 100755 --- a/skills/cloud-sql-postgres-monitor/scripts/get_query_plan.js +++ b/skills/cloud-sql-postgres-monitor/scripts/get_query_plan.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-monitor/scripts/get_system_metrics.js b/skills/cloud-sql-postgres-monitor/scripts/get_system_metrics.js index 40fb529..f185e20 100755 --- a/skills/cloud-sql-postgres-monitor/scripts/get_system_metrics.js +++ b/skills/cloud-sql-postgres-monitor/scripts/get_system_metrics.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-monitor/scripts/list_active_queries.js b/skills/cloud-sql-postgres-monitor/scripts/list_active_queries.js index 3b299c8..2b8222d 100755 --- a/skills/cloud-sql-postgres-monitor/scripts/list_active_queries.js +++ b/skills/cloud-sql-postgres-monitor/scripts/list_active_queries.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-monitor/scripts/list_database_stats.js b/skills/cloud-sql-postgres-monitor/scripts/list_database_stats.js index 901c983..c6ce422 100755 --- a/skills/cloud-sql-postgres-monitor/scripts/list_database_stats.js +++ b/skills/cloud-sql-postgres-monitor/scripts/list_database_stats.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-monitor/scripts/list_locks.js b/skills/cloud-sql-postgres-monitor/scripts/list_locks.js index 67d6829..50b2713 100755 --- a/skills/cloud-sql-postgres-monitor/scripts/list_locks.js +++ b/skills/cloud-sql-postgres-monitor/scripts/list_locks.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-monitor/scripts/list_query_stats.js b/skills/cloud-sql-postgres-monitor/scripts/list_query_stats.js index 156f3e5..42816f3 100755 --- a/skills/cloud-sql-postgres-monitor/scripts/list_query_stats.js +++ b/skills/cloud-sql-postgres-monitor/scripts/list_query_stats.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-monitor/scripts/long_running_transactions.js b/skills/cloud-sql-postgres-monitor/scripts/long_running_transactions.js index 616ea1c..4c4a888 100755 --- a/skills/cloud-sql-postgres-monitor/scripts/long_running_transactions.js +++ b/skills/cloud-sql-postgres-monitor/scripts/long_running_transactions.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-replication/SKILL.md b/skills/cloud-sql-postgres-replication/SKILL.md index 7465814..3180479 100644 --- a/skills/cloud-sql-postgres-replication/SKILL.md +++ b/skills/cloud-sql-postgres-replication/SKILL.md @@ -29,13 +29,13 @@ Fetches the current state of the PostgreSQL server, returning the version, wheth ### list_pg_settings - +Lists configuration parameters for the postgres server ordered lexicographically, with a default limit of 50 rows. It returns the parameter name, its current setting, unit of measurement, a short description, the source of the current setting (e.g., default, configuration file, session), and whether a restart is required when the parameter value is changed. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| setting_name | string | Optional: A specific configuration parameter name pattern to search for. | No | `` | +| setting_name | string | Optional: A specific configuration parameter name pattern to search for. | No | | | limit | integer | Optional: The maximum number of rows to return. | No | `50` | @@ -43,15 +43,15 @@ Fetches the current state of the PostgreSQL server, returning the version, wheth ### list_publication_tables - +Lists all publication tables in the database. Returns the publication name, schema name, and table name, along with definition details indicating if it publishes all tables, whether it replicates inserts, updates, deletes, or truncates, and the publication owner. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| table_names | string | Optional: Filters by a comma-separated list of table names. | No | `` | -| publication_names | string | Optional: Filters by a comma-separated list of publication names. | No | `` | -| schema_names | string | Optional: Filters by a comma-separated list of schema names. | No | `` | +| table_names | string | Optional: Filters by a comma-separated list of table names. | No | | +| publication_names | string | Optional: Filters by a comma-separated list of publication names. | No | | +| schema_names | string | Optional: Filters by a comma-separated list of schema names. | No | | | limit | integer | Optional: The maximum number of rows to return. | No | `50` | @@ -73,7 +73,7 @@ Lists all the user-created roles in the instance . It returns the role name, Obj | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| role_name | string | Optional: a text to filter results by role name. The input is used within a LIKE clause. | No | `` | +| role_name | string | Optional: a text to filter results by role name. The input is used within a LIKE clause. | No | | | limit | integer | Optional: The maximum number of rows to return. Default is 10 | No | `50` | diff --git a/skills/cloud-sql-postgres-replication/scripts/database_overview.js b/skills/cloud-sql-postgres-replication/scripts/database_overview.js index db64594..3cbd5ad 100755 --- a/skills/cloud-sql-postgres-replication/scripts/database_overview.js +++ b/skills/cloud-sql-postgres-replication/scripts/database_overview.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-replication/scripts/list_pg_settings.js b/skills/cloud-sql-postgres-replication/scripts/list_pg_settings.js index 41ea69b..7d9bcd7 100755 --- a/skills/cloud-sql-postgres-replication/scripts/list_pg_settings.js +++ b/skills/cloud-sql-postgres-replication/scripts/list_pg_settings.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-replication/scripts/list_publication_tables.js b/skills/cloud-sql-postgres-replication/scripts/list_publication_tables.js index 863192e..1841435 100755 --- a/skills/cloud-sql-postgres-replication/scripts/list_publication_tables.js +++ b/skills/cloud-sql-postgres-replication/scripts/list_publication_tables.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-replication/scripts/list_replication_slots.js b/skills/cloud-sql-postgres-replication/scripts/list_replication_slots.js index f09c135..af13048 100755 --- a/skills/cloud-sql-postgres-replication/scripts/list_replication_slots.js +++ b/skills/cloud-sql-postgres-replication/scripts/list_replication_slots.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-replication/scripts/list_roles.js b/skills/cloud-sql-postgres-replication/scripts/list_roles.js index 3bf2597..472dcd3 100755 --- a/skills/cloud-sql-postgres-replication/scripts/list_roles.js +++ b/skills/cloud-sql-postgres-replication/scripts/list_roles.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-replication/scripts/replication_stats.js b/skills/cloud-sql-postgres-replication/scripts/replication_stats.js index ff6c875..2bef31c 100755 --- a/skills/cloud-sql-postgres-replication/scripts/replication_stats.js +++ b/skills/cloud-sql-postgres-replication/scripts/replication_stats.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-vectorassist/SKILL.md b/skills/cloud-sql-postgres-vectorassist/SKILL.md index 49a3829..0066686 100644 --- a/skills/cloud-sql-postgres-vectorassist/SKILL.md +++ b/skills/cloud-sql-postgres-vectorassist/SKILL.md @@ -1,6 +1,6 @@ --- name: cloud-sql-postgres-vectorassist -description: Use these skills to set up and optimize production-ready vector workloads by simply expressing your intent and performance requirements. +description: Use these skills to set up and optimize production-ready vector workloads by simply expressing your intent and performance requirements --- ## Usage @@ -62,6 +62,19 @@ This tool defines a new vector specification by capturing the user's intent and | tune_vector_index | boolean | Boolean parameter to specify if the auto tuning is required for the index. | No | | +--- + +### delete_spec + +This tool deletes an existing vector specification using its spec_id. Use this tool when a user explicitly requests to delete, remove, or clean up an existing vector specification which was created in the context of the vector assist tools. + +#### Parameters + +| Name | Type | Description | Required | Default | +| :--- | :--- | :--- | :--- | :--- | +| spec_id | string | Unique ID for the vector spec to delete. | Yes | | + + --- ### execute_sql @@ -98,6 +111,52 @@ This tool generates optimized SQL queries for vector search by leveraging the me | iterative_index_search | boolean | Perform iterative index search for filtered queries to ensure enough results are returned. | No | | +--- + +### get_spec + +This tool retrieves the details of an existing vector specification using its unique 'spec_id'. Use this tool to retrieve a vector specification which was created in the context of the vector assist tools. + +#### Parameters + +| Name | Type | Description | Required | Default | +| :--- | :--- | :--- | :--- | :--- | +| spec_id | string | Unique ID for the vector spec. | Yes | | + + +--- + +### improve_query_recall + +Use this tool to troubleshoot and optimize existing vector search workloads when a user reports irrelevant results, poor accuracy, or degraded recall. It determines the optimal tuning parameter (such as ef_search) for an active vector index to improve the search results. The tool outputs an actionable SQL query recommendation to be executed as a next action using the 'execute_sql' tool. + +#### Parameters + +| Name | Type | Description | Required | Default | +| :--- | :--- | :--- | :--- | :--- | +| schema_name | string | Optional parameter: Schema name of the table. | No | | +| table_name | string | Table name experiencing degraded vector search recall. | Yes | | +| vector_column_name | string | Column name containing the vector embeddings. | Yes | | +| index_name | string | Name of the vector index to tune. | Yes | | +| top_k | integer | Optional parameter: Top k value for the vector search. | No | `10` | +| target_recall | float | Optional parameter: Target recall value for search results. | No | `0.95` | +| distance_func | string | Optional parameter: Distance function used for the vector search similarity. | No | `cosine` | + + +--- + +### list_specs + +This tool lists all defined vector specifications for a given table and column name. Use this tool to list vector specifications which were created in the context of the vector assist tools. + +#### Parameters + +| Name | Type | Description | Required | Default | +| :--- | :--- | :--- | :--- | :--- | +| table_name | string | Table name to list vector specifications for. | Yes | | +| column_name | string | Column name to list vector specifications for. | No | | + + --- ### modify_spec diff --git a/skills/cloud-sql-postgres-vectorassist/scripts/apply_spec.js b/skills/cloud-sql-postgres-vectorassist/scripts/apply_spec.js index 4400968..a5e7b97 100755 --- a/skills/cloud-sql-postgres-vectorassist/scripts/apply_spec.js +++ b/skills/cloud-sql-postgres-vectorassist/scripts/apply_spec.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-vectorassist/scripts/define_spec.js b/skills/cloud-sql-postgres-vectorassist/scripts/define_spec.js index 76cf9f6..07d5e4d 100755 --- a/skills/cloud-sql-postgres-vectorassist/scripts/define_spec.js +++ b/skills/cloud-sql-postgres-vectorassist/scripts/define_spec.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-vectorassist/scripts/delete_spec.js b/skills/cloud-sql-postgres-vectorassist/scripts/delete_spec.js new file mode 100755 index 0000000..45ab328 --- /dev/null +++ b/skills/cloud-sql-postgres-vectorassist/scripts/delete_spec.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "delete_spec"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-vectorassist/scripts/execute_sql.js b/skills/cloud-sql-postgres-vectorassist/scripts/execute_sql.js index b0711f5..827b32a 100755 --- a/skills/cloud-sql-postgres-vectorassist/scripts/execute_sql.js +++ b/skills/cloud-sql-postgres-vectorassist/scripts/execute_sql.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-vectorassist/scripts/generate_query.js b/skills/cloud-sql-postgres-vectorassist/scripts/generate_query.js index a1e9d49..a83a1e5 100755 --- a/skills/cloud-sql-postgres-vectorassist/scripts/generate_query.js +++ b/skills/cloud-sql-postgres-vectorassist/scripts/generate_query.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-vectorassist/scripts/get_spec.js b/skills/cloud-sql-postgres-vectorassist/scripts/get_spec.js new file mode 100755 index 0000000..85c113e --- /dev/null +++ b/skills/cloud-sql-postgres-vectorassist/scripts/get_spec.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "get_spec"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-vectorassist/scripts/improve_query_recall.js b/skills/cloud-sql-postgres-vectorassist/scripts/improve_query_recall.js new file mode 100755 index 0000000..26f84b4 --- /dev/null +++ b/skills/cloud-sql-postgres-vectorassist/scripts/improve_query_recall.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "improve_query_recall"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-vectorassist/scripts/list_specs.js b/skills/cloud-sql-postgres-vectorassist/scripts/list_specs.js new file mode 100755 index 0000000..7decc17 --- /dev/null +++ b/skills/cloud-sql-postgres-vectorassist/scripts/list_specs.js @@ -0,0 +1,105 @@ +#!/usr/bin/env node + +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const { spawn, execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const toolName = "list_specs"; +const configArgs = ["--prebuilt", "cloud-sql-postgres"]; + +const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ + 'CLOUD_SQL_POSTGRES_USER', + 'CLOUD_SQL_POSTGRES_PASSWORD', + 'CLOUD_SQL_POSTGRES_IP_TYPE', +]; + + +function mergeEnvVars(env) { + if (process.env.GEMINI_CLI === '1') { + const envPath = path.resolve(__dirname, '../../../.env'); + if (fs.existsSync(envPath)) { + const envContent = fs.readFileSync(envPath, 'utf-8'); + envContent.split('\n').forEach(line => { + const trimmed = line.trim(); + if (trimmed && !trimmed.startsWith('#')) { + const splitIdx = trimmed.indexOf('='); + if (splitIdx !== -1) { + const key = trimmed.slice(0, splitIdx).trim(); + let value = trimmed.slice(splitIdx + 1).trim(); + value = value.replace(/(^['"]|['"]$)/g, ''); + if (env[key] === undefined) { + env[key] = value; + } + } + } + }); + } + } else if (process.env.CLAUDECODE === '1') { + const prefix = 'CLAUDE_PLUGIN_OPTION_'; + for (const key in process.env) { + if (key.startsWith(prefix)) { + env[key.substring(prefix.length)] = process.env[key]; + } + } + } +} + +function prepareEnvironment() { + let env = { ...process.env }; + let userAgent = "skills"; + if (process.env.GEMINI_CLI === '1') { + userAgent = "skills-geminicli"; + } else if (process.env.CLAUDECODE === '1') { + userAgent = "skills-claudecode"; + } else if (process.env.CODEX_CI === '1') { + userAgent = "skills-codex"; + } + mergeEnvVars(env); + + OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => { + if (env[varName] === '') { + delete env[varName]; + } + }); + + + return { env, userAgent }; +} + +function main() { + const { env, userAgent } = prepareEnvironment(); + const args = process.argv.slice(2); + + const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; + const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + + const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); + + + child.on('close', (code) => { + process.exit(code); + }); + + child.on('error', (err) => { + console.error("Error executing toolbox:", err); + process.exit(1); + }); +} + +main(); diff --git a/skills/cloud-sql-postgres-vectorassist/scripts/modify_spec.js b/skills/cloud-sql-postgres-vectorassist/scripts/modify_spec.js index c47de68..b92bef7 100755 --- a/skills/cloud-sql-postgres-vectorassist/scripts/modify_spec.js +++ b/skills/cloud-sql-postgres-vectorassist/scripts/modify_spec.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-view-config/SKILL.md b/skills/cloud-sql-postgres-view-config/SKILL.md index dca778d..197cdad 100644 --- a/skills/cloud-sql-postgres-view-config/SKILL.md +++ b/skills/cloud-sql-postgres-view-config/SKILL.md @@ -29,13 +29,13 @@ Fetches the current state of the PostgreSQL server, returning the version, wheth ### get_instance - +Gets a particular cloud sql instance. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| projectId | string | The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one. | No | | +| projectId | string | The project ID | Yes | | | instanceId | string | The instance ID | Yes | | @@ -67,13 +67,13 @@ List PostgreSQL memory-related configurations (name and current setting) from pg ### list_pg_settings - +Lists configuration parameters for the postgres server ordered lexicographically, with a default limit of 50 rows. It returns the parameter name, its current setting, unit of measurement, a short description, the source of the current setting (e.g., default, configuration file, session), and whether a restart is required when the parameter value is changed. #### Parameters | Name | Type | Description | Required | Default | | :--- | :--- | :--- | :--- | :--- | -| setting_name | string | Optional: A specific configuration parameter name pattern to search for. | No | `` | +| setting_name | string | Optional: A specific configuration parameter name pattern to search for. | No | | | limit | integer | Optional: The maximum number of rows to return. | No | `50` | diff --git a/skills/cloud-sql-postgres-view-config/scripts/database_overview.js b/skills/cloud-sql-postgres-view-config/scripts/database_overview.js index db64594..3cbd5ad 100755 --- a/skills/cloud-sql-postgres-view-config/scripts/database_overview.js +++ b/skills/cloud-sql-postgres-view-config/scripts/database_overview.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-view-config/scripts/get_instance.js b/skills/cloud-sql-postgres-view-config/scripts/get_instance.js index aa6655c..33e7927 100755 --- a/skills/cloud-sql-postgres-view-config/scripts/get_instance.js +++ b/skills/cloud-sql-postgres-view-config/scripts/get_instance.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-view-config/scripts/list_available_extensions.js b/skills/cloud-sql-postgres-view-config/scripts/list_available_extensions.js index 815794b..c49dcd1 100755 --- a/skills/cloud-sql-postgres-view-config/scripts/list_available_extensions.js +++ b/skills/cloud-sql-postgres-view-config/scripts/list_available_extensions.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-view-config/scripts/list_installed_extensions.js b/skills/cloud-sql-postgres-view-config/scripts/list_installed_extensions.js index cf05335..cd364b5 100755 --- a/skills/cloud-sql-postgres-view-config/scripts/list_installed_extensions.js +++ b/skills/cloud-sql-postgres-view-config/scripts/list_installed_extensions.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-view-config/scripts/list_memory_configurations.js b/skills/cloud-sql-postgres-view-config/scripts/list_memory_configurations.js index 50a101a..2dc473f 100755 --- a/skills/cloud-sql-postgres-view-config/scripts/list_memory_configurations.js +++ b/skills/cloud-sql-postgres-view-config/scripts/list_memory_configurations.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/skills/cloud-sql-postgres-view-config/scripts/list_pg_settings.js b/skills/cloud-sql-postgres-view-config/scripts/list_pg_settings.js index 41ea69b..7d9bcd7 100755 --- a/skills/cloud-sql-postgres-view-config/scripts/list_pg_settings.js +++ b/skills/cloud-sql-postgres-view-config/scripts/list_pg_settings.js @@ -87,7 +87,7 @@ function main() { const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx'; const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args; - const npxArgs = ["--yes", "@toolbox-sdk/server@1.1.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; + const npxArgs = ["--yes", "@toolbox-sdk/server@1.5.0", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs]; const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env }); diff --git a/toolbox_version.txt b/toolbox_version.txt index 9084fa2..bc80560 100644 --- a/toolbox_version.txt +++ b/toolbox_version.txt @@ -1 +1 @@ -1.1.0 +1.5.0