Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add MCP tools for ChatGPT#19102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hugodutka merged 11 commits intomainfromhugodutka/chatgpt-mcp
Aug 4, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
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
PrevPrevious commit
NextNext commit
chore: move getServerURL under Deps
  • Loading branch information
@hugodutka
hugodutka committedAug 4, 2025
commitf86a119669acfcd8fdfb960b3d8ef6a39dde16ac
15 changes: 4 additions & 11 deletionscodersdk/toolsdk/chatgpt.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,13 +14,6 @@ import (
"github.com/coder/coder/v2/codersdk"
)

func getServerURL(deps Deps) string {
serverURLCopy := *deps.coderClient.URL
serverURLCopy.Path = ""
serverURLCopy.RawQuery = ""
return serverURLCopy.String()
}

type ObjectType string

const (
Expand DownExpand Up@@ -56,7 +49,7 @@ func createObjectID(objectType ObjectType, id string) ObjectID {
}

func searchTemplates(ctx context.Context, deps Deps, query string) ([]SearchResultItem, error) {
serverURL := getServerURL(deps)
serverURL :=deps.getServerURL()
templates, err := deps.coderClient.Templates(ctx, codersdk.TemplateFilter{
SearchQuery: query,
})
Expand All@@ -76,7 +69,7 @@ func searchTemplates(ctx context.Context, deps Deps, query string) ([]SearchResu
}

func searchWorkspaces(ctx context.Context, deps Deps, query string) ([]SearchResultItem, error) {
serverURL := getServerURL(deps)
serverURL :=deps.getServerURL()
workspaces, err := deps.coderClient.Workspaces(ctx, codersdk.WorkspaceFilter{
FilterQuery: query,
})
Expand DownExpand Up@@ -351,7 +344,7 @@ func fetchWorkspace(ctx context.Context, deps Deps, workspaceID string) (FetchRe
ID: workspace.ID.String(),
Title: workspace.Name,
Text: string(workspaceJSON),
URL: fmt.Sprintf("%s/%s/%s", getServerURL(deps), workspace.OwnerName, workspace.Name),
URL: fmt.Sprintf("%s/%s/%s",deps.getServerURL(), workspace.OwnerName, workspace.Name),
}, nil
}

Expand All@@ -372,7 +365,7 @@ func fetchTemplate(ctx context.Context, deps Deps, templateID string) (FetchResu
ID: template.ID.String(),
Title: template.DisplayName,
Text: string(templateJSON),
URL: fmt.Sprintf("%s/templates/%s/%s", getServerURL(deps), template.OrganizationName, template.Name),
URL: fmt.Sprintf("%s/templates/%s/%s",deps.getServerURL(), template.OrganizationName, template.Name),
}, nil
}

Expand Down
7 changes: 7 additions & 0 deletionscodersdk/toolsdk/toolsdk.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,6 +58,13 @@ type Deps struct {
report func(ReportTaskArgs) error
}

func (d Deps) getServerURL() string {
serverURLCopy := *d.coderClient.URL
serverURLCopy.Path = ""
serverURLCopy.RawQuery = ""
return serverURLCopy.String()
}

func WithTaskReporter(fn func(ReportTaskArgs) error) func(*Deps) {
return func(d *Deps) {
d.report = fn
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp