(t *testing.T)
| 190 | } |
| 191 | |
| 192 | func TestHTTPHandlerRoutes(t *testing.T) { |
| 193 | tools := testTools() |
| 194 | |
| 195 | tests := []struct { |
| 196 | name string |
| 197 | path string |
| 198 | headers map[string]string |
| 199 | expectedTools []string |
| 200 | }{ |
| 201 | { |
| 202 | name: "root path returns all tools", |
| 203 | path: "/", |
| 204 | expectedTools: []string{"get_file_contents", "create_repository", "list_issues", "create_issue", "list_pull_requests", "create_pull_request", "hidden_by_holdback"}, |
| 205 | }, |
| 206 | { |
| 207 | name: "readonly path filters write tools", |
| 208 | path: "/readonly", |
| 209 | expectedTools: []string{"get_file_contents", "list_issues", "list_pull_requests", "hidden_by_holdback"}, |
| 210 | }, |
| 211 | { |
| 212 | name: "toolset path filters to toolset", |
| 213 | path: "/x/repos", |
| 214 | expectedTools: []string{"get_file_contents", "create_repository", "hidden_by_holdback"}, |
| 215 | }, |
| 216 | { |
| 217 | name: "toolset path with issues", |
| 218 | path: "/x/issues", |
| 219 | expectedTools: []string{"list_issues", "create_issue"}, |
| 220 | }, |
| 221 | { |
| 222 | name: "toolset readonly path filters to readonly tools in toolset", |
| 223 | path: "/x/repos/readonly", |
| 224 | expectedTools: []string{"get_file_contents", "hidden_by_holdback"}, |
| 225 | }, |
| 226 | { |
| 227 | name: "toolset readonly path with issues", |
| 228 | path: "/x/issues/readonly", |
| 229 | expectedTools: []string{"list_issues"}, |
| 230 | }, |
| 231 | { |
| 232 | name: "X-MCP-Tools header filters to specific tools", |
| 233 | path: "/", |
| 234 | headers: map[string]string{ |
| 235 | headers.MCPToolsHeader: "list_issues", |
| 236 | }, |
| 237 | expectedTools: []string{"list_issues"}, |
| 238 | }, |
| 239 | { |
| 240 | name: "X-MCP-Tools header with multiple tools", |
| 241 | path: "/", |
| 242 | headers: map[string]string{ |
| 243 | headers.MCPToolsHeader: "list_issues,get_file_contents", |
| 244 | }, |
| 245 | expectedTools: []string{"list_issues", "get_file_contents"}, |
| 246 | }, |
| 247 | { |
| 248 | name: "X-MCP-Tools header does not expose extra tools", |
| 249 | path: "/", |
nothing calls this directly
no test coverage detected