Skip to content

Comments

feat: add line number and context to stepping tool responses#9

Merged
debugmcpdev merged 2 commits intomainfrom
claude/stepping-tools-line-context-011CUzs3Upctr5ALAHG5svzh
Nov 11, 2025
Merged

feat: add line number and context to stepping tool responses#9
debugmcpdev merged 2 commits intomainfrom
claude/stepping-tools-line-context-011CUzs3Upctr5ALAHG5svzh

Conversation

@debugmcpdev
Copy link
Collaborator

Enhanced step_over, step_into, and step_out tools to return current location (file, line, column) and surrounding source code context, similar to set_breakpoint response format.

This improves UX for AI agents who don't have visual debuggers by providing immediate feedback about where execution stopped after each step operation.

Changes:

  • SessionManager: Modified _executeStepOperation to capture current location from stack trace after stopped event
  • Server: Updated step methods to return full DebugResult with location and use LineReader to add source context
  • Tests: Updated E2E smoke tests to verify location and context fields are present in step responses

Response format now includes:
{
success: true, message: "Stepped over", state: "paused", location: { file: "...", line: 42, column: 0 }, context: { lineContent: "current line source", surrounding: [{ line: 40, content: "..." }, ...] } }

📋 Description

Please include a summary of the changes and which issue is fixed. Include relevant motivation and context.

Fixes # (issue number)

🔄 Type of Change

Please delete options that are not relevant.

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🧹 Code refactoring
  • ⚡ Performance improvement
  • 🧪 Test improvement

✅ Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

🧪 Testing

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

# Example test command
npm test

Test Configuration:

  • OS: [e.g., Ubuntu 22.04]
  • Node version: [e.g., 20.11.0]
  • Python version: [e.g., 3.11.5]

📸 Screenshots (if applicable)

If your changes include UI updates or visual debugging improvements, please add screenshots.

🔗 Related Issues

Link any related issues here:

  • Related to #
  • Depends on #
  • Blocks #

📝 Additional Notes

Any additional information that reviewers should know.


Reviewer: @debugmcp

Enhanced step_over, step_into, and step_out tools to return current
location (file, line, column) and surrounding source code context,
similar to set_breakpoint response format.

This improves UX for AI agents who don't have visual debuggers by
providing immediate feedback about where execution stopped after
each step operation.

Changes:
- SessionManager: Modified _executeStepOperation to capture current
  location from stack trace after stopped event
- Server: Updated step methods to return full DebugResult with
  location and use LineReader to add source context
- Tests: Updated E2E smoke tests to verify location and context
  fields are present in step responses

Response format now includes:
{
  success: true,
  message: "Stepped over",
  state: "paused",
  location: { file: "...", line: 42, column: 0 },
  context: {
    lineContent: "current line source",
    surrounding: [{ line: 40, content: "..." }, ...]
  }
}
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +309 to +333
public async stepOver(sessionId: string): Promise<{ success: boolean; state: string; error?: string; data?: unknown; }> {
this.validateSession(sessionId);
const result = await this.sessionManager.stepOver(sessionId);
if (!result.success) {
throw new Error(result.error || 'Failed to step over');
}
return true;
return result;
}

public async stepInto(sessionId: string): Promise<boolean> {
public async stepInto(sessionId: string): Promise<{ success: boolean; state: string; error?: string; data?: unknown; }> {
this.validateSession(sessionId);
const result = await this.sessionManager.stepInto(sessionId);
if (!result.success) {
throw new Error(result.error || 'Failed to step into');
}
return true;
return result;
}

public async stepOut(sessionId: string): Promise<boolean> {
public async stepOut(sessionId: string): Promise<{ success: boolean; state: string; error?: string; data?: unknown; }> {
this.validateSession(sessionId);
const result = await this.sessionManager.stepOut(sessionId);
if (!result.success) {
throw new Error(result.error || 'Failed to step out');
}
return true;
return result;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Badge Step API now returns DebugResult but callers still expect boolean

The three stepping methods now return the full DebugResult object rather than a boolean, but the rest of the codebase still calls them as booleans. For example tests/test-utils/helpers/session-helpers.ts exports stepOver/stepInto/stepOut as Promise<boolean> and simply forwards the server result, and unit tests such as tests/unit/server-coverage.test.ts assert await expect(server.stepOver(...)).resolves.toBe(true). After this change those calls will resolve to an object, so the existing tests and any consumers will fail immediately. Either the return types need to remain boolean or all callers and type signatures must be updated in the same change.

Useful? React with 👍 / 👎.

@debugmcpdev debugmcpdev self-assigned this Nov 10, 2025
Step methods (stepOver, stepInto, stepOut) now return the full
DebugResult object instead of boolean, so tests need to expect
the object structure.
@codecov
Copy link

codecov bot commented Nov 10, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@debugmcpdev debugmcpdev merged commit f04d3d1 into main Nov 11, 2025
6 of 7 checks passed
@debugmcpdev debugmcpdev deleted the claude/stepping-tools-line-context-011CUzs3Upctr5ALAHG5svzh branch November 11, 2025 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants