Use with agents

Fix a Laravel problem with exact profile data

Give the agent a reproducible action and its profile ID. It can follow the captured evidence, change the application code, and verify the same behavior.

A repeated booking query with eight runs and its application call site
The browser and MCP read the same retained query evidence. This group points to one booking lookup per itinerary day.

Start with one reproducible action

Connect the local MCP server, visit the affected page, and copy its X-NewDebugBar-Profile response header. State the symptom and any behavior the fix must preserve.

Debug the itinerary request using The New Debug Bar profile PROFILE_ID. Find why booking queries repeat, trace the evidence to application code, make the smallest useful fix, then repeat the request and run a focused test. Keep the itinerary days, bookings, and ordering unchanged. Report the before-and-after evidence and any remaining uncertainty.

Replace PROFILE_ID with your request’s ID. If the agent must locate it, have it match method, path, type, status, and recorded time.

Read findings, then one focused query group

First call get-debug-findings for the ID. For the repeated-bookings lead, use inspect-debug-queries with these arguments:

{ "profile_id": "PROFILE_ID", "filter": "repeated", "search": "bookings", "cursor": 0, "limit": 5 }

Inspect the execution count, differing bindings, and retained call site. In the illustrated example, eight itinerary days cause eight booking reads from the same application line. That is stronger evidence than a high total query count alone.

When a focused result leaves out a detail, use get-debug-profile-data from /inspectors/queries/payload/records and follow the returned paths. The tool reference explains pagination and failures.

Change the caller that repeats the work

The example loads each day’s bookings in a loop:

$days = $trip->days()->get(); foreach ($days as $day) { $day->setRelation('bookings', $day->bookings()->get()); }

Eager loading lets Laravel fetch bookings for the complete set of days:

$days = $trip->days()->with('bookings')->get();

The agent should inspect the relationship definition and any filters or ordering before making this change. A different per-day condition may require a different solution.

Capture again and compare like with like

Relationship-loading example Before After
Day queries 1 1
Booking queries for eight days 8 1
Queries in this isolated loading step 9 2

These counts describe the day-and-booking loading step, not every query in the full benchmark page. Use the new response ID after the change. Compare returned day and booking IDs and ordering, then check the affected query group.

Add a focused query-budget or response test using profile assertions. A smaller count is useful only if the required response still works.

Handle incomplete evidence explicitly

  • If the ID expired, reproduce and capture a new one.
  • If the tool returns another page, follow its cursor instead of treating the first page as the full list.
  • If background refresh failed, use retained data and report what could not be refreshed.
  • If a value was not retained, inspect the app code or reproduce with the needed capture setting.

Next step

Keep the improvement covered

Turn a verified fix into a small request-profile regression test.

Read the guide