Skip to content

Commit efef8ae

Browse files
authored
Changed q to query in search (#740)
1 parent a939565 commit efef8ae

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ The following sets of tools are available (all are on by default):
838838
- `order`: Sort order (string, optional)
839839
- `page`: Page number for pagination (min 1) (number, optional)
840840
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
841-
- `q`: Search query using GitHub code search syntax (string, required)
841+
- `query`: Search query using GitHub code search syntax (string, required)
842842
- `sort`: Sort field ('indexed' only) (string, optional)
843843

844844
- **search_repositories** - Search repositories

pkg/github/__toolsnaps__/search_code.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"minimum": 1,
2626
"type": "number"
2727
},
28-
"q": {
28+
"query": {
2929
"description": "Search query using GitHub code search syntax",
3030
"type": "string"
3131
},
@@ -35,7 +35,7 @@
3535
}
3636
},
3737
"required": [
38-
"q"
38+
"query"
3939
],
4040
"type": "object"
4141
},

pkg/github/search.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func SearchCode(getClient GetClientFn, t translations.TranslationHelperFunc) (to
8383
Title: t("TOOL_SEARCH_CODE_USER_TITLE", "Search code"),
8484
ReadOnlyHint: ToBoolPtr(true),
8585
}),
86-
mcp.WithString("q",
86+
mcp.WithString("query",
8787
mcp.Required(),
8888
mcp.Description("Search query using GitHub code search syntax"),
8989
),
@@ -97,7 +97,7 @@ func SearchCode(getClient GetClientFn, t translations.TranslationHelperFunc) (to
9797
WithPagination(),
9898
),
9999
func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
100-
query, err := RequiredParam[string](request, "q")
100+
query, err := RequiredParam[string](request, "query")
101101
if err != nil {
102102
return mcp.NewToolResultError(err.Error()), nil
103103
}

pkg/github/search_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,12 @@ func Test_SearchCode(t *testing.T) {
173173

174174
assert.Equal(t, "search_code", tool.Name)
175175
assert.NotEmpty(t, tool.Description)
176-
assert.Contains(t, tool.InputSchema.Properties, "q")
176+
assert.Contains(t, tool.InputSchema.Properties, "query")
177177
assert.Contains(t, tool.InputSchema.Properties, "sort")
178178
assert.Contains(t, tool.InputSchema.Properties, "order")
179179
assert.Contains(t, tool.InputSchema.Properties, "perPage")
180180
assert.Contains(t, tool.InputSchema.Properties, "page")
181-
assert.ElementsMatch(t, tool.InputSchema.Required, []string{"q"})
181+
assert.ElementsMatch(t, tool.InputSchema.Required, []string{"query"})
182182

183183
// Setup mock search results
184184
mockSearchResult := &github.CodeSearchResult{
@@ -227,7 +227,7 @@ func Test_SearchCode(t *testing.T) {
227227
),
228228
),
229229
requestArgs: map[string]interface{}{
230-
"q": "fmt.Println language:go",
230+
"query": "fmt.Println language:go",
231231
"sort": "indexed",
232232
"order": "desc",
233233
"page": float64(1),
@@ -251,7 +251,7 @@ func Test_SearchCode(t *testing.T) {
251251
),
252252
),
253253
requestArgs: map[string]interface{}{
254-
"q": "fmt.Println language:go",
254+
"query": "fmt.Println language:go",
255255
},
256256
expectError: false,
257257
expectedResult: mockSearchResult,
@@ -268,7 +268,7 @@ func Test_SearchCode(t *testing.T) {
268268
),
269269
),
270270
requestArgs: map[string]interface{}{
271-
"q": "invalid:query",
271+
"query": "invalid:query",
272272
},
273273
expectError: true,
274274
expectedErrMsg: "failed to search code",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy