IssueDependencyRead creates a tool to read an issue's blocked-by and blocking relationships. It is a separate, feature-flagged tool (rather than a method on the default issue_read) so the whole dependency capability can be gated as a unit without enlarging the default issue tool surface.
(t translations.TranslationHelperFunc)
| 68 | // the default issue_read) so the whole dependency capability can be gated as a |
| 69 | // unit without enlarging the default issue tool surface. |
| 70 | func IssueDependencyRead(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 71 | schema := &jsonschema.Schema{ |
| 72 | Type: "object", |
| 73 | Properties: map[string]*jsonschema.Schema{ |
| 74 | "method": { |
| 75 | Type: "string", |
| 76 | Description: `The read operation to perform on a single issue's dependencies. |
| 77 | Options are: |
| 78 | 1. get_blocked_by - List the issues that block this issue (this issue is blocked by them). |
| 79 | 2. get_blocking - List the issues that this issue blocks. |
| 80 | `, |
| 81 | Enum: []any{"get_blocked_by", "get_blocking"}, |
| 82 | }, |
| 83 | "owner": { |
| 84 | Type: "string", |
| 85 | Description: "The owner of the repository", |
| 86 | }, |
| 87 | "repo": { |
| 88 | Type: "string", |
| 89 | Description: "The name of the repository", |
| 90 | }, |
| 91 | "issue_number": { |
| 92 | Type: "number", |
| 93 | Description: "The number of the issue", |
| 94 | }, |
| 95 | }, |
| 96 | Required: []string{"method", "owner", "repo", "issue_number"}, |
| 97 | } |
| 98 | WithCursorPagination(schema) |
| 99 | |
| 100 | st := NewTool( |
| 101 | ToolsetMetadataIssues, |
| 102 | mcp.Tool{ |
| 103 | Name: "issue_dependency_read", |
| 104 | Description: t("TOOL_ISSUE_DEPENDENCY_READ_DESCRIPTION", "Read an issue's dependency relationships in a GitHub repository: the issues that block it (blocked_by) or the issues it blocks (blocking)."), |
| 105 | Annotations: &mcp.ToolAnnotations{ |
| 106 | Title: t("TOOL_ISSUE_DEPENDENCY_READ_USER_TITLE", "Read issue dependencies"), |
| 107 | ReadOnlyHint: true, |
| 108 | }, |
| 109 | InputSchema: schema, |
| 110 | }, |
| 111 | []scopes.Scope{scopes.Repo}, |
| 112 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 113 | method, err := RequiredParam[string](args, "method") |
| 114 | if err != nil { |
| 115 | return utils.NewToolResultError(err.Error()), nil, nil |
| 116 | } |
| 117 | owner, err := RequiredParam[string](args, "owner") |
| 118 | if err != nil { |
| 119 | return utils.NewToolResultError(err.Error()), nil, nil |
| 120 | } |
| 121 | repo, err := RequiredParam[string](args, "repo") |
| 122 | if err != nil { |
| 123 | return utils.NewToolResultError(err.Error()), nil, nil |
| 124 | } |
| 125 | issueNumber, err := RequiredInt(args, "issue_number") |
| 126 | if err != nil { |
| 127 | return utils.NewToolResultError(err.Error()), nil, nil |