list_official_packages
List all official Flet extension packages to discover extra capabilities beyond the core library.
Instructions
Get a list of all official Flet extension packages (e.g. flet-audio, flet-video). Use this to see what official extra capabilities Flet supports outside the core library.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/flet_mcp/server.py:44-50 (handler)The MCP tool handler for list_official_packages - an async function decorated with @mcp.tool() that delegates to pkg_fetcher.list_official_packages()
@mcp.tool() async def list_official_packages() -> list[str]: """ Get a list of all official Flet extension packages (e.g. flet-audio, flet-video). Use this to see what official extra capabilities Flet supports outside the core library. """ return await pkg_fetcher.list_official_packages() - src/flet_mcp/services/packages.py:39-55 (handler)The actual implementation of list_official_packages in FletPackageFetcher class - fetches official Flet extension packages from the GitHub API (flet-dev/flet monorepo), with a fallback list of known packages
async def list_official_packages(self) -> list[str]: """Scrapes the Flet monorepo to find all official extensions.""" url = "https://api.github.com/repos/flet-dev/flet/git/trees/main?recursive=1" data = await self._fetch_json(url, headers=self.github_headers) if not data or "tree" not in data: return self._FALLBACK_OFFICIAL packages = [] for item in data["tree"]: path = item["path"] if path.startswith("sdk/python/packages/") and item["type"] == "tree": parts = path.split("/") if len(parts) == 4: packages.append(parts[3]) return sorted(list(set(packages))) if packages else self._FALLBACK_OFFICIAL - Fallback list of official Flet packages used when the GitHub API call fails
_FALLBACK_OFFICIAL = [ "flet-ads", "flet-audio", "flet-audio-recorder", "flet-camera", "flet-charts", "flet-code-editor", "flet-color-pickers", "flet-datatable2", "flet-flashlight", "flet-geolocator", "flet-lottie", "flet-map", "flet-permission-handler", "flet-rive", "flet-secure-storage", "flet-video", "flet-webview" ] - Helper method _fetch_json used to make cached HTTP requests to GitHub API
async def _fetch_json(self, url: str, headers: dict | None = None) -> dict | None: if url in cache: return cache[url] try: response = await self.client.get(url, headers=headers) if response.status_code == 200: data = response.json() cache.set(url, data, expire=86400) return data except Exception: pass - src/flet_mcp/server.py:44-50 (registration)Tool registration via @mcp.tool() decorator on the list_official_packages function in server.py
@mcp.tool() async def list_official_packages() -> list[str]: """ Get a list of all official Flet extension packages (e.g. flet-audio, flet-video). Use this to see what official extra capabilities Flet supports outside the core library. """ return await pkg_fetcher.list_official_packages()