mr_diff_sections
Group a merge request's diff by enclosing function or class instead of raw hunks, including every changed line. Reduces payload on large MRs without truncating mid-function.
Instructions
Fetch a merge request's diff grouped by enclosing function/class, not raw hunks.
AST-aware for new files (full tree-sitter chunking) and hunk-context-aware for modified files (declaration pattern + hunk-header hint). All changed lines (add/del) are always included — nothing dropped, only the framing changes. Prefer this over mr_diff_lines on a large MR (many files or a big diff) since grouping by symbol keeps the payload small without truncating mid-function.
Token-safe by construction, same guarantees as mr_diff_lines: on a large MR it returns a bounded page of files and lists the rest under "omitted_files" with "truncated": true. Noise files (lockfiles, generated, binary) are listed under "skipped_files", not expanded. For unknown-size MRs, call mr_changed_files first, then batch files_filter here.
Args: url: Full GitLab merge request URL. include_context_lines: Include unchanged surrounding lines in each section. Default False keeps the payload small. files_filter: Optional list of file-path fragments to include. Passing this is a TARGETED fetch — noise-skip and the budget are disabled so you get exactly the files you ask for. max_chars: Token-safety budget for the returned diff body (default 80000). Ignored for targeted fetches. skip_noise: Keep lockfiles/generated/binary out of the body (listed under skipped_files). Default True. Ignored when filtering.
Returns: {mr_number, title, author, branches, description, commits, diff_shas, files[{file_path, language, new_file, deleted_file, additions, deletions, sections[{symbol, symbol_type, start_line, end_line, changes}]}], truncated, omitted_files, skipped_files, stats}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| max_chars | No | ||
| skip_noise | No | ||
| files_filter | No | ||
| include_context_lines | No |