Skip to content

Release: MCPツールの追加&GPTバージョンアップ#54

Merged
kaitoyama merged 12 commits intomainfrom
staging
Nov 13, 2025
Merged

Release: MCPツールの追加&GPTバージョンアップ#54
kaitoyama merged 12 commits intomainfrom
staging

Conversation

@kaitoyama
Copy link
Copy Markdown
Contributor

@kaitoyama kaitoyama commented Nov 13, 2025

PR Type

Enhancement, Tests


Description

  • OpenAI SDK updated to v2.7.1 with GPT-5 Mini model.

  • Migrated to new Responses API for message handling.

  • Implemented provider pattern for tooling.

  • Added tests for tooling functionalities.


Diagram Walkthrough

flowchart LR
  A["Update OpenAI SDK"] --> B["Migrate to Responses API"]
  B --> C["Implement Provider Pattern"]
  C --> D["Add Tooling Tests"]
Loading

File Walkthrough

Relevant files
Enhancement
gpt.go
Migrate to Responses API and update message handling         

internal/gpt/gpt.go

  • Updated to use Responses API for message handling.
  • Changed default model to GPT-5 Mini.
  • Added tool provider pattern.
  • Converted message handling to new format.
+128/-63
tooling.go
Add tooling package with MCP tool support                               

internal/gpt/tooling/tooling.go

  • Added tooling package for handling tools.
  • Implemented MCP tool kind.
  • Added validation for tool specifications.
+130/-0 
MessageReceived.go
Update model command for GPT-5 Mini                                           

internal/handler/MessageReceived.go

  • Updated model command to use GPT-5 Mini.
  • Listed available models including GPT-5 variants.
+6/-3     
Tests
tooling_test.go
Add tests for tooling functionalities                                       

internal/gpt/tooling/tooling_test.go

  • Added tests for MCP tool conversion.
  • Tested static provider tool retrieval.
  • Validated default specs provider.
+130/-0 
Dependencies
go.mod
Update OpenAI SDK version in go.mod                                           

go.mod

  • Updated OpenAI SDK version to v2.7.1.
+1/-1     
go.sum
Update go.sum for OpenAI SDK v2.7.1                                           

go.sum

  • Updated checksums for OpenAI SDK v2.7.1.
+2/-2     

@kaitoyama kaitoyama changed the title Release: Release: MCPツールの追加&GPTバージョンアップ Nov 13, 2025
@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 has Content.OfArrayOfContentParts. This might lead to incomplete message conversion.

// 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 if ServerURL is a valid URL format, which might 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 !o.ServerURL.Valid() {
		return errors.New("mcp server url is required")
	}
	if strings.TrimSpace(o.ApprovalPolicy) == "" {
		return errors.New("mcp approval policy is required")
	}

	return nil

@kaitoyama kaitoyama merged commit 0bcdcc1 into main Nov 13, 2025
8 checks passed
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