get_room_members
Retrieve the list of members in a Chatwork room by providing the room ID. Enables member access management and automation.
Instructions
Get the list of members in a room.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| room_id | Yes | The unique identifier of the Chatwork room. |
Implementation Reference
- src/tools/getRoomMembers.ts:5-20 (handler)The main tool object for 'get_room_members'. Defines name, description, Zod schema, and executor function that calls client.getRoomMembers(args.room_id) and returns the result as JSON.
export const getRoomMembersTool = { name: "get_room_members", description: "Get the list of members in a room.", schema: GetRoomMembersSchema, executor: async (client: ChatworkClient, args: z.infer<typeof GetRoomMembersSchema>) => { const members = await client.getRoomMembers(args.room_id); return { content: [ { type: "text" as const, text: JSON.stringify(members, null, 2), }, ], }; }, }; - src/schemas/members.ts:1-5 (schema)Zod schema for GetRoomMembersSchema: expects a 'room_id' (number) input parameter.
import { z } from "zod"; export const GetRoomMembersSchema = z.object({ room_id: z.number().describe("The unique identifier of the Chatwork room."), }); - src/index.ts:54-62 (registration)Registers the 'get_room_members' tool with the MCP server using getRoomMembersTool.name, .description, .schema.shape, and .executor.
server.tool( getRoomMembersTool.name, getRoomMembersTool.description, getRoomMembersTool.schema.shape, async (args) => { // @ts-ignore return getRoomMembersTool.executor(client, args); } ); - src/api/client.ts:62-72 (helper)API client method getRoomMembers(roomId) that makes a GET request to /rooms/{roomId}/members and returns ChatworkMember[] data.
async getRoomMembers(roomId: number): Promise<ChatworkMember[]> { try { const response = await this.client.get<ChatworkMember[]>(`/rooms/${roomId}/members`); return response.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Chatwork API Error (Get Members Room ${roomId}): ${error.message} - ${JSON.stringify(error.response?.data)}`); } throw error; } }