Read chat history
wopee_read_chat_historyRetrieve 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
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number 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)"), }); - src/tools/index.ts:10-28 (registration)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 } } `;