Skip to main content
Glama
git-fabric

@git-fabric/chat

Official
by git-fabric

chat_message_list

Retrieve and paginate through chat session messages in chronological order to review conversation history and maintain context.

Instructions

List messages in a session with pagination. Returns messages in chronological order.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesUUID of the session.
limitNoMaximum number of messages to return. Default: 50.
offsetNoNumber of messages to skip (for pagination). Default: 0.

Implementation Reference

  • The listMessages handler function that wraps the adapter's getMessages method. This is the main handler called by the tool registration when executing chat_message_list.
    export async function listMessages(
      adapter: ChatAdapter,
      sessionId: string,
      limit = 50,
      offset = 0,
    ): Promise<ChatMessage[]> {
      return adapter.getMessages(sessionId, limit, offset);
    }
  • The actual getMessages implementation in the environment adapter. Reads messages from GitHub storage and applies pagination with offset and limit parameters.
    async getMessages(sessionId, limit, offset) {
      const msgs = await readMessages(githubToken, stateRepo, sessionId);
      if (!msgs) return [];
      return msgs.messages.slice(offset, offset + limit);
    },
  • src/app.ts:207-235 (registration)
    Tool registration for chat_message_list including its name, description, input schema (sessionId, limit, offset), and the execute function that calls layers.messages.listMessages.
      name: "chat_message_list",
      description:
        "List messages in a session with pagination. Returns messages in chronological order.",
      inputSchema: {
        type: "object",
        properties: {
          sessionId: {
            type: "string",
            description: "UUID of the session.",
          },
          limit: {
            type: "number",
            description: "Maximum number of messages to return. Default: 50.",
          },
          offset: {
            type: "number",
            description: "Number of messages to skip (for pagination). Default: 0.",
          },
        },
        required: ["sessionId"],
      },
      execute: async (args) =>
        layers.messages.listMessages(
          adapter,
          args.sessionId as string,
          args.limit as number | undefined,
          args.offset as number | undefined,
        ),
    },
  • ChatMessage interface defining the output schema returned by chat_message_list. Includes id, sessionId, role, content, model, inputTokens, outputTokens, timestamp, and metadata fields.
    export interface ChatMessage {
      id: string;             // UUID v4
      sessionId: string;
      role: "user" | "assistant" | "system";
      content: string;
      model?: ChatModel;      // set on assistant messages
      inputTokens?: number;   // set on assistant messages
      outputTokens?: number;  // set on assistant messages
      timestamp: string;      // ISO-8601
      metadata?: Record<string, unknown>;
    }
  • The readMessages helper function that retrieves the messages.jsonl file from GitHub and parses it into ChatMessage objects. Used by the getMessages adapter method.
    async function readMessages(
      token: string,
      stateRepo: string,
      sessionId: string,
    ): Promise<{ messages: ChatMessage[]; sha: string } | null> {
      const file = await ghGet(token, stateRepo, messagesPath(sessionId));
      if (!file) return null;
      const messages = file.content
        .split("\n")
        .filter((line) => line.trim() !== "")
        .map((line) => JSON.parse(line) as ChatMessage);
      return { messages, sha: file.sha };
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool returns messages in chronological order and supports pagination, which are useful behavioral traits. However, it lacks details on permissions, rate limits, error conditions, or what the return format looks like (e.g., message structure), leaving gaps for a tool with no annotation coverage.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core action ('List messages in a session with pagination') and adds a key behavioral detail ('Returns messages in chronological order'). There is no wasted wording, making it highly concise and well-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 and no output schema, the description is moderately complete for a read-only list tool. It covers the basic purpose and pagination behavior but omits details like response format, error handling, or usage context relative to siblings. This is adequate but has clear gaps in providing full operational context.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents parameters like 'sessionId' as a UUID and 'limit'/'offset' for pagination. The description adds no additional meaning beyond the schema, such as explaining how pagination works in practice or constraints on parameter values, resulting in the baseline score.

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 verb 'List' and resource 'messages in a session' with the additional detail 'with pagination', making the purpose specific. However, it doesn't explicitly differentiate from sibling tools like 'chat_search' or 'chat_session_get', which might also involve message retrieval, so it doesn't reach the highest score.

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?

The description provides no guidance on when to use this tool versus alternatives such as 'chat_search' for searching messages or 'chat_session_get' for session details. It mentions pagination but doesn't specify scenarios where pagination is necessary or when other tools might be more appropriate.

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/git-fabric/chat'

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