IssueRead creates a tool to get details of a specific issue in a GitHub repository.
(t translations.TranslationHelperFunc)
| 607 | |
| 608 | // IssueRead creates a tool to get details of a specific issue in a GitHub repository. |
| 609 | func IssueRead(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 610 | schema := &jsonschema.Schema{ |
| 611 | Type: "object", |
| 612 | Properties: map[string]*jsonschema.Schema{ |
| 613 | "method": { |
| 614 | Type: "string", |
| 615 | Description: `The read operation to perform on a single issue. |
| 616 | Options are: |
| 617 | 1. get - Get details of a specific issue. |
| 618 | 2. get_comments - Get issue comments. |
| 619 | 3. get_sub_issues - Get sub-issues (children) of the issue. |
| 620 | 4. get_parent - Get the parent issue, if this issue is a sub-issue of another. |
| 621 | 5. get_labels - Get labels assigned to the issue. |
| 622 | `, |
| 623 | Enum: []any{"get", "get_comments", "get_sub_issues", "get_parent", "get_labels"}, |
| 624 | }, |
| 625 | "owner": { |
| 626 | Type: "string", |
| 627 | Description: "The owner of the repository", |
| 628 | }, |
| 629 | "repo": { |
| 630 | Type: "string", |
| 631 | Description: "The name of the repository", |
| 632 | }, |
| 633 | "issue_number": { |
| 634 | Type: "number", |
| 635 | Description: "The number of the issue", |
| 636 | }, |
| 637 | }, |
| 638 | Required: []string{"method", "owner", "repo", "issue_number"}, |
| 639 | } |
| 640 | WithPagination(schema) |
| 641 | |
| 642 | return NewTool( |
| 643 | ToolsetMetadataIssues, |
| 644 | mcp.Tool{ |
| 645 | Name: "issue_read", |
| 646 | Description: t("TOOL_ISSUE_READ_DESCRIPTION", "Get information about a specific issue in a GitHub repository."), |
| 647 | Annotations: &mcp.ToolAnnotations{ |
| 648 | Title: t("TOOL_ISSUE_READ_USER_TITLE", "Get issue details"), |
| 649 | ReadOnlyHint: true, |
| 650 | }, |
| 651 | InputSchema: schema, |
| 652 | }, |
| 653 | []scopes.Scope{scopes.Repo}, |
| 654 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 655 | method, err := RequiredParam[string](args, "method") |
| 656 | if err != nil { |
| 657 | return utils.NewToolResultError(err.Error()), nil, nil |
| 658 | } |
| 659 | |
| 660 | owner, err := RequiredParam[string](args, "owner") |
| 661 | if err != nil { |
| 662 | return utils.NewToolResultError(err.Error()), nil, nil |
| 663 | } |
| 664 | repo, err := RequiredParam[string](args, "repo") |
| 665 | if err != nil { |
| 666 | return utils.NewToolResultError(err.Error()), nil, nil |