Skip to main content
Glama

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

NameRequiredDescriptionDefault
handlerCodeYes
processIdYes

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "handlerCode": { "type": "string" }, "processId": { "type": "string" } }, "required": [ "processId", "handlerCode" ], "type": "object" }

Implementation Reference

  • 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) }], }; }
  • 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) }], }; } );
  • 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) }], }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/asrvd/flux'

If you have feedback or need assistance with the MCP directory API, please join our Discord server