Skip to content

Commit 2f1b008

Browse files
docs
1 parent 5b89896 commit 2f1b008

File tree

2 files changed

+72
-16
lines changed

2 files changed

+72
-16
lines changed

docs/docs/features/mcp-server.mdx

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,32 +147,74 @@ The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP)
147147

148148
### `search_code`
149149

150-
Fetches code that matches the provided regex pattern in `query`.
150+
Searches for code that matches the provided search query as a substring by default, or as a regular expression if `useRegex` is true.
151151

152152
Parameters:
153-
| Name | Required | Description |
154-
|:----------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------|
155-
| `query` | yes | Regex pattern to search for. Escape special characters and spaces with a single backslash (e.g., 'console\.log', 'console\ log'). |
156-
| `filterByRepoIds` | no | Restrict search to specific repository IDs (from 'list_repos'). Leave empty to search all. |
157-
| `filterByLanguages` | no | Restrict search to specific languages (GitHub linguist format, e.g., Python, JavaScript). |
158-
| `caseSensitive` | no | Case sensitive search (default: false). |
159-
| `includeCodeSnippets` | no | Include code snippets in results (default: false). |
160-
| `maxTokens` | no | Max tokens to return (default: env.DEFAULT_MINIMUM_TOKENS). |
153+
| Name | Required | Description |
154+
|:----------------------|:---------|:---------------------------------------------------------------------------------------------------------------------|
155+
| `query` | yes | The search pattern to match against code contents. Do not escape quotes in your query. |
156+
| `useRegex` | no | Whether to use regular expression matching. When false, substring matching is used (default: false). |
157+
| `filterByRepos` | no | Scope the search to specific repositories. |
158+
| `filterByLanguages` | no | Scope the search to specific languages. |
159+
| `filterByFilepaths` | no | Scope the search to specific filepaths. |
160+
| `caseSensitive` | no | Whether the search should be case sensitive (default: false). |
161+
| `includeCodeSnippets` | no | Whether to include code snippets in the response (default: false). |
162+
| `ref` | no | Commit SHA, branch or tag name to search on. If not provided, defaults to the default branch. |
163+
| `maxTokens` | no | The maximum number of tokens to return (default: 10000). |
161164

162165

163166
### `list_repos`
164167

165-
Lists all repositories indexed by Sourcebot.
168+
Lists repositories indexed by Sourcebot with optional filtering and pagination.
166169

167-
### `get_file_source`
170+
Parameters:
171+
| Name | Required | Description |
172+
|:------------|:---------|:--------------------------------------------------------------------------------|
173+
| `query` | no | Filter repositories by name (case-insensitive). |
174+
| `page` | no | Page number for pagination (min 1, default: 1). |
175+
| `perPage` | no | Results per page for pagination (min 1, max 100, default: 30). |
176+
| `sort` | no | Sort repositories by 'name' or 'pushed' (most recent commit). Default: 'name'. |
177+
| `direction` | no | Sort direction: 'asc' or 'desc' (default: 'asc'). |
178+
179+
180+
### `read_file`
181+
182+
Reads the source code for a given file.
183+
184+
Parameters:
185+
| Name | Required | Description |
186+
|:-------|:---------|:-------------------------------------------------------------------------------------------------------|
187+
| `repo` | yes | The repository name. |
188+
| `path` | yes | The path to the file. |
189+
| `ref` | no | Commit SHA, branch or tag name to fetch the source code for. If not provided, uses the default branch. |
190+
191+
192+
### `list_commits`
193+
194+
Get a list of commits for a given repository.
195+
196+
Parameters:
197+
| Name | Required | Description |
198+
|:----------|:---------|:-----------------------------------------------------------------------------------------------------------------------|
199+
| `repo` | yes | The name of the repository to list commits for. |
200+
| `query` | no | Search query to filter commits by message content (case-insensitive). |
201+
| `since` | no | Show commits more recent than this date. Supports ISO 8601 (e.g., '2024-01-01') or relative formats (e.g., '30 days ago'). |
202+
| `until` | no | Show commits older than this date. Supports ISO 8601 (e.g., '2024-12-31') or relative formats (e.g., 'yesterday'). |
203+
| `author` | no | Filter commits by author name or email (case-insensitive). |
204+
| `ref` | no | Commit SHA, branch or tag name to list commits of. If not provided, uses the default branch. |
205+
| `page` | no | Page number for pagination (min 1, default: 1). |
206+
| `perPage` | no | Results per page for pagination (min 1, max 100, default: 50). |
207+
208+
209+
### `ask_codebase`
168210

169-
Fetches the source code for a given file.
211+
Ask a natural language question about the codebase. This tool uses an AI agent to autonomously search code, read files, and find symbol references/definitions to answer your question. Returns a detailed answer in markdown format with code references, plus a link to view the full research session in the Sourcebot web UI.
170212

171213
Parameters:
172-
| Name | Required | Description |
173-
|:-------------|:---------|:-----------------------------------------------------------------|
174-
| `fileName` | yes | The file to fetch the source code for. |
175-
| `repoId` | yes | The Sourcebot repository ID. |
214+
| Name | Required | Description |
215+
|:--------|:---------|:------------------------------------------------------------------------------------------------------------------|
216+
| `query` | yes | The query to ask about the codebase. |
217+
| `repos` | no | The repositories that are accessible to the agent during the chat. If not provided, all repositories are accessible. |
176218

177219

178220
## Environment Variables

packages/mcp/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,20 @@ Get a list of commits for a given repository.
234234

235235
</details>
236236

237+
### ask_codebase
238+
239+
Ask a natural language question about the codebase. This tool uses an AI agent to autonomously search code, read files, and find symbol references/definitions to answer your question. Returns a detailed answer in markdown format with code references, plus a link to view the full research session in the Sourcebot web UI.
240+
241+
<details>
242+
<summary>Parameters</summary>
243+
244+
| Name | Required | Description |
245+
|:--------|:---------|:------------------------------------------------------------------------------------------------------------------|
246+
| `query` | yes | The query to ask about the codebase. |
247+
| `repos` | no | The repositories that are accessible to the agent during the chat. If not provided, all repositories are accessible. |
248+
249+
</details>
250+
237251

238252
## Supported Code Hosts
239253
Sourcebot supports the following code hosts:

0 commit comments

Comments
 (0)