List available FastLED examples.
(
arguments: dict[str, Any], project_root: Path
)
| 1540 | |
| 1541 | |
| 1542 | async def list_examples( |
| 1543 | arguments: dict[str, Any], project_root: Path |
| 1544 | ) -> CallToolResult: |
| 1545 | """List available FastLED examples.""" |
| 1546 | examples_dir = project_root / "examples" |
| 1547 | |
| 1548 | if not examples_dir.exists(): |
| 1549 | return CallToolResult( |
| 1550 | content=[TextContent(type="text", text="Examples directory not found")], |
| 1551 | isError=True, |
| 1552 | ) |
| 1553 | |
| 1554 | examples: list[str] = [] |
| 1555 | for item in examples_dir.iterdir(): |
| 1556 | if item.is_dir() and not item.name.startswith("."): |
| 1557 | # Check if it has a .ino file |
| 1558 | ino_files = list(item.glob("*.ino")) |
| 1559 | if ino_files: |
| 1560 | examples.append(item.name) |
| 1561 | |
| 1562 | examples.sort() |
| 1563 | |
| 1564 | result_text = f"Available FastLED examples ({len(examples)} total):\n\n" |
| 1565 | result_text += "\n".join(f"- {example}" for example in examples) |
| 1566 | |
| 1567 | return CallToolResult(content=[TextContent(type="text", text=result_text)]) |
| 1568 | |
| 1569 | |
| 1570 | async def project_info(arguments: dict[str, Any], project_root: Path) -> CallToolResult: |