Skip to main content
Glama

agent_read_inbox

Reads incoming messages and room events from the agentlink server, with options to limit results, mark as read, or clear after reading.

Instructions

Baca pesan masuk dan event room (join/leave).

Args: params: limit (default 10), clear (hapus setelah dibaca) Returns: str: JSON daftar pesan dan event

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for 'agent_read_inbox' tool. Reads incoming messages and room events, supports filtering unread messages, marking messages as read, and optionally clearing the inbox. Returns JSON with messages, counts, and read status metadata.
    @mcp.tool(name="agent_read_inbox")
    async def agent_read_inbox(params: ReadInboxInput) -> str:
        """
        Baca pesan masuk dan event room (join/leave).
    
        Args:
            params: limit (default 10), clear (hapus setelah dibaca)
        Returns:
            str: JSON daftar pesan dan event
        """
        room_last_read = _safe_int(current_room.get("last_read_sequence")) if current_room else 0
        visible_messages = inbox
        if params.only_unread:
            visible_messages = [
                message
                for message in inbox
                if not isinstance(message, dict)
                or not isinstance(message.get("sequence"), int)
                or message.get("sequence", 0) > room_last_read
            ]
        messages = visible_messages[-params.limit:]
        max_sequence = _max_message_sequence(messages)
        if params.mark_read and current_room is not None and max_sequence > room_last_read:
            current_room["last_read_sequence"] = max_sequence
            room_last_read = max_sequence
        if params.clear:
            inbox.clear()
        if current_room is not None:
            current_room["local_cached_message_count"] = len(inbox)
        _persist_local_room_state()
        unread_count = len([
            message for message in inbox
            if isinstance(message, dict)
            and isinstance(message.get("sequence"), int)
            and message.get("sequence", 0) > room_last_read
        ])
        return json.dumps({"messages": messages, "count": len(messages),
            "total_in_inbox": len(inbox), "cleared": params.clear,
            "only_unread": params.only_unread, "mark_read": params.mark_read,
            "last_read_sequence": room_last_read,
            "unread_count": unread_count,
            "cache_path": current_room.get("local_cache_path") if current_room else None}, indent=2)
  • Input schema for agent_read_inbox tool using Pydantic BaseModel. Defines parameters: limit (1-100 messages), only_unread (filter by read status), mark_read (update read cursor), and clear (delete after reading).
    class ReadInboxInput(BaseModel):
        model_config = ConfigDict(extra="forbid")
        limit: int  = Field(default=10, ge=1, le=100, description="Jumlah pesan")
        only_unread: bool = Field(default=False, description="True = hanya tampilkan pesan di atas cursor baca lokal")
        mark_read: bool = Field(default=True, description="True = simpan cursor baca lokal dari hasil yang dibaca")
        clear: bool = Field(default=False, description="Hapus setelah dibaca")
  • Tool registration using @mcp.tool decorator with name='agent_read_inbox', registering the handler function with the FastMCP server instance.
    @mcp.tool(name="agent_read_inbox")
Behavior3/5

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

No annotations are provided, so the description carries full burden. It discloses that it can 'clear (hapus setelah dibaca)' messages after reading, which is a key behavioral trait. However, it doesn't mention other behaviors like rate limits, authentication needs, or what 'event room' entails. The description adds some context but is incomplete for a tool with potential side effects.

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

Conciseness4/5

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

The description is appropriately sized with three sentences: purpose, args, and returns. It's front-loaded with the main function. However, the 'Args' and 'Returns' sections are brief and could be more integrated, but there's no wasted text. It's efficient but not perfectly structured.

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

Completeness3/5

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

Given no annotations, 0% schema description coverage, and an output schema (which handles return values), the description is partially complete. It covers the basic purpose and some parameters but misses key behavioral details (e.g., side effects of 'mark_read') and usage guidelines. For a tool with potential data modification (clear), it should do more to explain implications.

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?

Schema description coverage is 0%, so the description must compensate. It mentions 'limit (default 10), clear (hapus setelah dibaca)', covering 2 of the 4 parameters (limit, clear) but omitting 'only_unread' and 'mark_read'. The description adds minimal meaning beyond the schema, failing to fully address the coverage gap. With 0% schema coverage, this is inadequate.

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

Purpose4/5

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

The description clearly states the tool reads inbox messages and room events (join/leave), providing a specific verb ('Baca' meaning 'Read') and resources ('pesan masuk dan event room'). It distinguishes from siblings like agent_send (for sending) or room_list (for listing rooms), though it doesn't explicitly compare to them. The purpose is clear but lacks explicit sibling differentiation.

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 is provided on when to use this tool versus alternatives. While it's implied for reading messages/events, there's no mention of prerequisites (e.g., being in a room), when not to use it, or how it compares to other tools like room_local_summary. The description only states what it does, not when to use it.

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/syuaibsyuaib/ssyubix'

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