Skip to main content
Glama
vfa-khuongdv

MCP Chatwork Server

by vfa-khuongdv

list_messages

Retrieve the list of messages from a specified Chatwork room. Optionally force retrieval of the latest 100 messages regardless of read status.

Instructions

Retrieves the list of messages for a specified room.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
room_idYesThe unique identifier of the Chatwork room.
forceNoIf true, retrieves the latest 100 messages regardless of read status.

Implementation Reference

  • The `listMessagesTool` object defining the tool executor. It calls `client.listMessages(args.room_id, args.force)` and returns the messages as a JSON string.
    export const listMessagesTool = {
      name: "list_messages",
      description: "Retrieves the list of messages for a specified room.",
      schema: ListMessagesSchema,
      executor: async (client: ChatworkClient, args: z.infer<typeof ListMessagesSchema>) => {    
        const messages = await client.listMessages(args.room_id, args.force);
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(messages, null, 2),
            },
          ],
        };
      },
    };
  • The `ListMessagesSchema` Zod schema defining inputs: `room_id` (number, required) and `force` (boolean, optional, defaults to false).
    export const ListMessagesSchema = z.object({
      room_id: z.number().describe("The unique identifier of the Chatwork room."),
      force: z.boolean().optional().default(false).describe("If true, retrieves the latest 100 messages regardless of read status."),
    });
  • src/index.ts:34-42 (registration)
    Registration of the `list_messages` tool with the MCP server via `server.tool()` using the tool's name, description, schema shape, and executor wrapper.
    server.tool(
      listMessagesTool.name,
      listMessagesTool.description,
      listMessagesTool.schema.shape,
      async (args) => {
        // @ts-ignore
        return listMessagesTool.executor(client, args);
      }
    );
  • src/tools/index.ts:2-2 (registration)
    Re-export of `listMessagesTool` from the tools barrel module.
    export * from "./listMessages.js";
  • The `ChatworkClient.listMessages()` API helper that makes the GET request to `/rooms/{roomId}/messages` with an optional `force` parameter.
    async listMessages(roomId: number, force: boolean = false): Promise<ChatworkMessage[]> {
      try {
        const response = await this.client.get<ChatworkMessage[]>(
          `/rooms/${roomId}/messages`,
          {
            params: { force: force ? 1 : 0 },
          }
        );
        return response.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`Chatwork API Error (Room ${roomId}): ${error.message} - ${JSON.stringify(error.response?.data)}`);
        }
        throw error;
      }
    }
Behavior2/5

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

No annotations provided; description does not disclose what happens if room_id is invalid, pagination behavior, or effect of 'force' parameter beyond schema description. Lacks details on response format or potential errors.

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?

Single sentence, no redundant information, front-loaded with purpose.

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

Completeness2/5

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

Given no output schema and no annotations, the description is too minimal. It omits behavioral context (e.g., what response contains, error handling) and does not clarify the 'force' parameter behavior beyond schema.

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?

Input schema has 100% description coverage for both parameters. Description does not add additional meaning beyond schema definitions, so baseline score is appropriate.

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?

Description clearly states verb 'Retrieves', resource 'list of messages', and scope 'for a specified room'. It distinguishes from siblings like 'send_message' and 'delete_message' by targeting listing, though not explicitly differentiating from other get/list tools.

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 on when to use this tool versus alternatives like 'get_room_members' or search tools. No prerequisites or conditions mentioned.

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/vfa-khuongdv/mcp-chatwork'

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