Skip to main content
Glama

flappy.simulate

Simulate avian flight dynamics by providing wing morphology, control schedules, and duration. Returns pose histories, energy metrics, and solver provenance for bird flight analysis.

Instructions

Run the Flappy dynamics simulator for a mission profile. Provide wing morphology, control schedule, and duration. Returns pose histories, energy metrics, and solver provenance. Example: {"scenario_id":"demo","duration_s":8.0}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYes
scenarioNo
trajectoryYes

Implementation Reference

  • Primary handler implementing the tool logic: orchestrates Flappy CLI execution or fallback stub trajectory generation.
    def execute_flappy(request: FlappyRequest) -> FlappyResponse:
        """Execute Flappy using the request payload.
    
        If the configured binary exists, the helper writes a temporary configuration file containing
        the scenario dictionary and launches the CLI. Otherwise a deterministic sinusoidal trajectory is
        generated using the fallback parameters.
        """
    
        scenario_dict = request.scenario or _build_fallback_scenario(request.fallback)
    
        if _binary_exists():  # pragma: no cover - integration path
            return _run_cli(scenario_dict, request.fallback)
    
        trajectory = _generate_stub_trajectory(scenario_dict, request.fallback)
        return FlappyResponse(trajectory=trajectory, source="generated", scenario=scenario_dict)
  • Registers the flappy.simulate tool on the FastMCP app, wrapping execute_flappy as the handler.
    @app.tool(
        name="flappy.simulate",
        description=(
            "Run the Flappy dynamics simulator for a mission profile. "
            "Provide wing morphology, control schedule, and duration. "
            "Returns pose histories, energy metrics, and solver provenance. "
            "Example: {\"scenario_id\":\"demo\",\"duration_s\":8.0}"
        ),
        meta={"version": "0.1.0", "categories": ["simulation", "dynamics"]},
    )
    def run(request: FlappyRequest) -> FlappyResponse:
        return execute_flappy(request)
  • Pydantic input schema defining the tool's request parameters: scenario and fallback.
    class FlappyRequest(BaseModel):
        """Request payload for a Flappy simulation."""
    
        scenario: dict[str, Any] | None = Field(
            default=None,
            description="Full scenario dictionary passed directly to flappy_cli.",
        )
        fallback: FlappyFallback = Field(
            default_factory=FlappyFallback,
            description="Parameters used if the binary is unavailable or when generating a stub trajectory.",
        )
  • Pydantic output schema: FlappyResponse with trajectory points and metadata.
    class TrajectoryPoint(BaseModel):
        t: float
        angle: float
    
    
    class FlappyResponse(BaseModel):
        """Response returned by `execute_flappy`."""
    
        trajectory: list[TrajectoryPoint]
        source: str
        scenario: dict[str, Any] | None = None
  • Helper function to execute the Flappy CLI binary using subprocess with temp files.
    def _run_cli(scenario: dict[str, Any], fallback: FlappyFallback) -> FlappyResponse:
        with tempfile.TemporaryDirectory(prefix="flappy_mcp_") as tmpdir:
            cfg_path = Path(tmpdir) / "config.json"
            out_path = Path(tmpdir) / "trajectory.json"
            cfg_payload = {"scenario": scenario}
            cfg_path.write_text(json.dumps(cfg_payload), encoding="utf-8")
    
            try:
                result = subprocess.run(  # pragma: no cover - integration path
                    [FLAPPY_BIN, "--config", str(cfg_path), "--output", str(out_path)],
                    check=False,
                    capture_output=True,
                )
            except FileNotFoundError as exc:  # pragma: no cover
                raise RuntimeError("Flappy binary not found") from exc
    
            if result.returncode != 0:  # pragma: no cover
                raise RuntimeError(result.stderr.decode("utf-8", errors="ignore"))
    
            trajectory_data = json.loads(out_path.read_text(encoding="utf-8"))
            trajectory = [TrajectoryPoint(**point) for point in trajectory_data.get("trajectory", [])]
            return FlappyResponse(trajectory=trajectory, source=str(out_path), scenario=scenario)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions what the tool returns (pose histories, energy metrics, solver provenance) but doesn't disclose behavioral traits like computational cost, error conditions, or whether it's read-only or mutating. The example is helpful but insufficient for full transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose. The second sentence details inputs and outputs, and the third provides an example. Each sentence adds value, though the example could be more integrated.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (dynamics simulator with 1 parameter but nested schema), no annotations, and an output schema (which handles return values), the description is moderately complete. It covers purpose, inputs, and outputs, but lacks usage context and detailed parameter semantics, leaving gaps for effective tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It lists required inputs (wing morphology, control schedule, duration) and provides an example, but doesn't explain parameter meanings, formats, or constraints beyond the schema. The example clarifies the structure but leaves semantics vague.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Run the Flappy dynamics simulator for a mission profile.' It specifies the action (run simulator), target (Flappy dynamics simulator), and context (mission profile). However, with no sibling tools, differentiation isn't needed, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions an example but doesn't explain prerequisites, constraints, or typical use cases. With no sibling tools, this is less critical, but still lacks context for effective tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Three-Little-Birds/flappy-mcp'

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