> ## Documentation Index
> Fetch the complete documentation index at: https://www.greptile.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Resolve Comments in your IDE

> Retrieve and resolve Greptile review comments automatically with coding agents

Use Greptile's MCP server to automatically retrieve and resolve code review comments directly in your IDE.

<Note>
  **Prerequisites**: First [set up the MCP server in your IDE](/mcp/setup-ides), then follow the workflows below.
</Note>

## Overview

Once you have set up the Greptile MCP server in your IDE, you will be able to:

* Retrieve unaddressed review comments
* Search for specific types of issues
* Get context about why issues were flagged
* Apply fixes based on Greptile's suggestions

...all from within your IDE.

## Retrieving Comments

### Get Comments for Current PR

<Steps>
  <Step title="Identify Current PR">
    When working on a branch, your IDE will automatically detect the associated PR.
  </Step>

  <Step title="Ask for Comments">
    Use these proven prompts with Claude:

    * "Show me all unaddressed Greptile comments for this PR"
    * "What security issues has Greptile found recently?"
    * "Search for Greptile comments about error handling"
  </Step>

  <Step title="Review Comment Details">
    Claude will show you:

    * Complete comment text with context
    * File paths and specific line numbers
    * Whether comments are addressed or still open
    * Related custom context patterns that were violated
    * PR information and repository details
  </Step>
</Steps>

### Search for Specific Issues

**Find Comments by Type:**

* *"Find all security-related Greptile comments in this repository"*
* *"Show me performance issues flagged by Greptile"*
* *"Get error handling comments from recent reviews"*

**Find Comments by File:**

* *"Show Greptile comments for the current file"*
* *"Are there any unaddressed reviews for src/auth.js?"*
* *"What issues has Greptile found in this component?"*

These searches work across your entire organization's repositories and return real comment data with file locations and context.

## Resolving Comments Step-by-Step

### Automated Resolution

<Steps>
  <Step title="Select Comment to Fix">
    In your IDE, click on a Greptile comment or use:
    "Fix this Greptile comment: \[paste comment text]"
  </Step>

  <Step title="Analyze the Issue">
    The IDE will:

    * Read the comment and understand the problem
    * Examine the code context
    * Check related custom context patterns
    * Determine the appropriate fix strategy
  </Step>

  <Step title="Generate Fix">
    The coding agent will:

    * Propose a specific code change
    * Explain why this fix addresses the issue
    * Show before/after code comparison
  </Step>

  <Step title="Apply Fix">
    Review and apply the suggested changes:

    * "Apply this fix"
    * "Show me the diff first"
    * "Explain why this fixes the issue"
  </Step>

  <Step title="Verify Resolution">
    Confirm the fix addresses the original concern:

    * Run relevant tests
    * Check for syntax errors
    * Validate the solution makes sense
  </Step>
</Steps>

### Manual Resolution with AI Guidance

**Get Detailed Explanation:**

* *"Explain this Greptile comment in detail and suggest how to fix it"*
* *"Why is this flagged as a security issue?"*
* *"What's the best way to resolve this performance concern?"*

**Get Fix Suggestions:**

* *"How should I fix this memory leak issue?"*
* *"Suggest 2-3 ways to address this code duplication"*
* *"What's the proper error handling pattern here?"*

## Practical Examples

### Security Issue Resolution

**Greptile Comment:**

> "Consider adding input validation to prevent potential security vulnerabilities. The user input should be sanitized before processing."

**In Claude Code:**

```
You: "Fix this security issue: Missing input validation for user ID parameter"

Claude Code: I'll help you add proper input validation. Looking at your code, I can see the getUserData function is missing validation. Here's the fix:

[Shows before/after code with input validation added]

Would you like me to apply this fix and also check for similar issues in other functions?
```

### Performance Issue Resolution

**Greptile Comment:**

> "N+1 query problem detected - consider using joins or batch loading"

**In Cursor:**

```
You: "How do I fix this N+1 query problem?"

Cursor: I can see the issue in your code. You're making individual database queries in a loop. Here's how to fix it with a join:

[Shows optimized query with proper joins]

This will reduce your database calls from N+1 to just 1. Should I apply this change?
```

### Code Style Violation

**Greptile Comment:**

> "Use camelCase for variable names according to team guidelines"

**Resolution Workflow:**

```
You: "Fix the naming convention issues in this file"

IDE: I found 3 variables that need to be converted to camelCase:
- user_data → userData
- is_valid → isValid
- api_response → apiResponse

I'll update these and any references. Applying changes now...
```

## Advanced Workflows

<Note>
  The following sections cover advanced automation. For basic comment resolution, the steps above are sufficient.
</Note>

### Batch Comment Resolution

**Resolve Multiple Comments:**

```
You: "Show me all unaddressed Greptile comments for this PR and fix the ones you can automatically"

IDE: I found 8 unaddressed comments:
✅ Fixed: 3 naming convention issues
✅ Fixed: 2 missing error handling cases
⚠️  Needs review: 1 architecture concern
⚠️  Needs review: 2 complex logic issues

I've applied the automatic fixes. The remaining 3 comments need your input because they involve design decisions.
```

### Context-Aware Fixes

**Using Custom Context:**

```
You: "Fix this error handling according to our team patterns"

IDE: Based on your organization's custom context, I see you use Result<T, E> for error handling. I'll update this function to follow that pattern:

[Shows conversion from try/catch to Result pattern]

This matches the pattern used in 15 other functions in your codebase.
```

### Integration with Development Workflow

**Pre-commit Resolution:**

```
You: "Before I commit, check if there are any unaddressed Greptile comments in my changes"

IDE: I found 2 unaddressed comments in your staged files:
1. Missing null check in user.service.js:45
2. Inconsistent error message format in auth.controller.js:23

Would you like me to fix these before you commit?
```

***

## Best Practices

<Accordion title="Quick Reference: When to Use Auto-Fix vs Manual Review">
  ### When to Use Auto-Fix

  **Safe for Auto-Fix:**

  * Code style and formatting issues
  * Simple null checks and validation
  * Naming convention corrections
  * Basic error handling additions

  **Requires Review:**

  * Architecture and design changes
  * Complex logic modifications
  * Performance optimizations with tradeoffs
  * Security fixes affecting business logic

  ### Verification Steps

  * **Code Review**: Always review auto-generated fixes before applying them to ensure they make sense in context
  * **Test execution:** Run relevant tests after applying fixes to catch any regressions
  * **Review integration:** Mark comments as addressed only after verification
  * **Rollback capability:** Provide undo functionality for problematic fixes

  ### Human Oversight

  * **Confidence scoring:** Only auto-apply high-confidence fixes
  * **Review queuing:** Queue uncertain fixes for human review
  * **Explanation logging:** Document what changes were made and why
  * **Approval workflows:** Require human approval for critical file changes
</Accordion>
