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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Added
11
+
- Added `/api/chat/blocking` endpoint that creates a blocking Ask thread, used by the MCP server. [#814](https://github.com/sourcebot-dev/sourcebot/pull/814)
12
+
- Added `/api/models` endpoint to list configured language models. [#814](https://github.com/sourcebot-dev/sourcebot/pull/814)
13
+
- Added additional telemetry for api requests. [#835](https://github.com/sourcebot-dev/sourcebot/pull/835)
14
+
10
15
### Fixed
11
16
- Fixed issue where files with a comma would not render correctly in file tree. [#831](https://github.com/sourcebot-dev/sourcebot/pull/831)
12
17
13
18
### Changed
14
19
- Changed `/api/source` api to support fetching source code for any revision, not just revisions that are indexed by zoekt. [#829](https://github.com/sourcebot-dev/sourcebot/pull/829)
15
-
-Added additional telemetry for api requests. [#835](https://github.com/sourcebot-dev/sourcebot/pull/835)
20
+
-Adjusted prompts and tools for Ask agent. [#814](https://github.com/sourcebot-dev/sourcebot/pull/814)
|`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
+
### `list_language_models`
210
+
211
+
Lists the available language models configured on the Sourcebot instance. Use this to discover which models can be specified when calling `ask_codebase`.
212
+
213
+
Parameters:
214
+
215
+
This tool takes no parameters.
216
+
217
+
218
+
### `ask_codebase`
168
219
169
-
Fetches the source code for a given file.
220
+
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.
|`query`| yes | The query to ask about the codebase. |
226
+
|`repos`| no | The repositories that are accessible to the agent during the chat. If not provided, all repositories are accessible. |
227
+
|`languageModel`| no | The language model to use for answering the question. Object with `provider` and `model`. If not provided, defaults to the first model in the config. Use `list_language_models` to see available options. |
Copy file name to clipboardExpand all lines: packages/mcp/CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Added
11
+
- Added `ask_codebase` tool that can invoke the Ask subagent to explore a set of codebases and return a summarized answer. [#814](https://github.com/sourcebot-dev/sourcebot/pull/814)
12
+
- Added `list_language_models` tool to discover available language models configured on the Sourcebot instance. [#814](https://github.com/sourcebot-dev/sourcebot/pull/814)
Copy file name to clipboardExpand all lines: packages/mcp/README.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -234,6 +234,32 @@ Get a list of commits for a given repository.
234
234
235
235
</details>
236
236
237
+
### list_language_models
238
+
239
+
Lists the available language models configured on the Sourcebot instance. Use this to discover which models can be specified when calling `ask_codebase`.
240
+
241
+
<details>
242
+
<summary>Parameters</summary>
243
+
244
+
This tool takes no parameters.
245
+
246
+
</details>
247
+
248
+
### ask_codebase
249
+
250
+
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.
| `query` | yes | The query to ask about the codebase. |
258
+
| `repos` | no | The repositories that are accessible to the agent during the chat. If not provided, all repositories are accessible. |
259
+
| `languageModel` | no | The language model to use for answering the question. Object with `provider` and `model`. If not provided, defaults to the first model in the config. Use `list_language_models` to see available options. |
dedent`Lists the available language models configured on the Sourcebot instance. Use this to discover which models can be specified when calling ask_codebase.`,
244
+
{},
245
+
async()=>{
246
+
constmodels=awaitlistLanguageModels();
247
+
248
+
return{
249
+
content: [{
250
+
type: "text",
251
+
text: JSON.stringify(models),
252
+
}],
253
+
};
254
+
}
255
+
);
256
+
257
+
server.tool(
258
+
"ask_codebase",
259
+
dedent`
260
+
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.
261
+
262
+
The agent will:
263
+
- Analyze your question and determine what context it needs
264
+
- Search the codebase using multiple strategies (code search, symbol lookup, file reading)
265
+
- Synthesize findings into a comprehensive answer with code references
241
266
267
+
Returns a detailed answer in markdown format with code references, plus a link to view the full research session (including all tool calls and reasoning) in the Sourcebot web UI.
268
+
269
+
This is a blocking operation that may take 30-60+ seconds for complex questions as the agent researches the codebase.
270
+
`,
271
+
askCodebaseRequestSchema.shape,
272
+
async(request: AskCodebaseRequest)=>{
273
+
constresponse=awaitaskCodebase(request);
274
+
275
+
// Format the response with the answer and a link to the chat
276
+
constformattedResponse=dedent`
277
+
${response.answer}
278
+
279
+
---
280
+
**View full research session:** ${response.chatUrl}
.describe("The query to ask about the codebase."),
288
+
repos: z
289
+
.array(z.string())
290
+
.optional()
291
+
.describe("The repositories that are accessible to the agent during the chat. If not provided, all repositories are accessible."),
292
+
languageModel: languageModelInfoSchema
293
+
.omit({displayName: true})
294
+
.optional()
295
+
.describe("The language model to use for answering the question. If not provided, defaults to the first model in the config. Use list_language_models to see available options."),
296
+
});
297
+
298
+
exportconstsourceSchema=z.object({
299
+
type: z.literal('file'),
300
+
repo: z.string(),
301
+
path: z.string(),
302
+
name: z.string(),
303
+
language: z.string(),
304
+
revision: z.string(),
305
+
});
306
+
307
+
exportconstaskCodebaseResponseSchema=z.object({
308
+
answer: z.string().describe("The agent's final answer in markdown format"),
309
+
chatId: z.string().describe("ID of the persisted chat session"),
310
+
chatUrl: z.string().describe("URL to view the chat in the web UI"),
311
+
languageModel: z.object({
312
+
provider: z.string().describe("The model provider (e.g., 'anthropic', 'openai')"),
313
+
model: z.string().describe("The model ID"),
314
+
displayName: z.string().optional().describe("Optional display name for the model"),
315
+
}).describe("The language model used to generate the response"),
0 commit comments