MCPcopy Create free account
hub / github.com/atripati/ark / createIssue

Method createIssue

pkg/tools/github.go:202–237  ·  view source on GitHub ↗
(params map[string]interface{})

Source from the content-addressed store, hash-verified

200 return simplifyIssueList(result)
201}
202func (g *githubTools) createIssue(params map[string]interface{}) (string, error) {
203 owner, _ := params["owner"].(string)
204 repo, _ := params["repo"].(string)
205 title, _ := params["title"].(string)
206 if owner == "" || repo == "" || title == "" {
207 return "", fmt.Errorf("github_create_issue: 'owner', 'repo', and 'title' params required")
208 }
209
210 if g.token == "" {
211 return "", fmt.Errorf("github_create_issue: GITHUB_TOKEN required for write operations")
212 }
213
214 body := map[string]interface{}{
215 "title": title,
216 }
217 if b, ok := params["body"].(string); ok {
218 body["body"] = b
219 }
220 if labels, ok := params["labels"]; ok {
221 body["labels"] = labels
222 }
223
224 bodyBytes, _ := json.Marshal(body)
225
226 result, err := g.exec.Execute(HTTPToolConfig{
227 Method: "POST",
228 URL: fmt.Sprintf("%s/repos/%s/%s/issues", githubAPI, owner, repo),
229 Headers: g.headers(),
230 RawBody: bodyBytes,
231 }, nil)
232 if err != nil {
233 return "", fmt.Errorf("github_create_issue: %w", err)
234 }
235
236 return simplifyIssue(result)
237}
238
239func (g *githubTools) listPulls(params map[string]interface{}) (string, error) {
240 owner, _ := params["owner"].(string)

Callers

nothing calls this directly

Calls 3

headersMethod · 0.95
simplifyIssueFunction · 0.85
ExecuteMethod · 0.65

Tested by

no test coverage detected