Skip to content

feat: deep wiki mcpを追加#48

Merged
kaitoyama merged 5 commits intostagingfrom
feat/deepwiki-mcp-config
Oct 16, 2025
Merged

feat: deep wiki mcpを追加#48
kaitoyama merged 5 commits intostagingfrom
feat/deepwiki-mcp-config

Conversation

@kaitoyama
Copy link
Copy Markdown
Contributor

@kaitoyama kaitoyama commented Oct 16, 2025

User description

stagingとmainで乖離が発生したので作り直したため


PR Type

Enhancement, Tests


Description

  • responses APIへの移行とツールプロバイダーの実装

  • 新しいツールプロバイダーの追加と設定

  • メッセージ形式の変換と保存方法の更新

  • 新しいテストケースの追加で機能の確認


Diagram Walkthrough

flowchart LR
  A["旧API"] -- "移行" --> B["responses API"]
  B -- "ツールプロバイダー追加" --> C["tooling"]
  C -- "テスト追加" --> D["tooling_test"]
Loading

File Walkthrough

Relevant files
Enhancement
gpt.go
`responses` APIへの移行とツールプロバイダーの設定                                                 

internal/gpt/gpt.go

  • responses APIへの移行
  • メッセージ形式の変換関数追加
  • ツールプロバイダーの設定と使用
  • メッセージ保存方法の更新
+121/-62
tooling.go
新しいツールプロバイダーの実装と設定                                                                             

internal/gpt/tooling/tooling.go

  • 新しいツールプロバイダーの実装
  • MCPオプションのバリデーション追加
  • デフォルトスペックの設定
+129/-0 
Tests
tooling_test.go
MCPツールとプロバイダーのテスト追加                                                                           

internal/gpt/tooling/tooling_test.go

  • MCPツールのテストケース追加
  • 無効なスペックのテスト追加
  • デフォルトスペックのテスト追加
+128/-0 

@kaitoyama kaitoyama merged commit a86d732 into staging Oct 16, 2025
9 checks passed
@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible Issue

The function convertChatMessagesToResponseItems does not handle the case where msg.OfAssistant or msg.OfSystem contains an array of content parts, unlike msg.OfUser. This could lead to incomplete conversion of messages.

// convertChatMessagesToResponseItems converts v2 ChatCompletionMessageParamUnion to Response API format
func convertChatMessagesToResponseItems(messages []openai.ChatCompletionMessageParamUnion) []responses.ResponseInputItemUnionParam {
	var result []responses.ResponseInputItemUnionParam

	for _, msg := range messages {
		if userMsg := msg.OfUser; userMsg != nil {
			if textContent := userMsg.Content.OfString; textContent.Valid() {
				result = append(result, responses.ResponseInputItemParamOfMessage(textContent.Value, "user"))
			} else if len(userMsg.Content.OfArrayOfContentParts) > 0 {
				var contentParams responses.ResponseInputMessageContentListParam
				for _, part := range userMsg.Content.OfArrayOfContentParts {
					if textPart := part.OfText; textPart != nil {
						contentParams = append(contentParams, responses.ResponseInputContentParamOfInputText(textPart.Text))
					} else if imagePart := part.OfImageURL; imagePart != nil {
						contentParams = append(contentParams, responses.ResponseInputContentParamOfInputText("[image]"))
					}
				}
				result = append(result, responses.ResponseInputItemParamOfMessage(contentParams, "user"))
			}
		} else if assistantMsg := msg.OfAssistant; assistantMsg != nil {
			if textContent := assistantMsg.Content.OfString; textContent.Valid() {
				result = append(result, responses.ResponseInputItemParamOfMessage(textContent.Value, "assistant"))
			}
		} else if systemMsg := msg.OfSystem; systemMsg != nil {
			if textContent := systemMsg.Content.OfString; textContent.Valid() {
				result = append(result, responses.ResponseInputItemParamOfMessage(textContent.Value, "system"))
			}
		}
	}

	return result
}
Validation Logic

The validate method in MCPOptions does not check for valid URL format in ServerURL. This could lead to runtime errors if an invalid URL is provided.

func (o MCPOptions) validate() error {
	if strings.TrimSpace(o.ServerLabel) == "" {
		return errors.New("mcp server label is required")
	}
	if strings.TrimSpace(o.ServerURL) == "" {
		return errors.New("mcp server url is required")
	}
	if strings.TrimSpace(o.ApprovalPolicy) == "" {
		return errors.New("mcp approval policy is required")
	}

	return nil
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants