You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(mcp): add search_repos tool and support repoResults in schemas
schemas.ts / types.ts
- Adds repoResultSchema and RepoResult, mirroring the web package
- Adds repoResults?: RepoResult[] to searchResponseSchema so the
MCP client can parse select:repo API responses
index.ts — new tool: search_repos
- Accepts query, filterByLanguages, caseSensitive, ref, maxResults
- Appends select:repo to the query before calling the search API
- Returns a formatted list: repo name, match count, optional URL
- Designed to answer 'which repos use X?' questions directly
index.ts — shared helpers (reusable by future tools e.g. search_commits)
- searchFilterParamsSchema: zod schema spread into each tool's params
- buildQueryFilters(): pure function that appends lang:, repo:,
file:, rev: filter tokens to a query string
index.ts — exports `server` for use in tests
.describe(`Whether to use regular expression matching to match the search query against code contents. When false, substring matching is used. (default: false)`)
42
-
.optional(),
43
-
filterByRepos: z
44
-
.array(z.string())
45
-
.describe(`Scope the search to the provided repositories.`)
46
-
.optional(),
47
-
filterByLanguages: z
48
-
.array(z.string())
49
-
.describe(`Scope the search to the provided languages.`)
50
-
.optional(),
51
-
filterByFilepaths: z
52
-
.array(z.string())
53
-
.describe(`Scope the search to the provided filepaths.`)
54
-
.optional(),
55
-
caseSensitive: z
56
-
.boolean()
57
-
.describe(`Whether the search should be case sensitive (default: false).`)
58
-
.optional(),
106
+
107
+
...searchFilterParamsSchema,
59
108
includeCodeSnippets: z
60
109
.boolean()
61
110
.describe(`Whether to include the code snippets in the response. If false, only the file's URL, repository, and language will be returned. (default: false)`)
62
111
.optional(),
63
-
ref: z
64
-
.string()
65
-
.describe(`Commit SHA, branch or tag name to search on. If not provided, defaults to the default branch (usually 'main' or 'master').`)
66
-
.optional(),
112
+
67
113
maxTokens: numberSchema
68
114
.describe(`The maximum number of tokens to return (default: ${env.DEFAULT_MINIMUM_TOKENS}). Higher values provide more context but consume more tokens. Values less than ${env.DEFAULT_MINIMUM_TOKENS} will be ignored.`)
`Searchescodeandreturnsthelistofmatchingrepositories(deduplicated),sortedbynumberofmatches.Usefulforanswering"which repos use X?"questions.Equivalenttoappendingselect:repotoaSourcebotquery.`,
0 commit comments