77 "testing"
88
99 ghcontext "github.com/github/github-mcp-server/pkg/context"
10- "github.com/github/github-mcp-server/pkg/http/headers"
1110 "github.com/github/github-mcp-server/pkg/inventory"
1211 "github.com/modelcontextprotocol/go-sdk/mcp"
1312 "github.com/stretchr/testify/assert"
@@ -38,7 +37,6 @@ func TestInventoryFiltersForRequest(t *testing.T) {
3837 tests := []struct {
3938 name string
4039 contextSetup func (context.Context ) context.Context
41- headers map [string ]string
4240 expectedTools []string
4341 }{
4442 {
@@ -61,22 +59,18 @@ func TestInventoryFiltersForRequest(t *testing.T) {
6159 expectedTools : []string {"get_file_contents" , "create_repository" },
6260 },
6361 {
64- name : "context toolset takes precedence over header " ,
62+ name : "tools alone clears default toolsets " ,
6563 contextSetup : func (ctx context.Context ) context.Context {
66- return ghcontext .WithToolsets (ctx , []string {"repos" })
67- },
68- headers : map [string ]string {
69- headers .MCPToolsetsHeader : "issues" ,
64+ return ghcontext .WithTools (ctx , []string {"list_issues" })
7065 },
71- expectedTools : []string {"get_file_contents" , "create_repository " },
66+ expectedTools : []string {"list_issues " },
7267 },
7368 {
7469 name : "tools are additive with toolsets" ,
7570 contextSetup : func (ctx context.Context ) context.Context {
76- return ghcontext .WithToolsets (ctx , []string {"repos" })
77- },
78- headers : map [string ]string {
79- headers .MCPToolsHeader : "list_issues" ,
71+ ctx = ghcontext .WithToolsets (ctx , []string {"repos" })
72+ ctx = ghcontext .WithTools (ctx , []string {"list_issues" })
73+ return ctx
8074 },
8175 expectedTools : []string {"get_file_contents" , "create_repository" , "list_issues" },
8276 },
@@ -85,9 +79,6 @@ func TestInventoryFiltersForRequest(t *testing.T) {
8579 for _ , tt := range tests {
8680 t .Run (tt .name , func (t * testing.T ) {
8781 req := httptest .NewRequest (http .MethodGet , "/" , nil )
88- for k , v := range tt .headers {
89- req .Header .Set (k , v )
90- }
9182 req = req .WithContext (tt .contextSetup (req .Context ()))
9283
9384 builder := inventory .NewBuilder ().
0 commit comments