Skip to main content
Glama

set_chat_title

Update the title of a Telegram group or channel by providing its chat ID and new title.

Instructions

Change the title of a group or channel.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chat_idYes
titleYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
errorNo
new_titleNo

Implementation Reference

  • The actual handler function for the 'set_chat_title' tool. It checks if the chat is allowed, calls ctx.bot.set_chat_title(), and returns a SetChatTitleResult.
    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,
                result.error,
            )
        return result
  • Pydantic model defining the output schema for the set_chat_title tool, with a 'new_title' field.
    class SetChatTitleResult(ToolResponse):
        new_title: str | None = None
  • Registration of the tool via @mcp.tool decorator, gated by allowed_tools check inside register_chat_tools().
    if allowed_tools is None or "set_chat_title" in allowed_tools:
  • Call from AiogramMCP._register_tools() that wires register_chat_tools to the MCP server.
    register_chat_tools(self._mcp, self._ctx, allowed_tools=at)
  • Permission mapping: set_chat_title requires MODERATION level.
        "set_chat_title": PermissionLevel.MODERATION,
        "set_chat_description": PermissionLevel.MODERATION,
        # admin (3 tools)
        "broadcast": PermissionLevel.ADMIN,
        "subscribe_events": PermissionLevel.ADMIN,
        "unsubscribe_events": PermissionLevel.ADMIN,
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Lacks disclosure of behavioral traits like required permissions, title length limits, or immediate effect. With no annotations, the description should provide more.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single short sentence, concise but overly minimal, missing structure or elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and a mutation tool, the description should mention scope or restrictions (e.g., only for groups/channels, admin rights). Output schema exists but is irrelevant.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameter descriptions in schema (0% coverage) and the description adds no meaning beyond parameter names like chat_id and title.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it changes the title of a group or channel, specifying both verb and resource, which distinguishes it from siblings like set_chat_description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives, such as set_chat_description, or any prerequisites like bot admin status.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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