Skip to main content
Glama

Read chat history

wopee_read_chat_history

Retrieve the most recent messages from your project's chat room, including sender details and timestamps, to review discussion context or catch up on past conversations.

Instructions

Read recent messages from the current project's chat room. Returns the last N messages in chronological order, including sender info and timestamps. Use this to understand the conversation context or review what has been discussed. Requires WOPEE_PROJECT_UUID to be configured.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of recent messages to fetch (default: 20, max: 100)

Implementation Reference

  • Main tool export containing the handler function. The handler fetches the project's chat room using FetchChatRoom GQL query, then retrieves recent messages using FetchChatMessages query, formats them with timestamps and author info, and returns them as text. It requires WOPEE_PROJECT_UUID config and limits messages via an optional 'limit' parameter (default 20, max 100). Errors are handled via _parseError helper.
    export const wopeeReadChatHistory = {
      name: ToolName.WOPEE_READ_CHAT_HISTORY,
      config: {
        title: "Read chat history",
        description:
          "Read recent messages from the current project's chat room. Returns the last N messages in chronological order, including sender info and timestamps. Use this to understand the conversation context or review what has been discussed. Requires WOPEE_PROJECT_UUID to be configured.",
        inputSchema: InputSchema.shape,
      },
      handler: async (input: Input) => {
        try {
          const { WOPEE_PROJECT_UUID } = getConfig();
    
          if (!WOPEE_PROJECT_UUID)
            return {
              content: [
                { type: "text" as const, text: "WOPEE_PROJECT_UUID is not set" },
              ],
            };
    
          // First fetch the chat room for this project
          const roomResult = await requestClient<{
            fetchChatRoom: { uuid: string } | null;
          }>(FetchChatRoom, {
            projectUuid: WOPEE_PROJECT_UUID,
          });
    
          if (!roomResult?.fetchChatRoom)
            return {
              content: [
                {
                  type: "text" as const,
                  text: "No chat room found for this project",
                },
              ],
            };
    
          const result = await requestClient<{
            fetchChatMessages: Array<{
              uuid: string;
              authorType: string;
              authorName: string | null;
              content: string;
              contentType: string;
              sourcePlatform: string;
              createdAt: string;
            }>;
          }>(FetchChatMessages, {
            roomUuid: roomResult.fetchChatRoom.uuid,
            limit: input.limit,
          });
    
          const messages = result?.fetchChatMessages || [];
          if (messages.length === 0) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: "No messages found in the chat room",
                },
              ],
            };
          }
    
          const formatted = messages
            .map((msg) => {
              const author = msg.authorName || msg.authorType;
              const time = new Date(msg.createdAt).toISOString();
              return `[${time}] ${author}: ${msg.content}`;
            })
            .join("\n");
    
          return {
            content: [
              {
                type: "text" as const,
                text: `Chat history (${messages.length} messages):\n\n${formatted}`,
              },
            ],
          };
        } catch (error) {
          return _parseError(error);
        }
      },
    };
  • Input schema using Zod: defines 'limit' as an optional integer between 1-100 with default 20. This is the only input parameter for the tool.
    const InputSchema = z.object({
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(20)
        .describe("Number of recent messages to fetch (default: 20, max: 100)"),
    });
  • Import and registration of the tool in the central TOOLS array. The tool is imported from './wopee_read_chat_history/index.js' and added to the TOOLS export array at line 26.
    import { wopeeReadChatHistory } from "./wopee_read_chat_history/index.js";
    import { wopeeCreateGithubIssue } from "./wopee_create_github_issue/index.js";
    
    export const TOOLS = [
      wopeeCreateBlankSuite,
      wopeeFetchAnalysisSuites,
      wopeeFetchExecutedTestCases,
    
      wopeeDispatchAnalysis,
      wopeeDispatchAgent,
    
      wopeeFetchArtifact,
      wopeeUpdateArtifact,
      wopeeGenerateArtifact,
    
      wopeeSendChatMessage,
      wopeeReadChatHistory,
      wopeeCreateGithubIssue,
    ];
  • FetchChatRoom GraphQL query: fetches the chat room UUID for a given project.
    export const FetchChatRoom = `
      query FetchChatRoom($projectUuid: ID!) {
        fetchChatRoom(projectUuid: $projectUuid) {
          uuid
          contextSummary
          createdAt
        }
      }
    `;
  • FetchChatMessages GraphQL query: fetches chat messages for a room with optional limit, returning uuid, authorType, authorName, content, contentType, sourcePlatform, and createdAt.
    export const FetchChatMessages = `
      query FetchChatMessages($roomUuid: ID!, $limit: Int) {
        fetchChatMessages(roomUuid: $roomUuid, limit: $limit) {
          uuid
          authorType
          authorName
          content
          contentType
          sourcePlatform
          createdAt
        }
      }
    `;
Behavior4/5

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

With no annotations, description covers key behavior: returns last N messages, order, data included, and required configuration. Lacks error conditions or what happens without UUID.

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?

Two sentences, no fluff. Immediately states verb, object, and key details. Highly efficient.

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

Completeness5/5

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

For a simple read tool with one parameter, description covers return values, configuration requirement, and purpose. No output schema needed.

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 covers 100% with full description of limit. Description does not add beyond what schema provides; baseline 3 is appropriate.

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?

Description clearly states the tool reads recent chat messages, specifies chronological order and included data (sender info, timestamps). Distinguishes from sending messages.

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?

Explicitly says to use for understanding conversation context or review. Mentions prerequisite (WOPEE_PROJECT_UUID). Does not mention when not to use or compare with siblings like wopee_send_chat_message.

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/Wopee-io/wopee-mcp'

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