Skip to content

モンスター取得機能を改善し、ページネーションとフィルタリングを追加#147

Merged
o-ga09 merged 3 commits intomainfrom
implement-monster-list
May 31, 2025
Merged

モンスター取得機能を改善し、ページネーションとフィルタリングを追加#147
o-ga09 merged 3 commits intomainfrom
implement-monster-list

Conversation

@o-ga09
Copy link
Copy Markdown
Owner

@o-ga09 o-ga09 commented May 31, 2025

close #

実装内容

  • モンスター一覧取得機能を実装
  • モンスター一覧機能のページネーションとフィルタリングを追加

動作確認

エビデンス

テスト結果

@o-ga09 o-ga09 requested review from Copilot and removed request for Copilot May 31, 2025 01:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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)
Copy link

Copilot AI May 31, 2025

Choose a reason for hiding this comment

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

InputSchemaから"page"プロパティが削除されていますが、コードでargs.GetInt("page")を使用しています。Schemaと取得ロジックを整合させ、"page"を復元するか、ページ番号ではなく"offset"で処理するように修正してください。

Copilot uses AI. Check for mistakes.
cmd/mcp/main.go Outdated
return mcp.NewToolResultText("No monsters found"), nil
}

return mcp.NewToolResultText(fmt.Sprintf("Found %d monsters", content)), nil
Copy link

Copilot AI May 31, 2025

Choose a reason for hiding this comment

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

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

Copilot uses AI. Check for mistakes.
@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

Code Metrics Report

Coverage Code to Test Ratio Test Execution Time
31.4% 1:0.4 59s

Code coverage of files in pull request scope (0.0%)

Files Coverage
cmd/mcp/main.go 0.0%

Reported by octocov

@o-ga09 o-ga09 merged commit 7cefa62 into main May 31, 2025
2 checks passed
@o-ga09 o-ga09 deleted the implement-monster-list branch May 31, 2025 01:50
@github-actions github-actions bot mentioned this pull request Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants