Skip to main content
Glama

set_chat_title

Update group or channel titles in Telegram by providing chat ID and new title. This tool modifies chat names for organization and clarity.

Instructions

Change the title of a group or channel.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chat_idYes
titleYes

Implementation Reference

  • The handler for the set_chat_title tool, which validates chat access, applies rate limiting, and performs the API call to change the chat title.
    @mcp.tool
    async def set_chat_title(chat_id: int, title: str) -> SetChatTitleResult:
        """Change the title of a group or channel."""
        if not ctx.is_chat_allowed(chat_id):
            result = SetChatTitleResult(ok=False, error=f"Chat {chat_id} is not allowed.")
            if ctx.audit_logger:
                ctx.audit_logger.log(
                    "set_chat_title",
                    {"chat_id": chat_id, "title": title},
                    result.ok,
                    result.error,
                )
            return result
    
        try:
            if ctx.rate_limiter:
                await ctx.rate_limiter.acquire()
            await ctx.bot.set_chat_title(chat_id=chat_id, title=title)
            result = SetChatTitleResult(ok=True, new_title=title)
        except (TelegramBadRequest, TelegramForbiddenError) as exc:
            result = SetChatTitleResult(ok=False, error=str(exc))
    
        if ctx.audit_logger:
            ctx.audit_logger.log(
                "set_chat_title",
                {"chat_id": chat_id, "title": title},
                result.ok,
  • Data model for the result returned by the set_chat_title tool.
    class SetChatTitleResult(ToolResponse):
        new_title: str | None = None

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/Py2755/aiogram-mcp'

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