Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bugbug/tools/code_review/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
**Step 3: Verify and Assess Confidence**
- Use available tools when you need to verify concerns or gather additional context
- Only include comments where you are at least 80% confident the issue is valid
- When uncertain about an issue, use tools like `find_function_definition` or `expand_context` to verify before commenting
- When uncertain about an issue, use available tools to verify before commenting
- Do not suggest issues you cannot verify with available context
**Step 4: Sort and Order Comments**
Expand Down
36 changes: 0 additions & 36 deletions services/mcp/src/bugbug_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from fastmcp.resources import FileResource
from pydantic import Field

from bugbug import utils
from bugbug.code_search.searchfox_api import FunctionSearchSearchfoxAPI
from bugbug.tools.code_review.prompts import SYSTEM_PROMPT_TEMPLATE
from bugbug.tools.core.platforms.bugzilla import SanitizedBug
from bugbug.tools.core.platforms.phabricator import (
Expand Down Expand Up @@ -57,40 +55,6 @@ async def patch_review(
return system_prompt + "\n\n" + initial_prompt


def get_file(commit_hash, path):
if commit_hash == "main":
commit_hash = "refs/heads/main"

r = utils.get_session("githubusercontent").get(
f"https://raw.githubusercontent.com/mozilla-firefox/firefox/{commit_hash}/{path}",
headers={
"User-Agent": utils.get_user_agent(),
},
)
r.raise_for_status()
return r.text


function_search = FunctionSearchSearchfoxAPI(get_file)


@mcp.tool()
def find_function_definition(
function_name: Annotated[str, "The name of the function to find its definition."],
) -> str:
"""Find the definition of a function in the Firefox codebase using Searchfox."""
functions = function_search.get_function_by_name(
"main",
"n/a", # The file path is not used
function_name,
)

if not functions:
return "Function definition not found."

return functions[0].source


@mcp.resource(
uri="bugzilla://bug/{bug_id}",
name="Bugzilla Bug Content",
Expand Down