MCPcopy Index your code
hub / github.com/github/github-mcp-server / GetCodeQualityFinding

Function GetCodeQualityFinding

pkg/github/code_quality.go:20–99  ·  view source on GitHub ↗
(t translations.TranslationHelperFunc)

Source from the content-addressed store, hash-verified

18)
19
20func GetCodeQualityFinding(t translations.TranslationHelperFunc) inventory.ServerTool {
21 return NewTool(
22 ToolsetMetadataCodeQuality,
23 mcp.Tool{
24 Name: "get_code_quality_finding",
25 Description: t("TOOL_GET_CODE_QUALITY_FINDING_DESCRIPTION", "Get details of a specific code quality finding in a GitHub repository."),
26 Annotations: &mcp.ToolAnnotations{
27 Title: t("TOOL_GET_CODE_QUALITY_FINDING_USER_TITLE", "Get code quality finding"),
28 ReadOnlyHint: true,
29 },
30 InputSchema: &jsonschema.Schema{
31 Type: "object",
32 Properties: map[string]*jsonschema.Schema{
33 "owner": {
34 Type: "string",
35 Description: "The owner of the repository.",
36 },
37 "repo": {
38 Type: "string",
39 Description: "The name of the repository.",
40 },
41 "findingNumber": {
42 Type: "number",
43 Description: "The number of the finding.",
44 },
45 },
46 Required: []string{"owner", "repo", "findingNumber"},
47 },
48 },
49 []scopes.Scope{scopes.Repo},
50 func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
51 owner, err := RequiredParam[string](args, "owner")
52 if err != nil {
53 return utils.NewToolResultError(err.Error()), nil, nil
54 }
55 repo, err := RequiredParam[string](args, "repo")
56 if err != nil {
57 return utils.NewToolResultError(err.Error()), nil, nil
58 }
59 findingNumber, err := RequiredInt(args, "findingNumber")
60 if err != nil {
61 return utils.NewToolResultError(err.Error()), nil, nil
62 }
63
64 client, err := deps.GetClient(ctx)
65 if err != nil {
66 return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, nil
67 }
68
69 apiURL := fmt.Sprintf("repos/%s/%s/code-quality/findings/%d", owner, repo, findingNumber)
70 req, err := client.NewRequest(ctx, http.MethodGet, apiURL, nil)
71 if err != nil {
72 return utils.NewToolResultErrorFromErr("failed to create request", err), nil, nil
73 }
74
75 finding := make(map[string]any)
76
77 resp, err := client.Do(req, &finding)

Callers 2

AllToolsFunction · 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 1