From b6bc3a79f13787b92a8afc92d11500d0ef951ddf Mon Sep 17 00:00:00 2001 From: Juexin Wang Date: Thu, 27 Aug 2026 14:13:54 -0700 Subject: [PATCH 1/4] feat(plugin): migrate from generated skills to the prebuilt MCP server --- .claude-plugin/plugin.json | 68 +++++- .codex-plugin/.mcp.json | 23 ++ .codex-plugin/plugin.json | 4 +- .github/renovate.json5 | 22 +- .github/workflows/presubmit-tests.yml | 9 +- .../workflows/skills-validate-fallback.yml | 37 ---- .github/workflows/skills-validate.yml | 56 ----- README.md | 97 ++++----- gemini-extension.json | 14 +- mcp.json | 16 ++ mcp_config.json | 14 ++ plugin.json | 62 +++++- skills/cloud-sql-mysql-admin/SKILL.md | 125 ----------- .../scripts/create_database.js | 105 --------- .../scripts/create_instance.js | 105 --------- .../scripts/create_user.js | 105 --------- .../scripts/get_instance.js | 105 --------- .../scripts/list_databases.js | 105 --------- .../scripts/list_instances.js | 105 --------- .../scripts/wait_for_operation.js | 105 --------- skills/cloud-sql-mysql-data/SKILL.md | 75 ------- .../scripts/execute_sql.js | 105 --------- .../scripts/get_query_plan.js | 105 --------- .../scripts/list_active_queries.js | 105 --------- .../scripts/list_tables.js | 105 --------- skills/cloud-sql-mysql-lifecycle/SKILL.md | 113 ---------- .../scripts/clone_instance.js | 105 --------- .../scripts/create_backup.js | 105 --------- .../scripts/get_instance.js | 105 --------- .../scripts/list_instances.js | 105 --------- .../scripts/restore_backup.js | 105 --------- .../scripts/wait_for_operation.js | 105 --------- skills/cloud-sql-mysql-monitor/SKILL.md | 203 ------------------ .../scripts/get_query_metrics.js | 105 --------- .../scripts/get_query_plan.js | 105 --------- .../scripts/get_system_metrics.js | 105 --------- .../scripts/list_active_queries.js | 105 --------- .../scripts/list_table_fragmentation.js | 105 --------- .../scripts/list_table_stats.js | 105 --------- .../list_tables_missing_unique_indexes.js | 105 --------- toolbox_version.txt | 1 - 41 files changed, 263 insertions(+), 3196 deletions(-) create mode 100644 .codex-plugin/.mcp.json delete mode 100644 .github/workflows/skills-validate-fallback.yml delete mode 100644 .github/workflows/skills-validate.yml create mode 100644 mcp.json create mode 100644 mcp_config.json delete mode 100644 skills/cloud-sql-mysql-admin/SKILL.md delete mode 100755 skills/cloud-sql-mysql-admin/scripts/create_database.js delete mode 100755 skills/cloud-sql-mysql-admin/scripts/create_instance.js delete mode 100755 skills/cloud-sql-mysql-admin/scripts/create_user.js delete mode 100755 skills/cloud-sql-mysql-admin/scripts/get_instance.js delete mode 100755 skills/cloud-sql-mysql-admin/scripts/list_databases.js delete mode 100755 skills/cloud-sql-mysql-admin/scripts/list_instances.js delete mode 100755 skills/cloud-sql-mysql-admin/scripts/wait_for_operation.js delete mode 100644 skills/cloud-sql-mysql-data/SKILL.md delete mode 100755 skills/cloud-sql-mysql-data/scripts/execute_sql.js delete mode 100755 skills/cloud-sql-mysql-data/scripts/get_query_plan.js delete mode 100755 skills/cloud-sql-mysql-data/scripts/list_active_queries.js delete mode 100755 skills/cloud-sql-mysql-data/scripts/list_tables.js delete mode 100644 skills/cloud-sql-mysql-lifecycle/SKILL.md delete mode 100755 skills/cloud-sql-mysql-lifecycle/scripts/clone_instance.js delete mode 100755 skills/cloud-sql-mysql-lifecycle/scripts/create_backup.js delete mode 100755 skills/cloud-sql-mysql-lifecycle/scripts/get_instance.js delete mode 100755 skills/cloud-sql-mysql-lifecycle/scripts/list_instances.js delete mode 100755 skills/cloud-sql-mysql-lifecycle/scripts/restore_backup.js delete mode 100755 skills/cloud-sql-mysql-lifecycle/scripts/wait_for_operation.js delete mode 100644 skills/cloud-sql-mysql-monitor/SKILL.md delete mode 100755 skills/cloud-sql-mysql-monitor/scripts/get_query_metrics.js delete mode 100755 skills/cloud-sql-mysql-monitor/scripts/get_query_plan.js delete mode 100755 skills/cloud-sql-mysql-monitor/scripts/get_system_metrics.js delete mode 100755 skills/cloud-sql-mysql-monitor/scripts/list_active_queries.js delete mode 100755 skills/cloud-sql-mysql-monitor/scripts/list_table_fragmentation.js delete mode 100755 skills/cloud-sql-mysql-monitor/scripts/list_table_stats.js delete mode 100755 skills/cloud-sql-mysql-monitor/scripts/list_tables_missing_unique_indexes.js delete mode 100644 toolbox_version.txt diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 5e76d9c..5989c19 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -7,7 +7,71 @@ "email": "data-cloud-ai-integrations@google.com" }, "homepage": "https://cloud.google.com/sql", - "license": "Apache-2.0", "repository": "https://github.com/gemini-cli-extensions/cloud-sql-mysql", - "skills": "./skills/" + "license": "Apache-2.0", + "userConfig": { + "cloud_sql_mysql_project": { + "title": "Project ID", + "description": "ID of the Google Cloud project", + "type": "string", + "sensitive": false + }, + "cloud_sql_mysql_region": { + "title": "Region", + "description": "Region of the Cloud SQL instance", + "type": "string", + "sensitive": false + }, + "cloud_sql_mysql_instance": { + "title": "Instance", + "description": "Name of the Cloud SQL instance", + "type": "string", + "sensitive": false + }, + "cloud_sql_mysql_database": { + "title": "Database", + "description": "Name of the database", + "type": "string", + "sensitive": false + }, + "cloud_sql_mysql_user": { + "title": "User", + "description": "(Optional) Username of the database user (Default: IAM user)", + "type": "string", + "sensitive": false + }, + "cloud_sql_mysql_password": { + "title": "Password", + "description": "(Optional) Password of the database user (Default: IAM user)", + "type": "string", + "sensitive": false + }, + "cloud_sql_mysql_ip_type": { + "title": "IP Type", + "description": "(Optional) Type of the IP address: PUBLIC, PRIVATE, or PSC (Default: Public)", + "type": "string", + "sensitive": false + } + }, + "mcpServers": { + "cloud-sql-mysql": { + "command": "npx", + "args": [ + "-y", + "@toolbox-sdk/server@1.9.0", + "--prebuilt", + "cloud-sql-mysql", + "--stdio" + ], + "env": { + "CLOUD_SQL_MYSQL_PROJECT": "${user_config.cloud_sql_mysql_project}", + "CLOUD_SQL_MYSQL_REGION": "${user_config.cloud_sql_mysql_region}", + "CLOUD_SQL_MYSQL_INSTANCE": "${user_config.cloud_sql_mysql_instance}", + "CLOUD_SQL_MYSQL_DATABASE": "${user_config.cloud_sql_mysql_database}", + "CLOUD_SQL_MYSQL_USER": "${user_config.cloud_sql_mysql_user}", + "CLOUD_SQL_MYSQL_PASSWORD": "${user_config.cloud_sql_mysql_password}", + "CLOUD_SQL_MYSQL_IP_TYPE": "${user_config.cloud_sql_mysql_ip_type}" + } + } + } } diff --git a/.codex-plugin/.mcp.json b/.codex-plugin/.mcp.json new file mode 100644 index 0000000..1f39575 --- /dev/null +++ b/.codex-plugin/.mcp.json @@ -0,0 +1,23 @@ +{ + "mcpServers": { + "cloud-sql-mysql": { + "command": "npx", + "args": [ + "-y", + "@toolbox-sdk/server@1.9.0", + "--prebuilt", + "cloud-sql-mysql", + "--stdio" + ], + "env_vars": [ + "CLOUD_SQL_MYSQL_PROJECT", + "CLOUD_SQL_MYSQL_REGION", + "CLOUD_SQL_MYSQL_INSTANCE", + "CLOUD_SQL_MYSQL_DATABASE", + "CLOUD_SQL_MYSQL_USER", + "CLOUD_SQL_MYSQL_PASSWORD", + "CLOUD_SQL_MYSQL_IP_TYPE" + ] + } + } +} diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 76caadb..dc4dfa8 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -14,7 +14,6 @@ "mysql", "database" ], - "skills": "./skills/", "interface": { "displayName": "Cloud SQL for MySQL", "shortDescription": "Interact with CloudSQL for MySQL instances.", @@ -27,5 +26,6 @@ "defaultPrompt": [ "You are a highly skilled database engineer and database administrator. Your purpose is to help the developer build and interact with databases and utilize data context throughout the entire software delivery cycle." ] - } + }, + "mcpServers": "./.codex-plugin/.mcp.json" } diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 0533093..d758c32 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -21,18 +21,28 @@ pinDigests: true, }, { - matchPackageNames: ['googleapis/mcp-toolbox'], + matchPackageNames: ['@toolbox-sdk/server'], + // Group the toolbox update under a stable branch name (renovate/toolbox). + groupName: 'toolbox', 'semanticCommitType': 'feat' } ], customManagers: [ { + // Track the npm toolbox server pinned in the MCP command. The version is + // listed in the source (mcp.json) and repeated in every generated + // manifest, so all of them are bumped in one PR. customType: "regex", - managerFilePatterns: ["/toolbox_version\\.txt$/"], - matchStrings: ["(?[\\d\\.]+)"], - datasourceTemplate: "github-releases", - packageNameTemplate: "googleapis/mcp-toolbox", - extractVersionTemplate: "^v(?.*)$", + managerFilePatterns: [ + "/mcp\.json$/", + "/mcp_config\.json$/", + "/gemini-extension\.json$/", + "/\.claude-plugin/plugin\.json$/", + "/\.codex-plugin/\.mcp\.json$/", + ], + matchStrings: ["@toolbox-sdk/server@(?[\d\.]+)"], + datasourceTemplate: "npm", + depNameTemplate: "@toolbox-sdk/server", } ] } diff --git a/.github/workflows/presubmit-tests.yml b/.github/workflows/presubmit-tests.yml index f492e49..b70f3b8 100644 --- a/.github/workflows/presubmit-tests.yml +++ b/.github/workflows/presubmit-tests.yml @@ -17,6 +17,9 @@ on: pull_request: branches: [ main ] +permissions: + contents: read + jobs: run-presubmit-tests: runs-on: ubuntu-latest @@ -27,12 +30,6 @@ jobs: - name: Install Gemini CLI run: npm install @google/gemini-cli - - name: Install toolbox binary - run: | - VERSION=$(cat toolbox_version.txt) - curl -L -o toolbox "https://storage.googleapis.com/mcp-toolbox-for-databases/v${VERSION}/linux/amd64/toolbox" - chmod +x toolbox - - name: Install Extension run: npx gemini extensions validate . env: diff --git a/.github/workflows/skills-validate-fallback.yml b/.github/workflows/skills-validate-fallback.yml deleted file mode 100644 index b49eb62..0000000 --- a/.github/workflows/skills-validate-fallback.yml +++ /dev/null @@ -1,37 +0,0 @@ -# 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. - -name: lint - -on: - push: - paths-ignore: - - "skills/**" - pull_request: - paths-ignore: - - "skills/**" - pull_request_target: - types: [labeled] - paths-ignore: - - "skills/**" - workflow_dispatch: - -jobs: - skills-validate: - runs-on: ubuntu-latest - steps: - - name: Skip Skill Validation - run: | - echo "No changes detected in 'skills/' directory. Skipping validation." - echo "This job ensures the required 'skills-validate' status check passes." diff --git a/.github/workflows/skills-validate.yml b/.github/workflows/skills-validate.yml deleted file mode 100644 index becb9b4..0000000 --- a/.github/workflows/skills-validate.yml +++ /dev/null @@ -1,56 +0,0 @@ -# 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. - -name: Validate Skills - -on: - push: - paths: - - "skills/**" - pull_request: - paths: - - "skills/**" - pull_request_target: - types: [labeled] - paths: - - "skills/**" - -jobs: - skills-validate: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - - - name: Set up Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 - with: - python-version: "3.11" - - - name: Install skills-ref - run: | - pip install "git+https://github.com/agentskills/agentskills.git#subdirectory=skills-ref" - - - name: Validate Skills - run: | - failed=0 - for skill_dir in skills/*/; do - if [ -d "$skill_dir" ]; then - echo "Validating $skill_dir..." - if ! skills-ref validate "$skill_dir"; then - echo "Validation failed for $skill_dir" - failed=1 - fi - fi - done - exit $failed diff --git a/README.md b/README.md index e341232..e3e1377 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Cloud SQL for MySQL Agent Skills +# Cloud SQL for MySQL > [!NOTE] > Currently in beta (pre-v1.0), and may see breaking changes until the first stable release (v1.0). -This repository provides a set of agent skills to interact with [Cloud SQL for MySQL](https://cloud.google.com/sql/docs/mysql) instances. These skills can be used with various AI agents, including [Antigravity](https://antigravity.google/), [Claude Code](https://claude.com/product/claude-code) and [Codex](https://developers.openai.com/codex), to manage your databases, execute queries, explore schemas, and troubleshoot issues using natural language prompts. +This repository packages [MCP Toolbox](https://github.com/googleapis/mcp-toolbox)'s prebuilt `cloud-sql-mysql` server as a plugin/extension to interact with [Cloud SQL for MySQL](https://cloud.google.com/sql/docs/mysql) instances. It can be used with various AI agents, including [Antigravity](https://antigravity.google/), [Claude Code](https://claude.com/product/claude-code) and [Codex](https://developers.openai.com/codex), to manage your databases, execute queries, explore schemas, and troubleshoot issues using natural language prompts. > [!IMPORTANT] > **We Want Your Feedback!** @@ -14,7 +14,7 @@ This repository provides a set of agent skills to interact with [Cloud SQL for M ## Table of Contents -- [Why Use Cloud SQL for MySQL Agent Skills?](#why-use-cloud-sql-for-mysql-agent-skills) +- [Why Use Cloud SQL for MySQL?](#why-use-cloud-sql-for-mysql) - [Prerequisites](#prerequisites) - [Getting Started](#getting-started) - [Configuration](#configuration) @@ -22,14 +22,14 @@ This repository provides a set of agent skills to interact with [Cloud SQL for M - [Antigravity](#antigravity) - [Claude Code](#claude-code) - [Codex](#codex) -- [Installing using open agent skills tool](#installing-using-open-agent-skills-tool) - [Installing via a compatible Agent Plugins client](#installing-via-a-compatible-agent-plugins-client) - [Usage Examples](#usage-examples) -- [Supported Skills](#supported-skills) +- [Available Tools](#available-tools) +- [Generating Skills Instead](#generating-skills-instead) - [Additional Agent Skills](#additional-agent-skills) - [Troubleshooting](#troubleshooting) -## Why Use Cloud SQL for MySQL Agent Skills? +## Why Use Cloud SQL for MySQL? - **Seamless Workflow:** Integrates seamlessly into your AI agent's environment. No need to constantly switch contexts for common database tasks. - **Natural Language Queries:** Stop wrestling with complex commands. Explore schemas and query data by describing what you want in plain English. @@ -46,6 +46,7 @@ Before you begin, ensure you have the following: - [Antigravity 2.0](https://antigravity.google/product/antigravity-2) version **v2.0.0** or higher. - [Claude Code](https://claude.com/product/claude-code) version **v2.1.94** or higher. - [Codex](https://developers.openai.com/codex) **v0.117.0** or higher. +- [Node.js](https://nodejs.org/) — the MCP server runs via `npx`. - A Google Cloud project with the **Cloud SQL Admin API** enabled. - Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment. - IAM Permissions: @@ -77,7 +78,7 @@ Please keep these env vars handy during the installation process: ### Installation & Usage -To start interacting with your database, install the skills for your preferred AI agent, then launch the agent and use natural language to ask questions or perform tasks. +To start interacting with your database, install the extension for your preferred AI agent, then launch the agent and use natural language to ask questions or perform tasks. For the latest version, check the [releases page][releases]. @@ -106,28 +107,18 @@ See Migrating from Gemi #### Antigravity 2.0 (IDE) -**1. Clone the Repo:** - -```bash -git clone --branch 0.2.0 https://github.com/gemini-cli-extensions/cloud-sql-mysql.git -``` - -**2. Install the skills:** - -Choose a location for the skills: -- **Global (all workspaces):** `~/.gemini/antigravity/skills/` -- **Workspace-specific:** `/.agents/skills/` +**1. Install the plugin:** -Copy the skill folders from the cloned repository's `skills/` directory to your chosen location: +Install the plugin directly from the remote GitHub repository: ```bash -cp -R cloud-sql-mysql/skills/* ~/.gemini/antigravity/skills/ +agy plugin install https://github.com/gemini-cli-extensions/cloud-sql-mysql ``` -**3. Set env vars:** +**2. Set env vars:** Set your environment vars as described in the [configuration section](#configuration). -_(Tip: Antigravity 2.0 automatically discovers skills in these directories at the start of a session. You can verify they are active by running the `/skills` command in your active session.)_ +_(Tip: You can verify the MCP server is active by running the `/mcp` command in your active session.)_ #### Antigravity CLI @@ -162,8 +153,7 @@ claude /plugin install cloud-sql-mysql@claude-plugins-official ``` -_(Tip: Run `/plugin list` inside Claude Code to verify the plugin is active, or `/reload-plugins` if you just installed it.)_ - +_(Tip: Run `/plugin list` inside Claude Code to verify the plugin is active, or `/reload-plugins` if you just installed it.)
@@ -191,23 +181,7 @@ codex plugin marketplace upgrade data-agent-kit
-## Installing using [open agent skills tool](https://github.com/vercel-labs/skills) - -You can install skills using the `npx skills` command. - -**1. Install the skills:** - -Run the following command in your terminal to automatically download and register the skills: - -```bash -npx skills add https://github.com/gemini-cli-extensions/cloud-sql-mysql/tree/0.2.0 -``` - -For detailed info check out the [Skills npm package](https://www.npmjs.com/package/skills). - -**2. Set env vars:** -Set your environment vars as described in the [configuration section](#configuration). - +## Installing via a compatible Agent Plugins client ## Installing via a compatible Agent Plugins client This repository is a valid [Agent Plugins](https://github.com/agentplugins/agent-plugins-spec) (v1) plugin. Any [Agent Plugins–compatible client](https://agent-plugins.org/compatible-clients) can install it directly using its own built-in plugin command — no extra tooling required — by pointing at this repository: @@ -237,14 +211,41 @@ Interact with Cloud SQL for MySQL using natural language: - **Generate Code:** - "Generate a Python dataclass to represent the 'customers' table." -## Supported Skills +## Available Tools + +The tools come from MCP Toolbox's prebuilt `cloud-sql-mysql` server, grouped into toolsets: + +- **admin** - Use these tools when you need to provision new Cloud SQL for MySQL instances, create databases and users, and monitor the progress of infrastructure operations. +- **data** - Use these tools when you need to explore your database schema, execute SQL queries to interact with your data, and inspect how MySQL plans to execute your statements. +- **monitor** - Use these tools when you need to troubleshoot slow queries, analyze system-level PromQL metrics, and identify structural performance issues like table fragmentation or missing unique indexes. +- **lifecycle** - Use these tools when you need to manage the durability and safety of your data by creating backups, restoring from previous states, or cloning instances for recovery and testing. + +For the full, up-to-date list, see the [`cloud-sql-mysql` prebuilt config](https://github.com/googleapis/mcp-toolbox/blob/main/internal/prebuiltconfigs/tools/cloud-sql-mysql.yaml) +in the MCP Toolbox repository. -The following skills are available in this repository: +## Generating Skills Instead + +The tool-backed skills this plugin used to ship were generated from the same prebuilt +toolsets. If your agent lacks deferred tool loading, or you prefer skills, regenerate +them with the script in this repository: + +```bash +VERSION= ./.github/scripts/generate_skills.sh +``` + +Use the toolbox version pinned in [`mcp.json`](./mcp.json). A single toolset, without +the script: + +```bash +npx @toolbox-sdk/server@ --prebuilt cloud-sql-mysql skills-generate \ + --name "" \ + --toolset "" \ + --description "" +``` -- [Cloud SQL for MySQL Admin](./skills/cloud-sql-mysql-admin/SKILL.md) - Use these skills when you need to provision new Cloud SQL for MySQL instances, create databases and users, clone existing environments, and monitor the progress of infrastructure operations. -- [Cloud SQL for MySQL Data](./skills/cloud-sql-mysql-data/SKILL.md) - Use these skills when you need to explore your database schema, execute SQL queries to interact with your data, and inspect how MySQL plans to execute your statements. -- [Cloud SQL for MySQL Lifecycle](./skills/cloud-sql-mysql-lifecycle/SKILL.md) - Use these skills when you need to manage the durability and safety of your data by creating backups, restoring from previous states, or cloning instances for recovery and testing. -- [Cloud SQL for MySQL Monitor](./skills/cloud-sql-mysql-monitor/SKILL.md) - Use these skills when you need to troubleshoot slow queries, analyze system-level PromQL metrics, and identify structural performance issues like table fragmentation or missing unique indexes. +The generated scripts call the toolbox through `npx`, so no binary download is needed. +See [Generate Agent Skills](https://github.com/googleapis/mcp-toolbox#generate-agent-skills) +in the MCP Toolbox repository. ## Additional Agent Skills @@ -262,5 +263,5 @@ Common issues: - "failed to find default credentials: google: could not find default credentials.": Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment. See [Set up Application Default Credentials](https://cloud.google.com/docs/authentication/external/set-up-adc) for more information. - "✖ Error during discovery for server: MCP error -32000: Connection closed": The database connection has not been established. Ensure your configuration is set via environment variables. -- "✖ MCP ERROR: Error: spawn .../toolbox ENOENT": The Toolbox binary did not download correctly. Ensure you are using the latest version of your agent. +- "✖ MCP ERROR: Error: spawn npx ENOENT": Node.js is not installed, or `npx` is not on your `PATH`. Install Node.js, which provides `npx`. - "cannot execute binary file": The Toolbox binary did not download correctly. Ensure the correct binary for your OS/Architecture has been downloaded. See [Installing the server](https://mcp-toolbox.dev/documentation/introduction/#install-toolbox) for more information. diff --git a/gemini-extension.json b/gemini-extension.json index 830a625..afeff2e 100644 --- a/gemini-extension.json +++ b/gemini-extension.json @@ -1,7 +1,19 @@ { "name": "cloud-sql-mysql", "version": "0.2.0", - "description": "Connect and interact with a Cloud SQL for MySQL database and data", + "description": "Connect and interact with a Cloud SQL for MySQL database and data.", + "mcpServers": { + "cloud-sql-mysql": { + "command": "npx", + "args": [ + "-y", + "@toolbox-sdk/server@1.9.0", + "--prebuilt", + "cloud-sql-mysql", + "--stdio" + ] + } + }, "contextFileName": "CLOUD-SQL-MYSQL.md", "settings": [ { diff --git a/mcp.json b/mcp.json new file mode 100644 index 0000000..2559446 --- /dev/null +++ b/mcp.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json", + "mcpServers": { + "cloud-sql-mysql": { + "type": "stdio", + "command": "npx", + "args": [ + "-y", + "@toolbox-sdk/server@1.9.0", + "--prebuilt", + "cloud-sql-mysql", + "--stdio" + ] + } + } +} diff --git a/mcp_config.json b/mcp_config.json new file mode 100644 index 0000000..7ef4c2c --- /dev/null +++ b/mcp_config.json @@ -0,0 +1,14 @@ +{ + "mcpServers": { + "cloud-sql-mysql": { + "command": "npx", + "args": [ + "-y", + "@toolbox-sdk/server@1.9.0", + "--prebuilt", + "cloud-sql-mysql", + "--stdio" + ] + } + } +} diff --git a/plugin.json b/plugin.json index 2f06b77..a327c9b 100644 --- a/plugin.json +++ b/plugin.json @@ -14,5 +14,65 @@ "cloud-sql", "mysql", "database" - ] + ], + "extensions": { + "com.google.cloud.data.agent-plugins": { + "config": [ + { + "key": "CLOUD_SQL_MYSQL_PROJECT", + "title": "Project ID", + "description": "ID of the Google Cloud project" + }, + { + "key": "CLOUD_SQL_MYSQL_REGION", + "title": "Region", + "description": "Region of the Cloud SQL instance" + }, + { + "key": "CLOUD_SQL_MYSQL_INSTANCE", + "title": "Instance", + "description": "Name of the Cloud SQL instance" + }, + { + "key": "CLOUD_SQL_MYSQL_DATABASE", + "title": "Database", + "description": "Name of the database" + }, + { + "key": "CLOUD_SQL_MYSQL_USER", + "title": "User", + "description": "(Optional) Username of the database user (Default: IAM user)" + }, + { + "key": "CLOUD_SQL_MYSQL_PASSWORD", + "title": "Password", + "description": "(Optional) Password of the database user (Default: IAM user)" + }, + { + "key": "CLOUD_SQL_MYSQL_IP_TYPE", + "title": "IP Type", + "description": "(Optional) Type of the IP address: PUBLIC, PRIVATE, or PSC (Default: Public)" + } + ], + "gemini": { + "mcpServerName": "cloud-sql-mysql", + "contextFileName": "CLOUD-SQL-MYSQL.md" + }, + "codex": { + "interface": { + "displayName": "Cloud SQL for MySQL", + "shortDescription": "Interact with CloudSQL for MySQL instances.", + "developerName": "Google LLC", + "category": "Database", + "capabilities": [ + "Read", + "Write" + ], + "defaultPrompt": [ + "You are a highly skilled database engineer and database administrator. Your purpose is to help the developer build and interact with databases and utilize data context throughout the entire software delivery cycle." + ] + } + } + } + } } diff --git a/skills/cloud-sql-mysql-admin/SKILL.md b/skills/cloud-sql-mysql-admin/SKILL.md deleted file mode 100644 index 6f1624e..0000000 --- a/skills/cloud-sql-mysql-admin/SKILL.md +++ /dev/null @@ -1,125 +0,0 @@ ---- -name: cloud-sql-mysql-admin -description: Use these skills when you need to provision new Cloud SQL for MySQL instances, create databases and users, clone existing environments, and monitor the progress of infrastructure operations. ---- - -## Usage - -All scripts can be executed using Node.js. Replace `` and `` with actual values. - -**Bash:** -`node /scripts/.js '{"": ""}'` - -**PowerShell:** -`node /scripts/.js '{\"\": \"\"}'` - -Note: The scripts automatically load the environment variables from various .env files. Do not ask the user to set vars unless skill executions fails due to env var absence. - - -## Scripts - - -### create_database - - - -#### 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 | | -| 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 | | - - ---- - -### create_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 | | -| name | string | The name of the instance | Yes | | -| databaseVersion | string | The database version for MySQL. If not specified, defaults to the latest available version (e.g., MYSQL_8_4). | No | `MYSQL_8_4` | -| rootPassword | string | The root password for the instance | Yes | | -| editionPreset | string | The edition of the instance. Can be `Production` or `Development`. This determines the default machine type and availability. Defaults to `Development`. | No | `Development` | - - ---- - -### create_user - - - -#### 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 | | -| 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 | | -| iamUser | boolean | Set to true to create a Cloud IAM user. | Yes | | - - ---- - -### get_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 | | -| instanceId | string | The instance ID | Yes | | - - ---- - -### list_databases - -Lists all databases for 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 | | -| instance | string | The instance ID | Yes | | - - ---- - -### list_instances - -Lists all type of Cloud SQL instances for a project. - -#### 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 | | - - ---- - -### wait_for_operation - - - -#### 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 | | -| operation | string | The operation ID | Yes | | - - ---- - diff --git a/skills/cloud-sql-mysql-admin/scripts/create_database.js b/skills/cloud-sql-mysql-admin/scripts/create_database.js deleted file mode 100755 index ca2ced2..0000000 --- a/skills/cloud-sql-mysql-admin/scripts/create_database.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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 = "create_database"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-admin/scripts/create_instance.js b/skills/cloud-sql-mysql-admin/scripts/create_instance.js deleted file mode 100755 index 3c9a178..0000000 --- a/skills/cloud-sql-mysql-admin/scripts/create_instance.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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 = "create_instance"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-admin/scripts/create_user.js b/skills/cloud-sql-mysql-admin/scripts/create_user.js deleted file mode 100755 index 5b36f99..0000000 --- a/skills/cloud-sql-mysql-admin/scripts/create_user.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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 = "create_user"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-admin/scripts/get_instance.js b/skills/cloud-sql-mysql-admin/scripts/get_instance.js deleted file mode 100755 index 7b555e5..0000000 --- a/skills/cloud-sql-mysql-admin/scripts/get_instance.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_instance"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-admin/scripts/list_databases.js b/skills/cloud-sql-mysql-admin/scripts/list_databases.js deleted file mode 100755 index a3ee6d8..0000000 --- a/skills/cloud-sql-mysql-admin/scripts/list_databases.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_databases"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-admin/scripts/list_instances.js b/skills/cloud-sql-mysql-admin/scripts/list_instances.js deleted file mode 100755 index d0f39e6..0000000 --- a/skills/cloud-sql-mysql-admin/scripts/list_instances.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_instances"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-admin/scripts/wait_for_operation.js b/skills/cloud-sql-mysql-admin/scripts/wait_for_operation.js deleted file mode 100755 index 6135122..0000000 --- a/skills/cloud-sql-mysql-admin/scripts/wait_for_operation.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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 = "wait_for_operation"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-data/SKILL.md b/skills/cloud-sql-mysql-data/SKILL.md deleted file mode 100644 index 1df8dc8..0000000 --- a/skills/cloud-sql-mysql-data/SKILL.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -name: cloud-sql-mysql-data -description: Use these skills when you need to explore your database schema, execute SQL queries to interact with your data, and inspect how MySQL plans to execute your statements. ---- - -## Usage - -All scripts can be executed using Node.js. Replace `` and `` with actual values. - -**Bash:** -`node /scripts/.js '{"": ""}'` - -**PowerShell:** -`node /scripts/.js '{\"\": \"\"}'` - -Note: The scripts automatically load the environment variables from various .env files. Do not ask the user to set vars unless skill executions fails due to env var absence. - - -## Scripts - - -### execute_sql - -Use this skill to execute SQL. - -#### Parameters - -| Name | Type | Description | Required | Default | -| :--- | :--- | :--- | :--- | :--- | -| sql | string | The sql to execute. | Yes | | - - ---- - -### get_query_plan - -Provide information about how MySQL executes a SQL statement. Common use cases include: 1) analyze query plan to improve its performance, and 2) determine effectiveness of existing indexes and evalueate new ones. - -#### Parameters - -| Name | Type | Description | Required | Default | -| :--- | :--- | :--- | :--- | :--- | -| sql_statement | string | The sql statement to explain. | Yes | | - - ---- - -### list_active_queries - -Lists top N (default 10) ongoing queries from processlist and innodb_trx, ordered by execution time in descending order. Returns detailed information of those queries in json format, including process id, query, transaction duration, transaction wait duration, process time, transaction state, process state, username with host, transaction rows locked, transaction rows modified, and db schema. - -#### Parameters - -| Name | Type | Description | Required | Default | -| :--- | :--- | :--- | :--- | :--- | -| min_duration_secs | integer | Optional: Only show queries running for at least this long in seconds | No | `0` | -| limit | integer | Optional: The maximum number of rows to return. | No | `100` | - - ---- - -### list_tables - -Lists detailed schema information (object type, columns, constraints, indexes, triggers, comment) as JSON for user-created tables (ordinary or partitioned). Filters by a comma-separated list of names. If names are omitted, lists all tables in user schemas. - -#### Parameters - -| 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 | `` | -| output_format | string | Optional: Use 'simple' for names only or 'detailed' for full info. | No | `detailed` | - - ---- - diff --git a/skills/cloud-sql-mysql-data/scripts/execute_sql.js b/skills/cloud-sql-mysql-data/scripts/execute_sql.js deleted file mode 100755 index 27e4127..0000000 --- a/skills/cloud-sql-mysql-data/scripts/execute_sql.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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 = "execute_sql"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-data/scripts/get_query_plan.js b/skills/cloud-sql-mysql-data/scripts/get_query_plan.js deleted file mode 100755 index d49e104..0000000 --- a/skills/cloud-sql-mysql-data/scripts/get_query_plan.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_query_plan"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-data/scripts/list_active_queries.js b/skills/cloud-sql-mysql-data/scripts/list_active_queries.js deleted file mode 100755 index ca9e382..0000000 --- a/skills/cloud-sql-mysql-data/scripts/list_active_queries.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_active_queries"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-data/scripts/list_tables.js b/skills/cloud-sql-mysql-data/scripts/list_tables.js deleted file mode 100755 index b8f38a7..0000000 --- a/skills/cloud-sql-mysql-data/scripts/list_tables.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_tables"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-lifecycle/SKILL.md b/skills/cloud-sql-mysql-lifecycle/SKILL.md deleted file mode 100644 index f2e6c86..0000000 --- a/skills/cloud-sql-mysql-lifecycle/SKILL.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -name: cloud-sql-mysql-lifecycle -description: Use these skills when you need to manage the durability and safety of your data by creating backups, restoring from previous states, or cloning instances for recovery and testing. ---- - -## Usage - -All scripts can be executed using Node.js. Replace `` and `` with actual values. - -**Bash:** -`node /scripts/.js '{"": ""}'` - -**PowerShell:** -`node /scripts/.js '{\"\": \"\"}'` - -Note: The scripts automatically load the environment variables from various .env files. Do not ask the user to set vars unless skill executions fails due to env var absence. - - -## Scripts - - -### clone_instance - -Clone an existing Cloud SQL instance into a new instance. The clone can be a direct copy of the source instance, or a point-in-time-recovery (PITR) clone from a specific timestamp. The call returns a Cloud SQL Operation object. Call wait_for_operation skill after this, make sure to use multiplier as 4 to poll the opertation status till it is marked DONE. - -#### 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 | | -| 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 | | -| preferredZone | string | The preferred zone for the new instance. | No | | -| preferredSecondaryZone | string | The preferred secondary zone for the new instance. | No | | - - ---- - -### create_backup - -Creates a backup on 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 | | -| 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 | | - - ---- - -### get_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 | | -| instanceId | string | The instance ID | Yes | | - - ---- - -### list_instances - -Lists all type of Cloud SQL instances for a project. - -#### 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 | | - - ---- - -### restore_backup - -Restores a backup on a Cloud SQL instance. - -#### Parameters - -| 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_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 | | -| source_instance | string | Cloud SQL instance ID of the instance that the backup belongs to. Only required if the backup_id is a BackupRun ID. | No | | - - ---- - -### wait_for_operation - - - -#### 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 | | -| operation | string | The operation ID | Yes | | - - ---- - diff --git a/skills/cloud-sql-mysql-lifecycle/scripts/clone_instance.js b/skills/cloud-sql-mysql-lifecycle/scripts/clone_instance.js deleted file mode 100755 index 323b55f..0000000 --- a/skills/cloud-sql-mysql-lifecycle/scripts/clone_instance.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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 = "clone_instance"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-lifecycle/scripts/create_backup.js b/skills/cloud-sql-mysql-lifecycle/scripts/create_backup.js deleted file mode 100755 index 5fc85c8..0000000 --- a/skills/cloud-sql-mysql-lifecycle/scripts/create_backup.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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 = "create_backup"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-lifecycle/scripts/get_instance.js b/skills/cloud-sql-mysql-lifecycle/scripts/get_instance.js deleted file mode 100755 index 7b555e5..0000000 --- a/skills/cloud-sql-mysql-lifecycle/scripts/get_instance.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_instance"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-lifecycle/scripts/list_instances.js b/skills/cloud-sql-mysql-lifecycle/scripts/list_instances.js deleted file mode 100755 index d0f39e6..0000000 --- a/skills/cloud-sql-mysql-lifecycle/scripts/list_instances.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_instances"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-lifecycle/scripts/restore_backup.js b/skills/cloud-sql-mysql-lifecycle/scripts/restore_backup.js deleted file mode 100755 index 92bff3f..0000000 --- a/skills/cloud-sql-mysql-lifecycle/scripts/restore_backup.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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 = "restore_backup"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-lifecycle/scripts/wait_for_operation.js b/skills/cloud-sql-mysql-lifecycle/scripts/wait_for_operation.js deleted file mode 100755 index 6135122..0000000 --- a/skills/cloud-sql-mysql-lifecycle/scripts/wait_for_operation.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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 = "wait_for_operation"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-monitor/SKILL.md b/skills/cloud-sql-mysql-monitor/SKILL.md deleted file mode 100644 index 862736b..0000000 --- a/skills/cloud-sql-mysql-monitor/SKILL.md +++ /dev/null @@ -1,203 +0,0 @@ ---- -name: cloud-sql-mysql-monitor -description: Use these skills when you need to troubleshoot slow queries, analyze system-level PromQL metrics, and identify structural performance issues like table fragmentation or missing unique indexes. ---- - -## Usage - -All scripts can be executed using Node.js. Replace `` and `` with actual values. - -**Bash:** -`node /scripts/.js '{"": ""}'` - -**PowerShell:** -`node /scripts/.js '{\"\": \"\"}'` - -Note: The scripts automatically load the environment variables from various .env files. Do not ask the user to set vars unless skill executions fails due to env var absence. - - -## Scripts - - -### get_query_metrics - -Fetches query level cloudmonitoring data (timeseries metrics) for queries running in Mysql 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 skill, you must provide the Google Cloud `projectId` and a PromQL `query`. - -Generate PromQL `query` for Mysql 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__"="dbinsights.googleapis.com/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__"="dbinsights.googleapis.com/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__"="dbinsights.googleapis.com/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__"="dbinsights.googleapis.com/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__"="dbinsights.googleapis.com/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__"="dbinsights.googleapis.com/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__"="dbinsights.googleapis.com/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__"="dbinsights.googleapis.com/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. `dbinsights.googleapis.com/aggregate/latencies`: Cumulative query latency distribution per user and database. `cloudsql_instance_database`. `user`, `client_addr`, `database`, `project_id`, `resource_id`. -2. `dbinsights.googleapis.com/aggregate/execution_time`: Cumulative query execution time per user and database. `cloudsql_instance_database`. `user`, `client_addr`, `database`, `project_id`, `resource_id`. -3. `dbinsights.googleapis.com/aggregate/execution_count`: Total number of query executions per user and database. `cloudsql_instance_database`. `user`, `client_addr`, `database`, `project_id`, `resource_id`. -4. `dbinsights.googleapis.com/aggregate/lock_time`: Cumulative lock wait time per user and database. `cloudsql_instance_database`. `user`, `client_addr`, `lock_type`, `database`, `project_id`, `resource_id`. -5. `dbinsights.googleapis.com/aggregate/io_time`: Cumulative IO wait time per user and database. `cloudsql_instance_database`. `user`, `client_addr`, `database`, `project_id`, `resource_id`. -6. `dbinsights.googleapis.com/aggregate/row_count`: Total number of rows affected during query execution. `cloudsql_instance_database`. `user`, `client_addr`, `row_status`, `database`, `project_id`, `resource_id`. -7. `dbinsights.googleapis.com/perquery/latencies`: Cumulative query latency distribution per user, database, and query. `cloudsql_instance_database`. `querystring`, `user`, `client_addr`, `query_hash`, `database`, `project_id`, `resource_id`. -8. `dbinsights.googleapis.com/perquery/execution_time`: Cumulative query execution time per user, database, and query. `cloudsql_instance_database`. `querystring`, `user`, `client_addr`, `query_hash`, `database`, `project_id`, `resource_id`. -9. `dbinsights.googleapis.com/perquery/execution_count`: Total number of query executions per user, database, and query. `cloudsql_instance_database`. `querystring`, `user`, `client_addr`, `query_hash`, `database`, `project_id`, `resource_id`. -10. `dbinsights.googleapis.com/perquery/lock_time`: Cumulative lock wait time per user, database, and query. `cloudsql_instance_database`. `querystring`, `user`, `client_addr`, `lock_type`, `query_hash`, `database`, `project_id`, `resource_id`. -11. `dbinsights.googleapis.com/perquery/io_time`: Cumulative io wait time per user, database, and query. `cloudsql_instance_database`. `querystring`, `user`, `client_addr`, `query_hash`, `database`, `project_id`, `resource_id`. -12. `dbinsights.googleapis.com/perquery/row_count`: Total number of rows affected during query execution. `cloudsql_instance_database`. `querystring`, `user`, `client_addr`, `query_hash`, `row_status`, `database`, `project_id`, `resource_id`. -13. `dbinsights.googleapis.com/pertag/latencies`: Cumulative query latency distribution per user, database, and tag. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `tag_hash`, `database`, `project_id`, `resource_id`. -14. `dbinsights.googleapis.com/pertag/execution_time`: Cumulative query execution time per user, database, and tag. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `tag_hash`, `database`, `project_id`, `resource_id`. -15. `dbinsights.googleapis.com/pertag/execution_count`: Total number of query executions per user, database, and tag. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `tag_hash`, `database`, `project_id`, `resource_id`. -16. `dbinsights.googleapis.com/pertag/lock_time`: Cumulative lock wait time per user, database and tag. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `lock_type`, `tag_hash`, `database`, `project_id`, `resource_id`. -17. `dbinsights.googleapis.com/pertag/io_time`: Cumulative IO wait time per user, database and tag. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `tag_hash`, `database`, `project_id`, `resource_id`. -18. `dbinsights.googleapis.com/pertag/row_count`: Total number of rows affected during query execution. `cloudsql_instance_database`. `user`, `client_addr`, `action`, `application`, `controller`, `db_driver`, `framework`, `route`, `tag_hash`, `row_status`, `database`, `project_id`, `resource_id`. - - -#### 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 - -Provide information about how MySQL executes a SQL statement. Common use cases include: 1) analyze query plan to improve its performance, and 2) determine effectiveness of existing indexes and evalueate new ones. - -#### Parameters - -| Name | Type | Description | Required | Default | -| :--- | :--- | :--- | :--- | :--- | -| sql_statement | string | The sql statement to explain. | Yes | | - - ---- - -### get_system_metrics - -Fetches system level cloudmonitoring data (timeseries metrics) for a MySQL 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 skill, you must provide the Google Cloud `projectId` and a PromQL `query`. - -Generate PromQL `query` for MySQL 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/cpu/utilization`: Current CPU utilization as a percentage of reserved CPU. `cloudsql_database`. `database`, `project_id`, `database_id`. -2. `cloudsql.googleapis.com/database/network/connections`: Number of connections to the database instance. `cloudsql_database`. `database`, `project_id`, `database_id`. -3. `cloudsql.googleapis.com/database/network/received_bytes_count`: Delta count of bytes received through the network. `cloudsql_database`. `database`, `project_id`, `database_id`. -4. `cloudsql.googleapis.com/database/network/sent_bytes_count`: Delta count of bytes sent through the network. `cloudsql_database`. `destination`, `database`, `project_id`, `database_id`. -5. `cloudsql.googleapis.com/database/memory/components`: Memory usage for components like usage, cache, and free memory. `cloudsql_database`. `component`, `database`, `project_id`, `database_id`. -6. `cloudsql.googleapis.com/database/disk/bytes_used_by_data_type`: Data utilization in bytes. `cloudsql_database`. `data_type`, `database`, `project_id`, `database_id`. -7. `cloudsql.googleapis.com/database/disk/read_ops_count`: Delta count of data disk read IO operations. `cloudsql_database`. `database`, `project_id`, `database_id`. -8. `cloudsql.googleapis.com/database/disk/write_ops_count`: Delta count of data disk write IO operations. `cloudsql_database`. `database`, `project_id`, `database_id`. -9. `cloudsql.googleapis.com/database/mysql/queries`: Delta count of statements executed by the server. `cloudsql_database`. `database`, `project_id`, `database_id`. -10. `cloudsql.googleapis.com/database/mysql/questions`: Delta count of statements sent by the client. `cloudsql_database`. `database`, `project_id`, `database_id`. -11. `cloudsql.googleapis.com/database/mysql/received_bytes_count`: Delta count of bytes received by MySQL process. `cloudsql_database`. `database`, `project_id`, `database_id`. -12. `cloudsql.googleapis.com/database/mysql/sent_bytes_count`: Delta count of bytes sent by MySQL process. `cloudsql_database`. `database`, `project_id`, `database_id`. -13. `cloudsql.googleapis.com/database/mysql/innodb_buffer_pool_pages_dirty`: Number of unflushed pages in the InnoDB buffer pool. `cloudsql_database`. `database`, `project_id`, `database_id`. -14. `cloudsql.googleapis.com/database/mysql/innodb_buffer_pool_pages_free`: Number of unused pages in the InnoDB buffer pool. `cloudsql_database`. `database`, `project_id`, `database_id`. -15. `cloudsql.googleapis.com/database/mysql/innodb_buffer_pool_pages_total`: Total number of pages in the InnoDB buffer pool. `cloudsql_database`. `database`, `project_id`, `database_id`. -16. `cloudsql.googleapis.com/database/mysql/innodb_data_fsyncs`: Delta count of InnoDB fsync() calls. `cloudsql_database`. `database`, `project_id`, `database_id`. -17. `cloudsql.googleapis.com/database/mysql/innodb_os_log_fsyncs`: Delta count of InnoDB fsync() calls to the log file. `cloudsql_database`. `database`, `project_id`, `database_id`. -18. `cloudsql.googleapis.com/database/mysql/innodb_pages_read`: Delta count of InnoDB pages read. `cloudsql_database`. `database`, `project_id`, `database_id`. -19. `cloudsql.googleapis.com/database/mysql/innodb_pages_written`: Delta count of InnoDB pages written. `cloudsql_database`. `database`, `project_id`, `database_id`. -20. `cloudsql.googleapis.com/database/mysql/open_tables`: The number of tables that are currently open. `cloudsql_database`. `database`, `project_id`, `database_id`. -21. `cloudsql.googleapis.com/database/mysql/opened_table_count`: The number of tables opened since the last sample. `cloudsql_database`. `database`, `project_id`, `database_id`. -22. `cloudsql.googleapis.com/database/mysql/open_table_definitions`: The number of table definitions currently cached. `cloudsql_database`. `database`, `project_id`, `database_id`. -23. `cloudsql.googleapis.com/database/mysql/opened_table_definitions_count`: The number of table definitions cached since the last sample. `cloudsql_database`. `database`, `project_id`, `database_id`. -24. `cloudsql.googleapis.com/database/mysql/innodb/dictionary_memory`: Memory allocated for the InnoDB dictionary cache. `cloudsql_database`. `database`, `project_id`, `database_id`. - - -#### 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 - -Lists top N (default 10) ongoing queries from processlist and innodb_trx, ordered by execution time in descending order. Returns detailed information of those queries in json format, including process id, query, transaction duration, transaction wait duration, process time, transaction state, process state, username with host, transaction rows locked, transaction rows modified, and db schema. - -#### Parameters - -| Name | Type | Description | Required | Default | -| :--- | :--- | :--- | :--- | :--- | -| min_duration_secs | integer | Optional: Only show queries running for at least this long in seconds | No | `0` | -| limit | integer | Optional: The maximum number of rows to return. | No | `100` | - - ---- - -### list_table_fragmentation - -List table fragmentation in MySQL, by calculating the size of the data and index files and free space allocated to each table. The query calculates fragmentation percentage which represents the proportion of free space relative to the total data and index size. Storage can be reclaimed for tables with high fragmentation using OPTIMIZE TABLE. - -#### Parameters - -| Name | Type | Description | Required | Default | -| :--- | :--- | :--- | :--- | :--- | -| table_schema | string | (Optional) The database where fragmentation check is to be executed. Check all tables visible to the current user if not specified | No | `` | -| table_name | string | (Optional) Name of the table to be checked. Check all tables visible to the current user if not specified. | No | `` | -| data_free_threshold_bytes | integer | (Optional) Only show tables with at least this much free space in bytes. Default is 1 | No | `1` | -| limit | integer | (Optional) Max rows to return, default is 10 | No | `10` | - - ---- - -### list_table_stats - -Display table statistics including table size, total latency, rows read, rows written, read and write latency for entire instance, a specified database, or a specified table. Specifying a database name or table name filters the output to that specific db or table. Results are limited to 10 by default. - -#### Parameters - -| Name | Type | Description | Required | Default | -| :--- | :--- | :--- | :--- | :--- | -| table_schema | string | (Optional) The database where statistics is to be executed. Check all tables visible to the current user if not specified | No | `` | -| table_name | string | (Optional) Name of the table to be checked. Check all tables visible to the current user if not specified. | No | `` | -| sort_by | string | (Optional) The column to sort by | No | `` | -| limit | integer | (Optional) Max rows to return, default is 10 | No | `10` | -| connected_schema | string | (Optional) The connected db | No | | - - ---- - -### list_tables_missing_unique_indexes - -Find tables that do not have primary or unique key constraint. A primary key or unique key is the only mechanism that guaranttes a row is unique. Without them, the database-level protection against data integrity issues will be missing. - -#### Parameters - -| Name | Type | Description | Required | Default | -| :--- | :--- | :--- | :--- | :--- | -| table_schema | string | (Optional) The database where the check is to be performed. Check all tables visible to the current user if not specified | No | `` | -| limit | integer | (Optional) Max rows to return, default is 50 | No | `50` | - - ---- - diff --git a/skills/cloud-sql-mysql-monitor/scripts/get_query_metrics.js b/skills/cloud-sql-mysql-monitor/scripts/get_query_metrics.js deleted file mode 100755 index 016a423..0000000 --- a/skills/cloud-sql-mysql-monitor/scripts/get_query_metrics.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_query_metrics"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-monitor/scripts/get_query_plan.js b/skills/cloud-sql-mysql-monitor/scripts/get_query_plan.js deleted file mode 100755 index d49e104..0000000 --- a/skills/cloud-sql-mysql-monitor/scripts/get_query_plan.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_query_plan"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-monitor/scripts/get_system_metrics.js b/skills/cloud-sql-mysql-monitor/scripts/get_system_metrics.js deleted file mode 100755 index 17adcb9..0000000 --- a/skills/cloud-sql-mysql-monitor/scripts/get_system_metrics.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_system_metrics"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-monitor/scripts/list_active_queries.js b/skills/cloud-sql-mysql-monitor/scripts/list_active_queries.js deleted file mode 100755 index ca9e382..0000000 --- a/skills/cloud-sql-mysql-monitor/scripts/list_active_queries.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_active_queries"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-monitor/scripts/list_table_fragmentation.js b/skills/cloud-sql-mysql-monitor/scripts/list_table_fragmentation.js deleted file mode 100755 index c055097..0000000 --- a/skills/cloud-sql-mysql-monitor/scripts/list_table_fragmentation.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_fragmentation"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-monitor/scripts/list_table_stats.js b/skills/cloud-sql-mysql-monitor/scripts/list_table_stats.js deleted file mode 100755 index d22d90f..0000000 --- a/skills/cloud-sql-mysql-monitor/scripts/list_table_stats.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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-mysql-monitor/scripts/list_tables_missing_unique_indexes.js b/skills/cloud-sql-mysql-monitor/scripts/list_tables_missing_unique_indexes.js deleted file mode 100755 index 3e3cb68..0000000 --- a/skills/cloud-sql-mysql-monitor/scripts/list_tables_missing_unique_indexes.js +++ /dev/null @@ -1,105 +0,0 @@ -#!/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_tables_missing_unique_indexes"; -const configArgs = ["--prebuilt", "cloud-sql-mysql"]; - -const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [ - 'CLOUD_SQL_MYSQL_USER', - 'CLOUD_SQL_MYSQL_PASSWORD', - 'CLOUD_SQL_MYSQL_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.1.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/toolbox_version.txt b/toolbox_version.txt deleted file mode 100644 index f0bb29e..0000000 --- a/toolbox_version.txt +++ /dev/null @@ -1 +0,0 @@ -1.3.0 From e5c66832a376e4b46b89bf22760abee015aa0f4d Mon Sep 17 00:00:00 2001 From: Juexin Wang Date: Fri, 4 Sep 2026 14:53:30 -0700 Subject: [PATCH 2/4] docs(marketplace): describe the plugin, not skills --- .claude-plugin/marketplace.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 9c31340..63405da 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -5,7 +5,7 @@ "email": "data-cloud-ai-integrations@google.com" }, "metadata": { - "description": "Agent skills for Cloud SQL for MySQL to query, manage, and monitor databases." + "description": "Connect and interact with a Cloud SQL for MySQL database and data." }, "plugins": [ { From 3bbd2d407e6f22b65baf170570d46cb64f34881c Mon Sep 17 00:00:00 2001 From: Juexin Wang Date: Fri, 4 Sep 2026 14:58:09 -0700 Subject: [PATCH 3/4] ci: name the exact checkout tag in the pin comment --- .github/workflows/presubmit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/presubmit-tests.yml b/.github/workflows/presubmit-tests.yml index b70f3b8..7574c4a 100644 --- a/.github/workflows/presubmit-tests.yml +++ b/.github/workflows/presubmit-tests.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Install Gemini CLI run: npm install @google/gemini-cli From 89ba4e0e87e47a438a41fab3a3b3e0ff79011c3e Mon Sep 17 00:00:00 2001 From: Juexin Wang Date: Fri, 4 Sep 2026 16:24:33 -0700 Subject: [PATCH 4/4] ci: keep the skills-validate workflows, required by branch protection --- .../workflows/skills-validate-fallback.yml | 37 ++++++++++++ .github/workflows/skills-validate.yml | 56 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/skills-validate-fallback.yml create mode 100644 .github/workflows/skills-validate.yml diff --git a/.github/workflows/skills-validate-fallback.yml b/.github/workflows/skills-validate-fallback.yml new file mode 100644 index 0000000..b49eb62 --- /dev/null +++ b/.github/workflows/skills-validate-fallback.yml @@ -0,0 +1,37 @@ +# 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. + +name: lint + +on: + push: + paths-ignore: + - "skills/**" + pull_request: + paths-ignore: + - "skills/**" + pull_request_target: + types: [labeled] + paths-ignore: + - "skills/**" + workflow_dispatch: + +jobs: + skills-validate: + runs-on: ubuntu-latest + steps: + - name: Skip Skill Validation + run: | + echo "No changes detected in 'skills/' directory. Skipping validation." + echo "This job ensures the required 'skills-validate' status check passes." diff --git a/.github/workflows/skills-validate.yml b/.github/workflows/skills-validate.yml new file mode 100644 index 0000000..becb9b4 --- /dev/null +++ b/.github/workflows/skills-validate.yml @@ -0,0 +1,56 @@ +# 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. + +name: Validate Skills + +on: + push: + paths: + - "skills/**" + pull_request: + paths: + - "skills/**" + pull_request_target: + types: [labeled] + paths: + - "skills/**" + +jobs: + skills-validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + + - name: Set up Python + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 + with: + python-version: "3.11" + + - name: Install skills-ref + run: | + pip install "git+https://github.com/agentskills/agentskills.git#subdirectory=skills-ref" + + - name: Validate Skills + run: | + failed=0 + for skill_dir in skills/*/; do + if [ -d "$skill_dir" ]; then + echo "Validating $skill_dir..." + if ! skills-ref validate "$skill_dir"; then + echo "Validation failed for $skill_dir" + failed=1 + fi + fi + done + exit $failed