Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.8.0",
"@reduxjs/toolkit": "^2.4.0",
"zod": "^3.24.2"
}
}
8 changes: 8 additions & 0 deletions src/schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { z } from 'zod';

/** @see https://developer.chatwork.com/reference/get-rooms */
export const listRoomsParamsSchema = z
.object({
offset: z.number().int().min(0).default(0).describe('取得開始位置'),
limit: z.number().int().min(1).max(100).default(100).describe('取得件数'),
})
.describe('チャット一覧取得');

/** @see https://developer.chatwork.com/reference/get-my-tasks */
export const listMyTasksParamsSchema = z
.object({
Expand Down
10 changes: 9 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
listRoomFilesParamsSchema,
listRoomMembersParamsSchema,
listRoomMessagesParamsSchema,
listRoomsParamsSchema,
listRoomTasksParamsSchema,
postRoomMessageParamsSchema,
readRoomMessagesParamsSchema,
Expand Down Expand Up @@ -84,7 +85,14 @@ server.tool(
'自分のコンタクト一覧を取得します。',
listContacts,
);
server.tool('list_rooms', 'チャット一覧を取得します。', listRooms);
server.registerTool(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

registerToolに変更したのは、こちらのほうが最新のAPIであり、toolはさまざまな引数に対応できるoverloadを実現しているのでやや扱いにくいため、将来的にこちらを利用すべきと考えたため。

'list_rooms',
{
description: 'チャット一覧を取得します。',
inputSchema: listRoomsParamsSchema.shape,
},
listRooms,
);
server.tool(
'create_room',
'新しいグループチャットを作成します。',
Expand Down
28 changes: 28 additions & 0 deletions src/store/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { configureStore } from '@reduxjs/toolkit';
import roomsReducer from './roomsSlice';

export const store = configureStore({
reducer: {
rooms: roomsReducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
// Disable serializability check for Date objects in TTL
serializableCheck: {
ignoredPaths: ['rooms.rooms.timestamp'],
Copy link

Copilot AI Jul 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The nested path 'rooms.rooms.timestamp' creates confusion due to the redundant naming. Consider renaming the slice or the property to improve clarity.

Suggested change
ignoredPaths: ['rooms.rooms.timestamp'],
ignoredPaths: ['rooms.data.timestamp'],

Copilot uses AI. Check for mistakes.
},
}),
});

export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;

// Re-export actions and selectors for convenience
export {
setRooms,
clearRooms,
cleanExpiredData,
selectRooms,
selectPaginatedRooms,
} from './roomsSlice';
export type { Room } from '../types/room';
Loading