MCPcopy
hub / github.com/github/github-mcp-server / issueUpdateTool

Function issueUpdateTool

pkg/github/issues_granular.go:27–113  ·  view source on GitHub ↗

issueUpdateTool is a helper to create single-field issue update tools.

(
	t translations.TranslationHelperFunc,
	name, description, title string,
	extraProps map[string]*jsonschema.Schema,
	extraRequired []string,
	buildRequest func(args map[string]any) (*github.IssueRequest, error),
)

Source from the content-addressed store, hash-verified

25
26// issueUpdateTool is a helper to create single-field issue update tools.
27func issueUpdateTool(
28 t translations.TranslationHelperFunc,
29 name, description, title string,
30 extraProps map[string]*jsonschema.Schema,
31 extraRequired []string,
32 buildRequest func(args map[string]any) (*github.IssueRequest, error),
33) inventory.ServerTool {
34 props := map[string]*jsonschema.Schema{
35 "owner": {
36 Type: "string",
37 Description: "Repository owner (username or organization)",
38 },
39 "repo": {
40 Type: "string",
41 Description: "Repository name",
42 },
43 "issue_number": {
44 Type: "number",
45 Description: "The issue number to update",
46 Minimum: jsonschema.Ptr(1.0),
47 },
48 }
49 maps.Copy(props, extraProps)
50
51 required := append([]string{"owner", "repo", "issue_number"}, extraRequired...)
52
53 st := NewTool(
54 ToolsetMetadataIssues,
55 mcp.Tool{
56 Name: name,
57 Description: t("TOOL_"+strings.ToUpper(name)+"_DESCRIPTION", description),
58 Annotations: &mcp.ToolAnnotations{
59 Title: t("TOOL_"+strings.ToUpper(name)+"_USER_TITLE", title),
60 ReadOnlyHint: false,
61 DestructiveHint: jsonschema.Ptr(false),
62 OpenWorldHint: jsonschema.Ptr(true),
63 },
64 InputSchema: &jsonschema.Schema{
65 Type: "object",
66 Properties: props,
67 Required: required,
68 },
69 },
70 []scopes.Scope{scopes.Repo},
71 func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
72 owner, err := RequiredParam[string](args, "owner")
73 if err != nil {
74 return utils.NewToolResultError(err.Error()), nil, nil
75 }
76 repo, err := RequiredParam[string](args, "repo")
77 if err != nil {
78 return utils.NewToolResultError(err.Error()), nil, nil
79 }
80 issueNumber, err := RequiredInt(args, "issue_number")
81 if err != nil {
82 return utils.NewToolResultError(err.Error()), nil, nil
83 }
84

Callers 5

GranularUpdateIssueTitleFunction · 0.85
GranularUpdateIssueBodyFunction · 0.85
GranularUpdateIssueStateFunction · 0.85

Calls 8

NewToolResultErrorFunction · 0.92
NewToolResultTextFunction · 0.92
NewToolFunction · 0.85
RequiredIntFunction · 0.85
CloseMethod · 0.80
GetClientMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected