refactor: cleanup MCP tools + caching (da 10 a 7 tool)#399
Merged
Conversation
Da 10 a 7 tool MCP, con caching TTL 120s e backend consolidati. Tool rimossi: - so_catalog_inventory_search → assorbito in so_inventory_search - so_list_source_items → assorbito in so_inventory_search - so_recommend_sources → assorbito in so_inventory_search - so_inventory_query → assorbito in so_source_check - so_inventory_status → assorbito in so_source_check Tool finali (7): 1. so_registry_query — invariato 2. so_radar_summary — + caching 3. so_inventory_search — 3 modalita' (keyword/source_id/query) 4. so_source_check — query + status/diff 5. so_catalog_signals — + caching 6. so_find_by_url — + caching 7. so_source_overview — invariato Backend: eliminati _discovery.py, _recommend.py. Creati _inventory_search.py (unifica search/list/recommend) e _source_check.py (unifica query/status/diff). Caching: TtlCache 120s su tutti i tool read-only. Chiave cache include parametri normalizzati. Test: 54/54 passano. Mypy: ok. Lint: ok.
3920426 to
204af23
Compare
- Aggiunta type annotation _query_cache: TtlCache[Any] per mypy CI (TtlCache estende typing.Generic, mypy richiede var-annotated). - README root: da 12 a 7 tool dopo refactoring MCP.
TtlCache[K, V] definito in lab-connectors. L'annotazione TtlCache[Any] dava 'expects 2 type arguments, but 1 given'. Corretto in TtlCache[tuple[Any, ...], dict[str, Any]].
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.
Sintesi
Refactoring dei tool MCP di Source Observatory: da 10 a 7 strumenti, con caching TTL 120s e backend consolidati. Stessa logica di PR #607 su clean-query.
Cosa cambia
Tool rimossi (6)
so_catalog_inventory_searchso_inventory_search(query=)so_list_source_itemsso_inventory_search(source_id=)so_recommend_sourcesso_inventory_search(keyword=)so_inventory_queryso_source_check(default mode)so_inventory_statusso_source_check(include_diff=True)so_inventory_diffso_source_check(include_diff=True)Tool finali (7)
so_registry_query— invariatoso_radar_summary— + caching (coninclude_history=True)so_inventory_search— 3 modalità automatiche (keyword / source_id / query)so_source_check— query source_check_results + status/diffso_catalog_signals— + cachingso_find_by_url— + cachingso_source_overview— composito (invariato)Backend
_discovery.py,_recommend.py_inventory_search.py(unifica search/list/recommend),_source_check.py(unifica query/status/diff)_inventory.py(sdoppiato nei due nuovi moduli)Caching
TtlCachedalab_connectors.mcpcon TTL 120s su tutti i tool read-only. Chiave include parametri normalizzati — query identiche tornano in ~100ms invece di 2-6s.Checklist
Modifica script (radar, inventory, source-check, MCP)
Skills o MCP tools
Documentazione
pytest tests/passa (54/54)ruff check .passamypy scripts/ so_mcp/passaVerifica
source-observatory_*— rispondono correttamenteNote per chi revisiona
so_inventory_query,so_inventory_status,so_catalog_inventory_search,so_list_source_items,so_recommend_sourcesnon esistono più. Sostituiti daso_source_checkeso_inventory_search.inventory-triage.mdesource-check.mdaggiornate con i nuovi nomi.so_inventory_searchsceglie la modalità automaticamente in base ai parametri passati (keyword → recommend, source_id → list, query → search).so_source_checkconinclude_diff=Trueunisce inventory_status + inventory_diff.