(t *testing.T)
| 250 | } |
| 251 | |
| 252 | func TestGetMe(t *testing.T) { |
| 253 | t.Parallel() |
| 254 | |
| 255 | mcpClient := setupMCPClient(t) |
| 256 | ctx := context.Background() |
| 257 | |
| 258 | // When we call the "get_me" tool |
| 259 | response, err := mcpClient.CallTool(ctx, &mcp.CallToolParams{Name: "get_me"}) |
| 260 | require.NoError(t, err, "expected to call 'get_me' tool successfully") |
| 261 | |
| 262 | require.False(t, response.IsError, fmt.Sprintf("expected result not to be an error: %+v", response)) |
| 263 | require.Len(t, response.Content, 1, "expected content to have one item") |
| 264 | |
| 265 | textContent, ok := response.Content[0].(*mcp.TextContent) |
| 266 | require.True(t, ok, "expected content to be of type TextContent") |
| 267 | |
| 268 | var trimmedContent struct { |
| 269 | Login string `json:"login"` |
| 270 | } |
| 271 | err = json.Unmarshal([]byte(textContent.Text), &trimmedContent) |
| 272 | require.NoError(t, err, "expected to unmarshal text content successfully") |
| 273 | |
| 274 | // Then the login in the response should match the login obtained via the same |
| 275 | // token using the GitHub API. |
| 276 | ghClient := getRESTClient(t) |
| 277 | user, _, err := ghClient.Users.Get(context.Background(), "") |
| 278 | require.NoError(t, err, "expected to get user successfully") |
| 279 | require.Equal(t, trimmedContent.Login, *user.Login, "expected login to match") |
| 280 | |
| 281 | } |
| 282 | |
| 283 | func TestToolsets(t *testing.T) { |
| 284 | t.Parallel() |
nothing calls this directly
no test coverage detected