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
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | ||
| title | Yes |
Implementation Reference
- aiogram_mcp/tools/chats.py:196-222 (handler)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, - aiogram_mcp/tools/chats.py:38-39 (schema)Data model for the result returned by the set_chat_title tool.
class SetChatTitleResult(ToolResponse): new_title: str | None = None