mcp
The mcp namespace — 3 functions.
mcp/call
mcp.call(toolName, args?)
Call an MCP tool asynchronously. Returns a request ID to poll for the result. Use with task.await or manual polling via mcp.poll().
Parameters
toolNamestring— Name of the MCP tool to callargstable | string(optional) — Arguments for the tool. Table is converted to JSON, string is passed as-is
Returns string — Request ID for polling with mcp.poll()
mcp/listTools
mcp.listTools()
List all available MCP tool names.
Returns {string} — Array of tool name strings
mcp/poll
mcp.poll(requestId)
Poll for a completed MCP tool call result. Returns nil if not yet complete.
Parameters
requestIdstring— Request ID from mcp.call()
Returns { id: string, is_error: boolean, content: string } | nil — Result table with tool output, or nil if still pending