load-local-blueprint
Upload and validate local blueprintCode with a specified processId to the Flux MCP server, enabling natural language interaction with AO for automated code handling.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blueprintCode | Yes | ||
| processId | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"blueprintCode": {
"type": "string"
},
"processId": {
"type": "string"
}
},
"required": [
"blueprintCode",
"processId"
],
"type": "object"
}
Implementation Reference
- src/mcp.ts:205-215 (handler)The inline handler function for the 'load-local-blueprint' tool, which takes blueprintCode and processId, runs the Lua code in the AO process using runLuaCode, cleans the output, and returns it.this.server.tool( "load-local-blueprint", "load a local blueprint in an existing AO process", { blueprintCode: z.string(), processId: z.string() }, async ({ blueprintCode, processId }) => { const result = await runLuaCode(blueprintCode, processId, this.signer); return { content: [{ type: "text", text: cleanOutput(result) }], }; } );
- src/lib/runLua.ts:4-29 (helper)Helper function runLuaCode that sends the Lua blueprint code as an 'Eval' message to the AO process and retrieves the result, used by the tool handler.export async function runLuaCode( code: string, processId: string, signer: any, tags?: { name: string; value: string }[] ) { const messageId = await message({ process: processId, signer, data: code, tags: [{ name: "Action", value: "Eval" }, ...(tags || [])], }); await sleep(100); const outputResult = await result({ message: messageId, process: processId, }); if (outputResult.Error) { return JSON.stringify(outputResult.Error); } return JSON.stringify(outputResult.Output.data); }
- src/mcp.ts:14-20 (helper)cleanOutput helper function used by the tool handler to format the result output.function cleanOutput(result: any): string { if (!result) return ""; return JSON.stringify(result, null, 2) .replace(/\\u001b\[\d+m/g, "") .replace(/\\n/g, "\n"); }
- src/mcp.ts:205-215 (registration)Registration of the load-local-blueprint tool on the FluxServer MCP server, including schema and inline handler.this.server.tool( "load-local-blueprint", "load a local blueprint in an existing AO process", { blueprintCode: z.string(), processId: z.string() }, async ({ blueprintCode, processId }) => { const result = await runLuaCode(blueprintCode, processId, this.signer); return { content: [{ type: "text", text: cleanOutput(result) }], }; } );