Skip to content

The agent that grows with you

refactor(toolsets,mcp_serve): keep defensive .get()/try semantics in static copy and plugin bundle

Tekniumb00d35ff5cbf
diff --git a/mcp_serve.py b/mcp_serve.py
index e1c52f8907b..95eebded688 100644
--- a/mcp_serve.py
+++ b/mcp_serve.py
@@ -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)
diff --git a/toolsets.py b/toolsets.py
index aa9143f69e0..a36469db951 100644
--- a/toolsets.py
+++ b/toolsets.py
@@ -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)