create-sqlite-based-handler
Generate SQLite-based handlers on Flux MCP server using process ID and handler code, enabling automated creation and management of database interactions without manual coding.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| handlerCode | Yes | ||
| processId | Yes |
Implementation Reference
- src/mcp.ts:160-166 (handler)Executes the tool by prepending SQLite initialization code to the user-provided handlerCode and running it as Lua in the AO process.async ({ processId, handlerCode }) => { const code = `local sqlite = require('lsqlite3')\nDb = sqlite.open_memory()\n${handlerCode}`; const result = await runLuaCode(code, processId, this.signer); return { content: [{ type: "text", text: cleanOutput(result) }], }; }
- src/mcp.ts:159-159 (schema)Zod schema defining the input parameters: processId and handlerCode.{ processId: z.string(), handlerCode: z.string() },
- src/mcp.ts:156-167 (registration)Full registration of the 'create-sqlite-based-handler' tool including name, description, schema, and handler function.this.server.tool( "create-sqlite-based-handler", "create a new sqlite based handler in an existing AO process", { processId: z.string(), handlerCode: z.string() }, async ({ processId, handlerCode }) => { const code = `local sqlite = require('lsqlite3')\nDb = sqlite.open_memory()\n${handlerCode}`; const result = await runLuaCode(code, processId, this.signer); return { content: [{ type: "text", text: cleanOutput(result) }], }; } );
- src/local/index.js:117-125 (handler)Alternative implementation in local server, similar logic without signer.async ({ processId, handlerCode }) => { const code = `local sqlite = require('lsqlite3') Db = sqlite.open_memory() ${handlerCode}`; const result2 = await runLuaCode(code, processId); return { content: [{ type: "text", text: cleanOutput(result2) }], }; }