Skip to main content
Glama
utils.py728 B
from __future__ import annotations import re from typing import TypeVar _T = TypeVar("_T") type MaybeContainer[_T] = _T | dict[str, MaybeContainer[_T]] | list[MaybeContainer[_T]] def _camel_to_snake(name: str) -> str: name = re.sub("([a-z0-9])([A-Z])", r"\1_\2", name) name = re.sub("([A-Z])([A-Z][a-z])", r"\1_\2", name) return name.lower() def camel_to_snake_key_recursive(obj: MaybeContainer[_T]) -> MaybeContainer[_T]: if isinstance(obj, dict): return { _camel_to_snake(key): camel_to_snake_key_recursive(value) for key, value in obj.items() } elif isinstance(obj, list): return [camel_to_snake_key_recursive(item) for item in obj] return obj

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/EEGRCENEM/amadeus-agent'

If you have feedback or need assistance with the MCP directory API, please join our Discord server