Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 364
feat(mcp): ask subagent#814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
4ed56afee6a423865d88ef1e264f6b71879e689590f04dd3326544541561c72e8f9d295b898962f1b008c3cf085ac4aac70833896File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -234,6 +234,32 @@ Get a list of commits for a given repository. | ||
| </details> | ||
| ### list_language_models | ||
| Lists the available language models configured on the Sourcebot instance. Use this to discover which models can be specified when calling `ask_codebase`. | ||
| <details> | ||
| <summary>Parameters</summary> | ||
| This tool takes no parameters. | ||
| </details> | ||
| ### ask_codebase | ||
| 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. | ||
| <details> | ||
| <summary>Parameters</summary> | ||
| | Name | Required | Description | | ||
| |:----------------|:---------|:-----------------------------------------------------------------------------------------------------------------------------------------------| | ||
| | `query` | yes | The query to ask about the codebase. | | ||
| | `repos` | no | The repositories that are accessible to the agent during the chat. If not provided, all repositories are accessible. | | ||
| | `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. | | ||
brendan-kellam marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| </details> | ||
| ## Supported Code Hosts | ||
| Sourcebot supports the following code hosts: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import { env } from './env.js'; | ||
| import { listReposResponseSchema, searchResponseSchema, fileSourceResponseSchema, listCommitsResponseSchema } from './schemas.js'; | ||
| import { FileSourceRequest, ListReposQueryParams, SearchRequest, ListCommitsQueryParamsSchema } from './types.js'; | ||
| import { listReposResponseSchema, searchResponseSchema, fileSourceResponseSchema, listCommitsResponseSchema, askCodebaseResponseSchema, listLanguageModelsResponseSchema } from './schemas.js'; | ||
| import { AskCodebaseRequest, AskCodebaseResponse, FileSourceRequest, ListReposQueryParams, SearchRequest, ListCommitsQueryParamsSchema, ListLanguageModelsResponse } from './types.js'; | ||
| import { isServiceError, ServiceErrorException } from './utils.js'; | ||
| import { z } from 'zod'; | ||
| @@ -106,4 +106,43 @@ export const listCommits = async (queryParams: ListCommitsQueryParamsSchema) => | ||
| const commits = await parseResponse(response, listCommitsResponseSchema); | ||
| const totalCount = parseInt(response.headers.get('X-Total-Count') ?? '0', 10); | ||
| return { commits, totalCount }; | ||
| } | ||
| } | ||
| /** | ||
| * Asks a natural language question about the codebase using the Sourcebot AI agent. | ||
| * This is a blocking call that runs the full agent loop and returns when complete. | ||
| * | ||
| * @param request - The question and optional repo filters | ||
| * @returns The agent's answer, chat URL, sources, and metadata | ||
| */ | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| export const askCodebase = async (request: AskCodebaseRequest): Promise<AskCodebaseResponse> => { | ||
| const response = await fetch(`${env.SOURCEBOT_HOST}/api/chat/blocking`, { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'X-Sourcebot-Client-Source': 'mcp', | ||
| ...(env.SOURCEBOT_API_KEY ? { 'X-Sourcebot-Api-Key': env.SOURCEBOT_API_KEY } : {}) | ||
| }, | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| body: JSON.stringify(request), | ||
| }); | ||
| return parseResponse(response, askCodebaseResponseSchema); | ||
| } | ||
| /** | ||
| * Lists the available language models configured on the Sourcebot instance. | ||
| * | ||
| * @returns Array of language model info objects | ||
| */ | ||
| export const listLanguageModels = async (): Promise<ListLanguageModelsResponse> => { | ||
| const response = await fetch(`${env.SOURCEBOT_HOST}/api/models`, { | ||
| method: 'GET', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'X-Sourcebot-Client-Source': 'mcp', | ||
| ...(env.SOURCEBOT_API_KEY ? { 'X-Sourcebot-Api-Key': env.SOURCEBOT_API_KEY } : {}) | ||
| }, | ||
| }); | ||
| return parseResponse(response, listLanguageModelsResponseSchema); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.