INNER CODE UNIT · Python
_normalise_allowed_tool_names
stevesolun/ctx · src/ctx/mcp_server/server.py:431
def _normalise_allowed_tool_names(
tool_names: Iterable[str] | None,
) -> frozenset[str] | None:
if tool_names is None:
return None
return frozenset(str(name).strip() for name in tool_names if str(name).strip())
def _normalise_allowed_entity_types(
entity_types: Iterable[str] | None,
) -> frozenset[str] | None:
if entity_types is None:
return None
normalised: list[str] = []
for raw in entity_types:
entity_type = normalize_entity_type(raw, allowed=RECOMMENDABLE_ENTITY_TYPES)
if entity_type is None:
raise ValueError(