Skip to main content
Glama

poll_messages

Wait for and retrieve new messages from a session, enabling autonomous agents to collaborate in real time. Blocks until messages arrive or timeout, ideal for continuous agent loops.

Instructions

Wait for and read new messages from a session. AUTONOMOUS LOOP tool for agent communication.

AUTOMATIC TRIGGERS - Call this when:

  • You're running an autonomous agent loop

  • Waiting for other agents to complete work

  • Need real-time collaboration without human intervention

This tool BLOCKS until new messages arrive or the timeout expires. It is the primary mechanism for agents to run continuous collaboration.

USAGE PATTERN FOR AUTONOMOUS AGENTS: 1. Call poll_messages(session_id, agent_id, timeout=30) 2. Process any returned messages 3. Send responses via send_message 4. Repeat from step 1 until the session is complete

WORKFLOW POSITION: Main loop tool for autonomous agents.

PARAMETERS:

  • session_id: Session to monitor

  • agent_id: Your agent ID

  • timeout: Max seconds to wait (default: 30, 0 = no wait)

  • limit: Max messages to return (default: 50)

  • msg_types: Filter by message types (optional)

  • from_agent: Filter by sender (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
timeoutNo
agent_idYes
msg_typesNo
from_agentNo
session_idYes
Behavior4/5

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

With no annotations provided, the description carries the burden of behavioral disclosure. It clearly states that the tool BLOCKS until messages arrive or timeout expires, and explains its role in continuous collaboration. It could add what happens on timeout or whether messages are consumed/destroyed, but the most important behavior is disclosed.

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?

The description is well-structured and front-loaded, but repetitive: 'AUTONOMOUS LOOP tool', 'primary mechanism for agents to run continuous collaboration', and 'WORKFLOW POSITION: Main loop tool' all convey the same idea. The usage pattern is useful, but the text could be tightened without losing meaning.

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

Completeness4/5

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

For a polling tool with no annotations and no output schema, the description covers when to use it, how to use it, the blocking behavior, and all parameters. It lacks explicit details about timeout response behavior and differentiation from read-focused siblings, but overall it provides enough context for an agent to select and call the tool correctly.

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

Parameters4/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 does: all six parameters are listed with concise functional meaning, defaults for timeout and limit, and a special note that timeout=0 means no wait. Some entries like 'msg_types: Filter by message types' are terse, but sufficient for correct invocation.

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 identifies a specific action ('Wait for and read new messages from a session') and clearly frames the tool as the main autonomous-loop communication mechanism. It is unambiguous about what the tool does, though it does not explicitly contrast itself with sibling tools like read_messages or tail_messages, which keeps it from a 5.

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

Usage Guidelines4/5

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

The description gives explicit trigger conditions: running an autonomous loop, waiting for other agents, and needing real-time collaboration. It also provides a concrete usage pattern with send_message and a repeat loop. However, it does not mention alternatives or state when not to use this tool, so it stops short of full exclusion guidance.

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/Vedant9500/OpenLMlib'

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