list_flet_controls
Discover all available Flet UI controls to identify which interface elements can be built.
Instructions
Get a complete list of all available Flet UI controls. Use this to discover what UI elements can be built in Flet.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/flet_mcp/server.py:34-40 (registration)The MCP tool registration and handler: decorated with @mcp.tool(), this is the MCP entry point that delegates to docs_fetcher.list_flet_controls().
@mcp.tool() async def list_flet_controls() -> list[str]: """ Get a complete list of all available Flet UI controls. Use this to discover what UI elements can be built in Flet. """ return await docs_fetcher.list_flet_controls() - The actual implementation logic in FletDocsFetcher class: fetches the GitHub repo tree via get_docs_tree(), filters paths under 'website/docs/controls/', extracts control names, deduplicates, and returns sorted list.
async def list_flet_controls(self) -> list[str]: """Returns a list of all available Flet UI controls.""" all_docs = await self.get_docs_tree() # Filter only the files that live in the controls directory controls = [] for path in all_docs: if "website/docs/controls/" in path: # Extract just the control name from the path (e.g., 'dropdown/index.md' -> 'dropdown') parts = path.split("website/docs/controls/") if len(parts) > 1: clean_name = parts[1].split("/")[0].replace(".md", "") if clean_name not in controls: controls.append(clean_name) return sorted(controls) - Helper method get_docs_tree() called by list_flet_controls: uses GitHub Tree API to recursively fetch all file paths, then filters for Markdown files under website/docs/.
async def get_docs_tree(self) -> list[str]: """Gets a flat list of all Markdown documentation paths in the Flet repo.""" # The Tree API is the most efficient way to get all files in a repo at once repo_api_url = "https://api.github.com/repos/flet-dev/flet/git/trees/main?recursive=1" data = await self._fetch_json(repo_api_url) if not data or "tree" not in data: return [] # Filter out everything except markdown files in the docs folder doc_paths = [ item["path"] for item in data["tree"] if item["path"].startswith("website/docs/") and item["path"].endswith(".md") ] return doc_paths - tests/test_fetcher.py:30-34 (helper)Test case verifying list_flet_controls returns >100 controls and includes 'dropdown'.
@pytest.mark.asyncio async def test_list_flet_controls(docs_fetcher): controls = await docs_fetcher.list_flet_controls() assert len(controls) > 100 assert "dropdown" in controls