refactor(toolsets,mcp_serve): keep defensive .get()/try semantics in static copy and plugin bundle
This commit is contained in:
@@ -130,8 +130,7 @@ def _row_to_index_entry(row: dict) -> dict:
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
if not origin: # pre-origin_json rows: synthesize the minimal origin from columns
|
||||
origin = {k: row.get(k) for k in ("chat_id", "chat_type", "thread_id", "user_id")}
|
||||
origin["platform"] = row.get("source", "")
|
||||
origin = {"platform": row.get("source", ""), **{k: row.get(k) for k in ("chat_id", "chat_type", "thread_id", "user_id")}}
|
||||
|
||||
input_tokens = int(row.get("input_tokens") or 0)
|
||||
output_tokens = int(row.get("output_tokens") or 0)
|
||||
|
||||
@@ -308,7 +308,7 @@ def get_toolset(name: str, *, include_registry: bool = True) -> Optional[Dict[st
|
||||
"""
|
||||
toolset = TOOLSETS.get(name)
|
||||
if not include_registry:
|
||||
return {**toolset, "tools": list(toolset["tools"]), "includes": list(toolset["includes"])} if toolset else None
|
||||
return {**toolset, "tools": list(toolset.get("tools", [])), "includes": list(toolset.get("includes", []))} if toolset else None
|
||||
|
||||
registry = _registry()
|
||||
if registry is None:
|
||||
@@ -373,7 +373,10 @@ def _plugin_platform_bundle(name: str) -> List[str]:
|
||||
except Exception:
|
||||
return []
|
||||
tools = set(_HERMES_CORE_TOOLS)
|
||||
tools.update(e.name for e in _registry_call("get_all_entries", ()) if e.toolset == platform_name)
|
||||
try:
|
||||
tools.update(e.name for e in _registry_call("get_all_entries", ()) if e.toolset == platform_name)
|
||||
except Exception:
|
||||
pass
|
||||
return list(tools)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user