INNER CODE UNIT · Python

_normalise_allowed_entity_types

stevesolun/ctx · src/ctx/mcp_server/server.py:439

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(
                "allowed entity types must be one of " + ", ".join(RECOMMENDABLE_ENTITY_TYPES)
            )
        if entity_type not in normalised:
            normalised.append(entity_type)
    return frozenset(normalised)


class _JsonRpcError(Exception):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…