-
Notifications
You must be signed in to change notification settings - Fork 217
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds MCP client APIs for listing language models and asking the codebase; introduces a blocking chat endpoint that runs an agent synchronously; consolidates repo-listing/search tooling into a single listRepos flow; refactors agent prompt/file-source resolution to use selectedRepos and updates UI tooling and telemetry. Changes
Sequence DiagramsequenceDiagram
participant Client
participant BlockingAPI as POST /api/chat/blocking
participant Auth as Auth Layer
participant DB as Database
participant Agent as Agent/Streaming
participant LLM as Language Model
Client->>BlockingAPI: POST { query, repos, languageModel? }
BlockingAPI->>BlockingAPI: validate request schema
BlockingAPI->>Auth: authenticate / get context
Auth->>DB: fetch user/config
DB-->>Auth: user/context
Auth-->>BlockingAPI: authenticated
BlockingAPI->>DB: select model & create private chat + user message
DB-->>BlockingAPI: chatId/messageId
BlockingAPI->>Agent: invoke createMessageStream(selectedRepos, onFinish)
Agent->>LLM: request / stream tokens (tool invocations executed as needed)
LLM-->>Agent: streaming tokens
Agent->>Agent: onFinish(final messages)
Agent->>DB: persist final messages
DB-->>Agent: persisted
Agent-->>BlockingAPI: stream complete
BlockingAPI->>BlockingAPI: extract markdown answer, build chatUrl
BlockingAPI-->>Client: { answer, chatId, chatUrl, languageModel }
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Can we add telemetry for MCP tool usage? |
d2be4cb to
59c6ebb
Compare
|
@brendan-kellam your pull request is missing a changelog! |
Code ReviewSecurity Issue Found Missing Organization ID Filter in Repository LookupLocation: Issue: The repository lookup is missing the Current code: const repoDB = await prisma.repo.findFirst({
where: {
name: repo,
},
});Should be: const repoDB = await prisma.repo.findFirst({
where: {
name: repo,
orgId: org.id,
},
});Explanation: Without the References: This pattern is consistently used throughout the codebase: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@packages/mcp/src/client.ts`:
- Around line 107-113: The docstring for the "Asks a natural language
question..." function is out of sync with the actual response shape
(implementation returns only `answer`, `chatId`, and `chatUrl`); either update
the docstring to list exactly those fields or extend the function's response to
include `sources` and `metadata`. Locate the function's return object (the
response schema that currently contains `answer`, `chatId`, `chatUrl`) and
either add `sources` and `metadata` to that object and its types, or change the
docstring text to explicitly document `answer`, `chatId`, and `chatUrl` only
(and update any exported types/interfaces used by callers).
In `@packages/web/src/app/api/`(server)/chat/blocking/route.ts:
- Around line 108-129: The loop is causing N+1 DB queries by calling
prisma.repo.findFirst for each repo; replace it with a single batched query
using prisma.repo.findMany({ where: { name: { in: repos } } }), then build a map
from repo name to the returned repo rows, detect any missing repo names and
throw the same ServiceErrorException for the first missing (or aggregate as you
prefer), and finally populate selectedSearchScopes from the mapped results using
repo.displayName ?? repo.name.split('/').pop() ?? repo.name and
repo.external_codeHostType to preserve original behavior.
🧹 Nitpick comments (3)
packages/web/src/app/api/(server)/chat/blocking/route.ts (2)
198-204: Simplify the while loop condition.The
while (true as const)syntax is unconventional. A simplewhile (true)achieves the same result and is more idiomatic.♻️ Suggested simplification
const blockStreamUntilFinish = async <T extends UIMessage<unknown, UIDataTypes, UITools>>(stream: ReadableStream<InferUIMessageChunk<T>>) => { const reader = stream.getReader(); - while (true as const) { + while (true) { const { done } = await reader.read(); if (done) break; } }
54-196: Consider adding telemetry for MCP tool usage.A reviewer (msukkari) requested telemetry for MCP tool usage. This blocking endpoint is a primary entry point for MCP integrations and would benefit from telemetry to track usage patterns, latency, and errors.
packages/mcp/src/index.ts (1)
242-275: Consider adding error handling foraskCodebasefailures.The
ask_codebasetool handler directly awaitsaskCodebase(request)without error handling. If the blocking chat endpoint returns an error or times out, the MCP client will receive an unhandled exception. Other tools in this file also lack explicit error handling, but given the 30-60+ second blocking nature of this tool, explicit error handling would improve the user experience.♻️ Suggested error handling
async (request: AskCodebaseRequest) => { - const response = await askCodebase(request); - - // Format the response with the answer and a link to the chat - const formattedResponse = dedent` - ${response.answer} - - --- - **View full research session:** ${response.chatUrl} - `; - - return { - content: [{ - type: "text", - text: formattedResponse, - }], - }; + try { + const response = await askCodebase(request); + + // Format the response with the answer and a link to the chat + const formattedResponse = dedent` + ${response.answer} + + --- + **View full research session:** ${response.chatUrl} + `; + + return { + content: [{ + type: "text", + text: formattedResponse, + }], + }; + } catch (error) { + const message = error instanceof Error ? error.message : 'Unknown error occurred'; + return { + content: [{ + type: "text", + text: `Failed to query codebase: ${message}`, + }], + isError: true, + }; + } }
… tool since it is redudant with lsit repos
92893a7 to
e689590
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@packages/mcp/src/client.ts`:
- Around line 119-124: The fetch call in askCodebase
(packages/mcp/src/client.ts) is missing the standard telemetry header; update
the headers object passed to fetch (the POST to
`${env.SOURCEBOT_HOST}/api/chat/blocking`) to include
'X-Sourcebot-Client-Source': 'mcp' alongside the existing 'Content-Type' and
optional 'X-Sourcebot-Api-Key' so MCP calls have consistent client-source
attribution.
In `@packages/web/src/app/api/`(server)/repos/listReposApi.ts:
- Around line 17-36: The totalCount calculation currently reuses the filtered
where clause including query; update the prisma.repo.count call in listReposApi
so its where only includes orgId (e.g., { orgId: org.id }) and does not apply
the name contains filter, ensuring prisma.repo.findMany retains the filtered
results while totalCount remains the unfiltered org-wide count; adjust the
Promise.all tuple that sets [repos, totalCount] accordingly (references:
prisma.repo.findMany, prisma.repo.count, repos, totalCount, org.id, query).
🧹 Nitpick comments (1)
packages/web/src/features/chat/tools.ts (1)
179-183: Redundant.optional()after.default()in Zod schema.The
limitparameter uses.default(DEFAULT_SEARCH_LIMIT)followed by.optional(). In Zod,.default()already handles undefined inputs by providing the default value. Adding.optional()afterwards changes the inferred output type to includeundefined, which contradicts the intent of having a default.♻️ Proposed fix
limit: z .number() .default(DEFAULT_SEARCH_LIMIT) .describe(`Maximum number of matches to return (default: ${DEFAULT_SEARCH_LIMIT})`) - .optional(), + ,
| const [repos, totalCount] = await Promise.all([ | ||
| prisma.repo.findMany({ | ||
| where: { | ||
| orgId: org.id, | ||
| ...(query ? { | ||
| name: { contains: query, mode: 'insensitive' }, | ||
| } : {}), | ||
| }, | ||
| skip, | ||
| take: perPage, | ||
| orderBy: { [orderByField]: direction }, | ||
| }), | ||
| prisma.repo.count({ | ||
| where: { | ||
| orgId: org.id, | ||
| ...(query ? { | ||
| name: { contains: query, mode: 'insensitive' }, | ||
| } : {}), | ||
| }, | ||
| }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Total count should remain unfiltered to preserve API contract.
totalCount is currently filtered by query, but the /api/repos contract expects the unfiltered org-wide count.
🔧 Suggested fix
const [repos, totalCount] = await Promise.all([
prisma.repo.findMany({
where: {
orgId: org.id,
...(query ? {
name: { contains: query, mode: 'insensitive' },
} : {}),
},
skip,
take: perPage,
orderBy: { [orderByField]: direction },
}),
prisma.repo.count({
where: {
- orgId: org.id,
- ...(query ? {
- name: { contains: query, mode: 'insensitive' },
- } : {}),
+ orgId: org.id,
},
}),
]);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const [repos, totalCount] = await Promise.all([ | |
| prisma.repo.findMany({ | |
| where: { | |
| orgId: org.id, | |
| ...(query ? { | |
| name: { contains: query, mode: 'insensitive' }, | |
| } : {}), | |
| }, | |
| skip, | |
| take: perPage, | |
| orderBy: { [orderByField]: direction }, | |
| }), | |
| prisma.repo.count({ | |
| where: { | |
| orgId: org.id, | |
| ...(query ? { | |
| name: { contains: query, mode: 'insensitive' }, | |
| } : {}), | |
| }, | |
| }), | |
| const [repos, totalCount] = await Promise.all([ | |
| prisma.repo.findMany({ | |
| where: { | |
| orgId: org.id, | |
| ...(query ? { | |
| name: { contains: query, mode: 'insensitive' }, | |
| } : {}), | |
| }, | |
| skip, | |
| take: perPage, | |
| orderBy: { [orderByField]: direction }, | |
| }), | |
| prisma.repo.count({ | |
| where: { | |
| orgId: org.id, | |
| }, | |
| }), | |
| ]); |
🤖 Prompt for AI Agents
In `@packages/web/src/app/api/`(server)/repos/listReposApi.ts around lines 17 -
36, The totalCount calculation currently reuses the filtered where clause
including query; update the prisma.repo.count call in listReposApi so its where
only includes orgId (e.g., { orgId: org.id }) and does not apply the name
contains filter, ensuring prisma.repo.findMany retains the filtered results
while totalCount remains the unfiltered org-wide count; adjust the Promise.all
tuple that sets [repos, totalCount] accordingly (references:
prisma.repo.findMany, prisma.repo.count, repos, totalCount, org.id, query).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/web/src/features/chat/agent.ts`:
- Around line 180-195: The template emits a `<files>` block even when files is
an empty array and places raw file.source into XML which can break tags; change
the condition from `files` to `files && files.length > 0` to avoid emitting an
empty `<files>` section, and ensure file contents are escaped when inserted
(e.g. wrap content in a CDATA block and sanitize occurrences of `]]>` by
splitting or fallback to HTML-escaping) before calling
`addLineNumbers(file.source)` so the `<file>` tags never get broken; update the
template expression that builds `${files?.map(...).join(...)}` accordingly.
🧹 Nitpick comments (2)
packages/mcp/README.md (1)
237-249: Documentation forask_codebaselooks good.The tool description is clear and the parameters table follows the established format. One minor style nit from static analysis:
📝 Optional: Capitalize "Markdown" as a proper noun
-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. +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.packages/web/src/features/chat/agent.ts (1)
37-65: Add a type guard when filtering resolved file sources.
filter(source !== undefined)doesn’t narrow the type, socreatePromptcan still seeundefinedentries. A type guard keeps the array clean and avoids downstream optional handling.♻️ Suggested update
- ).filter((source) => source !== undefined); + ).filter((source): source is NonNullable<typeof source> => source !== undefined);
| ${repos.length > 0 ? dedent` | ||
| <selected_repositories> | ||
| The user has explicitly selected the following repositories for analysis: | ||
| ${repos.map(repo => `- ${repo}`).join('\n')} | ||
| </selected_repositories> | ||
| ` : ''} | ||
|
|
||
| ${files ? dedent` | ||
| <files> | ||
| The user has mentioned the following files, which are automatically included for analysis. | ||
|
|
||
| ${files?.map(file => `<file path="${file.path}" repository="${file.repo}" language="${file.language}" revision="${file.revision}"> | ||
| ${addLineNumbers(file.source)} | ||
| </file>`).join('\n\n')} | ||
| </files> | ||
| `: ''} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid emitting an empty <files> section and escape file contents.
If files is an empty array, the prompt currently claims files were provided; also raw content can break <file> tags when code contains </file> or ]]>.
🛠️ Suggested update
- ${files ? dedent`
+ const hasFiles = (files?.length ?? 0) > 0;
+ const escapeCdata = (value: string) => value.replaceAll(']]>', ']]]]><![CDATA[>');
+
+ ${hasFiles ? dedent`
<files>
The user has mentioned the following files, which are automatically included for analysis.
- ${files?.map(file => `<file path="${file.path}" repository="${file.repo}" language="${file.language}" revision="${file.revision}">
- ${addLineNumbers(file.source)}
- </file>`).join('\n\n')}
+ ${files!.map(file => `<file path="${file.path}" repository="${file.repo}" language="${file.language}" revision="${file.revision}"><![CDATA[${escapeCdata(addLineNumbers(file.source))}]]></file>`).join('\n\n')}
</files>
- `: ''}
+ `: ''}🤖 Prompt for AI Agents
In `@packages/web/src/features/chat/agent.ts` around lines 180 - 195, The template
emits a `<files>` block even when files is an empty array and places raw
file.source into XML which can break tags; change the condition from `files` to
`files && files.length > 0` to avoid emitting an empty `<files>` section, and
ensure file contents are escaped when inserted (e.g. wrap content in a CDATA
block and sanitize occurrences of `]]>` by splitting or fallback to
HTML-escaping) before calling `addLineNumbers(file.source)` so the `<file>` tags
never get broken; update the template expression that builds
`${files?.map(...).join(...)}` accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@docs/docs/features/mcp-server.mdx`:
- Around line 220-227: Update the ask_codebase tool description to capitalize
the proper noun "Markdown" and apply the minor wording polish: change the phrase
"Returns a detailed answer in markdown format with code references, plus a link
to view the full research session in the Sourcebot web UI." to use "Markdown"
and improve clarity (e.g., "Returns a detailed answer in Markdown format with
code references and a link to view the full research session in the Sourcebot
web UI."). Ensure the change is made in the string for the ask_codebase
description and the related parameter/table text that currently contains
"markdown" so the tool name "ask_codebase" and the table entry for the return
description reflect the corrected capitalization and wording.
In `@packages/mcp/README.md`:
- Around line 248-260: The ask_codebase section's Markdown table has
alignment/formatting issues causing MARKDOWN_NNP/MD060 lint warnings; fix by
normalizing the table header and separator row (ensure the header row uses pipes
and the separator row uses matching colons/dashes like "|:---|:---:|---:|" for
intended alignment), make sure each cell is separated by pipes with consistent
whitespace, remove any stray blank lines or mismatched backticks around column
names (e.g., `query`, `repos`, `languageModel`) and ensure the surrounding
details/summary blocks are properly nested so the table renders as a single
contiguous block under the "Parameters" summary in the ask_codebase section.
🧹 Nitpick comments (1)
packages/mcp/src/index.ts (1)
275-282: Consider showing provider/displayName in the “Model used” line.
Using onlymodelcan be ambiguous across providers; a displayName orprovider/modelreads clearer.💡 Example tweak
- **Model used:** ${response.languageModel.model} + **Model used:** ${response.languageModel.displayName ?? `${response.languageModel.provider}/${response.languageModel.model}`}
| 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. | ||
|
|
||
| Parameters: | ||
| | Name | Required | Description | | ||
| |:-------------|:---------|:-----------------------------------------------------------------| | ||
| | `fileName` | yes | The file to fetch the source code for. | | ||
| | `repoId` | yes | The Sourcebot repository ID. | | ||
| | 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. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalize “Markdown” (proper noun).
Minor wording polish for the ask_codebase description.
✏️ Proposed fix
-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.
+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.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 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. | |
| Parameters: | |
| | Name | Required | Description | | |
| |:-------------|:---------|:-----------------------------------------------------------------| | |
| | `fileName` | yes | The file to fetch the source code for. | | |
| | `repoId` | yes | The Sourcebot repository ID. | | |
| | 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. | | |
| 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. | |
| Parameters: | |
| | 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. | |
🧰 Tools
🪛 LanguageTool
[uncategorized] ~220-~220: Did you mean the formatting language “Markdown” (= proper noun)?
Context: ... question. Returns a detailed answer in markdown format with code references, plus a lin...
(MARKDOWN_NNP)
🤖 Prompt for AI Agents
In `@docs/docs/features/mcp-server.mdx` around lines 220 - 227, Update the
ask_codebase tool description to capitalize the proper noun "Markdown" and apply
the minor wording polish: change the phrase "Returns a detailed answer in
markdown format with code references, plus a link to view the full research
session in the Sourcebot web UI." to use "Markdown" and improve clarity (e.g.,
"Returns a detailed answer in Markdown format with code references and a link to
view the full research session in the Sourcebot web UI."). Ensure the change is
made in the string for the ask_codebase description and the related
parameter/table text that currently contains "markdown" so the tool name
"ask_codebase" and the table entry for the return description reflect the
corrected capitalization and wording.
| ### 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. | | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix minor doc/formatting nits (Markdown + table alignment).
These are minor, but will clear the lint hints (MARKDOWN_NNP, MD060).
✏️ Suggested doc fix
-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.
+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.
@@
-| 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. |
+| 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 options. |📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ### 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. | | |
| ### 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 options. | |
🧰 Tools
🪛 LanguageTool
[uncategorized] ~250-~250: Did you mean the formatting language “Markdown” (= proper noun)?
Context: ... question. Returns a detailed answer in markdown format with code references, plus a lin...
(MARKDOWN_NNP)
🪛 markdownlint-cli2 (0.20.0)
[warning] 259-259: Table column style
Table pipe does not align with header for style "aligned"
(MD060, table-column-style)
🤖 Prompt for AI Agents
In `@packages/mcp/README.md` around lines 248 - 260, The ask_codebase section's
Markdown table has alignment/formatting issues causing MARKDOWN_NNP/MD060 lint
warnings; fix by normalizing the table header and separator row (ensure the
header row uses pipes and the separator row uses matching colons/dashes like
"|:---|:---:|---:|" for intended alignment), make sure each cell is separated by
pipes with consistent whitespace, remove any stray blank lines or mismatched
backticks around column names (e.g., `query`, `repos`, `languageModel`) and
ensure the surrounding details/summary blocks are properly nested so the table
renders as a single contiguous block under the "Parameters" summary in the
ask_codebase section.
Summary by CodeRabbit
New Features
Improvements
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.