Skip to main content
Glama

litex_flow

Execute LiteX board targets with custom arguments for FPGA development, enabling hardware configuration and testing through the fpgaZeroMCP server's toolchain.

Instructions

Run a generic LiteX board target with caller-provided args.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
boardYesLiteX board target
argsNoExtra LiteX CLI args
timeoutNoTimeout in seconds

Implementation Reference

  • Main handler function for litex_flow tool - a generic LiteX flow runner that accepts board, args, and timeout parameters and delegates to _run_litex helper
    def litex_flow(
        board: str,
        args: list[str] | None = None,
        timeout: int = 600,
    ) -> dict:
        """Generic LiteX flow runner with caller-provided args."""
        return _run_litex(board, args or [], timeout)
  • Core helper function _run_litex that executes the LiteX command using subprocess, handles errors, timeouts, and returns structured results
    def _run_litex(board: str, args: list[str] | None, timeout: int) -> dict:
        cmd = _build_litex_cmd(board, args)
        try:
            result = subprocess.run(
                cmd, capture_output=True, text=True, timeout=timeout
            )
            return {
                "success": result.returncode == 0,
                "cmd": cmd,
                "stdout": result.stdout,
                "stderr": result.stderr,
            }
        except FileNotFoundError:
            return {"success": False, "error": "LiteX entrypoint not found."}
        except subprocess.TimeoutExpired:
            return {"success": False, "error": f"LiteX timed out after {timeout} s."}
  • Helper function _build_litex_cmd that constructs the LiteX command line invocation
    def _build_litex_cmd(board: str, args: list[str] | None) -> list[str]:
        if not board:
            raise ValueError("board is required")
        return [sys.executable, "-m", f"litex_boards.targets.{board}"] + (args or [])
  • server.py:377-397 (registration)
    Tool registration defining litex_flow with its input schema (board, args, timeout parameters) and description
    types.Tool(
        name="litex_flow",
        description="Run a generic LiteX board target with caller-provided args.",
        inputSchema={
            "type": "object",
            "properties": {
                "board": {"type": "string", "description": "LiteX board target"},
                "args": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "Extra LiteX CLI args",
                },
                "timeout": {
                    "type": "integer",
                    "default": 600,
                    "description": "Timeout in seconds",
                },
            },
            "required": ["board"],
        },
    ),
  • Tool dispatch handler that invokes litex_flow via asyncio.to_thread with arguments from the MCP request
    case "litex_flow":
        result = await asyncio.to_thread(
            litex_flow,
            board=arguments["board"],
            args=arguments.get("args"),
            timeout=arguments.get("timeout", 600),
        )

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/bard0-design/fpgaZeroMCP'

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