Structural variants (SVs) are increasingly recognized as key drivers of bacterial evolution, yet their role has remained largely unexplored. This is due to limitations in traditional short-read sequencing and linear reference-based analyses, which can miss complex structural changes1. In this study, we introduce miniwalk, a genotyping tool that goes hand in hand with minigraph2, a pangenome graph-generating tool. Unlike conventional SV callers that rely on a linear reference genome, miniwalk genotypes SVs from mapped assemblies onto a minigraph genome graph. We benchmarked miniwalk’s genotyping ability against a traditional linear reference-based SV caller (Manta3) and found that our tool has higher precision. We then genotyped SVs from 1,137 M.tuberculosis isolates sequenced with Oxford Nanopore or PacBio to reveal the role of SVs in complex, virulence-associated loci, where a large deletion seemed to be under convergent evolution. We also demonstrated miniwalk’s utility by genotyping SVs in 43,137 M.tuberculosis short-read sequence data generated with Illumina. This large-scale analysis revealed the possible role that SVs play in drug resistance across 14 drugs, including first-line treatments like isoniazid, ethambutol, pyrazinamide and rifampicin. By capturing important but routinely dismissed genetic variation, miniwalk provides insights into SV-driven mechanisms that may underpin pathogen adaptation and resistance. As this tool works with minigraph’s output, it has the potential to be applied to other species’ graphs. Our findings illustrate the advantages of adopting pangenome-based approaches for SV detection, highlighting miniwalk as a useful resource in the pangenomics era.