Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
モンスター一覧取得機能を改善し、ページネーションとフィルタリングを追加する変更です。
/cmd/mcp/main.goにフィルタ・ソート・ページネーション用のInputSchemaを拡張getMonsters関数を実装してリクエストパラメータから検索条件を構築し、サービス呼び出しを行う- 結果をJSON整形して返却するロジックを追加
Comments suppressed due to low confidence (1)
cmd/mcp/main.go:235
getMonstersの新しいロジックに対するユニットテストがまだ追加されていないようです。正常系・異常系のテストを追加して、ページネーションやフィルタリング動作を検証してください。
func (m *MCPServer) getMonsters(ctx context.Context, args mcp.CallToolRequest) (*mcp.CallToolResult, error) {
cmd/mcp/main.go
Outdated
| // Note: Current monster service only supports fetching by ID | ||
| // For listing all monsters, we'll return an informative message | ||
| return mcp.NewToolResultText("Monster service currently supports fetching specific monsters by ID only. Use get_monster_by_id tool with a specific monster ID."), nil | ||
| page := args.GetInt("page", 1) |
There was a problem hiding this comment.
InputSchemaから"page"プロパティが削除されていますが、コードでargs.GetInt("page")を使用しています。Schemaと取得ロジックを整合させ、"page"を復元するか、ページ番号ではなく"offset"で処理するように修正してください。
cmd/mcp/main.go
Outdated
| return mcp.NewToolResultText("No monsters found"), nil | ||
| } | ||
|
|
||
| return mcp.NewToolResultText(fmt.Sprintf("Found %d monsters", content)), nil |
There was a problem hiding this comment.
fmt.Sprintfで"%d"を使ってcontent ([]byte)を表示しようとしていますが、型が一致せず意図したJSON出力になりません。%sを使って文字列として出力するか、len(monsters)を使って件数を表示してください。
Suggested change
| return mcp.NewToolResultText(fmt.Sprintf("Found %d monsters", content)), nil | |
| return mcp.NewToolResultText(fmt.Sprintf("Found %d monsters", len(monsters))), nil |
This comment has been minimized.
This comment has been minimized.
Contributor
Code Metrics Report
Code coverage of files in pull request scope (0.0%)
Reported by octocov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #
実装内容
動作確認
テスト結果