flet-mcp: token-efficient get_api, ranked icon search, agent tool fixes#6654
Merged
Conversation
get_api: - default response is compact signature-style text (~44% smaller than JSON, tokenizes better); format="json" escape hatch - member docstrings trimmed to first sentence; member=<name> drill-down returns full docs; query=<substring> filters members, walking base classes (TextField border props live on FormFieldControl) - event handler types unwrapped (Optional[EventHandler[TapEvent[...]]] -> on_tap(TapEvent)); Optional[X] -> X?; field(...) defaults unwrapped - "fields" member section (dataclass types, event payloads) now included - name collisions resolved by ranked candidates instead of last-wins: Text/Image/Rect no longer shadowed by canvas shapes; dotted names (canvas.Text, flet_map.Camera) select alternates; response notes them - Sphinx :attr:/:class: roles stripped from all rendered docstrings get_example pages large examples per file; get_doc capped with a narrowing hint; search_enum_members ranked (exact/prefix/substring) with Material style variants collapsed. Icon search rebuilt on Google's fonts.google.com icon metadata (tags + popularity, Apache-2.0), committed as data/icons.json and refreshed via `python -m flet_mcp.build.icons`; hand-curated icons.yml and the pyyaml dependency removed. IconStore no longer imports the flet package (find_icon was broken on runtime-only installs) and ranks by tags/popularity with golden-query regression tests.
…ents pubspec The build template's pubspec.yaml guarded the web-only `assets:` section (app/app.zip, app/app.zip.hash) with Jinja tags hidden in YAML comments. Any tooling that round-trips the file with a YAML parser — like the CI release patch script — strips comments, making the assets unconditional and failing native builds on the missing app/app.zip. Move the conditionality into flet build: the template pubspec is now plain YAML, and build_base.py injects flutter.assets into the rendered pubspec when config_platform is "web", in the same post-cookiecutter patching pass as the local-dev and test-mode overrides. Native platforms get no assets entry, as before — serious_python places the app inside the bundle. Also remove the vestigial flet_geolocator Jinja block: its dependencies were themselves commented out, so it could never take effect.
Deploying flet-website-v2 with
|
| Latest commit: |
981befa
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2b671c39.flet-website-v2.pages.dev |
| Branch Preview URL: | https://feature-flet-mcp-agent-tools.flet-website-v2.pages.dev |
A second top-level `tests` package collides with packages/flet/tests under pytest's prepend import mode — whichever imports first owns `tests` in sys.modules and the other's modules fail collection. Without the __init__.py, pytest names the modules by file (unique basenames), which is what `pytest packages/*/tests` in CI needs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #6655
What
Overhauls flet-mcp's tool outputs for LLM-agent consumption — smaller, correct, and searchable — based on token/trace analysis of real agent sessions in Flet Studio.
get_apiformat="json"escape hatch for programmatic consumers; errors stay JSONmember=<name>drill-down returns full docs;query=<substring>filters members walking base classes (e.g. TextField's border props live onFormFieldControl)Optional[EventHandler[TapEvent[GestureDetector]]]→on_tap(TapEvent);Optional[X]→X?;field(...)defaults unwrappedfieldsmember section (dataclass types, event payloads) was dropped from responses —TextStylereturned a bare one-linerText/Image/Rectwere silently shadowed by canvas shapes; dotted names (canvas.Text,flet_map.Camera) select alternates, and responses note them:attr:/:class:roles stripped from rendered docstringsOther tools
get_examplepages large examples per file (largest bundled example is 111k chars);get_doccapped with a narrowing hintsearch_enum_membersranked exact → prefix → substring with Material style variants (_OUTLINED/_ROUNDED/_SHARP) collapsed — "remove" now surfacesREMOVE, not fiveBOOKMARK_REMOVEvariantsIcon search
find_iconwas broken on runtime-only installs —IconStoreimported thefletpackage for icon names; it now sources them from the bundled api.jsondata/icons.json, refreshed viapython -m flet_mcp.build.icons; hand-curatedicons.ymland thepyyamldependency removedminus→REMOVE,trash→DELETE,gear→SETTINGS, …Tests
39 tests in new
packages/flet-mcp/tests/(ApiStore rendering/collisions/query, IconStore ranking/golden queries). Verified live against a running Flet Studio agent: get_api fetches dropped from ~20k chars to ~1k avg per call, and icon lookups resolve first-try where they previously errored and fell back.Summary by Sourcery
Revamp flet-mcp tooling for LLM agents with more compact API output, robust member querying, and improved icon search backed by committed metadata.
New Features:
Bug Fixes:
Enhancements:
Build:
CI:
Deployment:
Documentation:
Tests:
Chores: