Golem add mysql ts

From golemcloud/golem · View interactive version

Golem add mysql ts is an AI agent skill from the GitHub repository golemcloud/golem. Using golem:rdbms/mysql from a TypeScript Golem agent. Use when the user asks to connect to MySQL, run SQL, or use MySQL from TypeScript agent code.

How to use this skill

Skill file

Using MySQL from a TypeScript Agent

The TypeScript SDK ships a typed MySQL helper built on the

golem:rdbms/mysql@1.5.0 host interface. Connection queries and transaction

commit/rollback return promises. Transaction query, queryValues, execute,

and run are synchronous. Connection close() is currently a synchronous no-op;

resources are GC-managed, not deterministically released by close(). Failures throw a typed MySqlError.

Imports

import { MySql } from "@golemcloud/golem-ts-sdk";

Open a Connection

const conn = await MySql.open("mysql://user:password@localhost:3306/app");

Query Data

MySQL placeholders use ?. Plain JS values are encoded automatically

(string → varchar, integer → int/bigint, etc.); wrap a value in a MySql.*

helper to pin an exact type. Rows come back as decoded { columnName: value }

records.

const result = await conn.query("SELECT ? AS message", ["hello"]);
const message = result.rows[0]?.message as string;

Execute Statements

execute returns the number of affected rows.

const affected = await conn.execute("INSERT INTO notes (id, body) VALUES (?, ?)", [
  1,
  "hello",
]);

Transactions

Run a block inside a transaction — it commits on success and attempts rollback if

the callback or commit fails, preserving the original error even if rollback fails:

await conn.transaction(async (tx) => {
  tx.execute("UPDATE notes SET body = ? WHERE id = ?", ["updated", 1]);
});
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.