DPT is the "Swiss Army Knife" for Delphi development, created for automated Delphi configuration, CI/CD pipelines, and AI-assisted workflows from batch scripts.
Currently, it supports selected Delphi versions (automatically prioritizing the LATEST installed version) and gets expanded on demand.
Run DPT.exe Help <Action> for detailed information on any specific command. Below is an overview of the core capabilities grouped by use cases.
DPT provides special support for AI agents through rule-based workflows and the Model Context Protocol (MCP).
McpDebugger: Starts a standalone MCP server for debugging Delphi applications. It runs continuously in the background and provides tools for AI agents (like Gemini, Claude) to:- Manage debug sessions (
start_debug_session,stop_debug_session,terminate_debug_session).start_debug_sessiontakes the project's.dproj(plus optionalplatform,configandarguments), builds it in the background with forced debug switches (.mapfor source-level breakpoints,.rsmforget_locals/evaluate,.tdsTD32 info for cross-unit member types) and launches the output executable paused at the entry point. The build is incremental, but forces a full rebuild when the sidecars are missing or out of sync. The call returns immediately in statebuilding;wait_until_pauseddrives the transition topausedorbuild_failed(with the compiler log). The.rsmsidecar is parsed in a background task, so even ~1 GB sidecars do not block the session start. - Set/remove hardware breakpoints (
set_breakpoint,remove_breakpoint,list_breakpoints). - Filter exceptions per class (
ignore_exception,unignore_exception,list_ignored_exceptions). - List and switch threads (
list_threads,switch_thread). - Control asynchronous execution (
continue,step_into,step_over,wait_until_paused). - Inspect program state (
get_state,get_stack_trace,get_registers,get_stack_slots,get_stack_memory,get_locals,get_proc_asm,read_memory). - Read captured target I/O (
get_output) — every line the target writes tostdout,stderr, orOutputDebugStringis tagged with its source and the corresponding session cursor, so the agent gets a clean delta since the lastcontinue/step. - Evaluate named variables and fields with
evaluate. Supports typed reads forint,int64,string,ansistring,widestring,shortstring,single,double,extended,guid, andobject(returnsClassName @ HexAddrvia the VMT), plus dotted field navigation for both class chains (AOwner.FInner.FNested) and record chains (MyObj.FRec.FX) with automatic transition between deref and inline hops. Member types are resolved from the TD32.tdssidecar when present (convention-free, also across units) and fall back to the.rsmsymbol reader otherwise. Properties are resolved through their real backing (field, getter via call injection, or live RTTI).
- Manage debug sessions (
AiSession: Manages an AI session for the current process hierarchy (Gemini CLI, Claude Code and Cursor are detected via the host process or environment). Uses an internal workflow engine to provide instructions and track state (e.g., Lint results). See AiWorkflow.md for details.
Commands to automate compilation and manage portable build environments.
Build: Builds a project using MSBuild. Automatically sets uprsvars.batenvironments. Supports embedded configs and instructions via the internalTmplCodeGenpreprocessor.DPT.exe LATEST Build TmplCodeGen.dproj Win32 Debug
BuildAndRun: Builds and subsequently executes a project, skipping build if executable is up-to-date (--OnlyIfChanged).DPT.exe LATEST BuildAndRun MyProject.dproj Win64 Release --OnlyIfChanged -- -run -debug
ExportBuildEnvironment/ImportBuildEnvironment: Exports a minimal Delphi build environment (binaries, registry settings, init scripts) for CI/CD pipelines on clean Windows machines (valid license still required).DPT.exe D12 ExportBuildEnvironment C:\VM-Share\Delphi12BuildEnvironment\
Automate .dproj extraction and enforce code style rules.
-
.dprojAnalysis: Read active configurations, output paths, and search paths.DPT.exe D12 DProjPrintConfigs MyProject.dprojDPT.exe D12 DProjPrintCurConfig MyProject.dprojDPT.exe D12 DProjPrintOutputFile MyProject.dproj Win64 ReleaseDPT.exe D12 DProjPrintSearchPaths MyProject.dproj Win64 Release
Platform and configuration are recognised by content and may be given in any order. Any configuration defined in the
.dprojis accepted (not justDebug/Release), and the effective search path is assembled from the IDE'sEnvOptions.projexactly as MSBuild does. -
Lint: Analyzes Delphi units for style violations using an internal Slim/FitNesse engine.DPT.exe LATEST Lint --verbose Lint\TaifunUnitStyle.pas Unit1.pas Unit2.pas
-
LintSetup: Split or join style files into templates and descriptions for easier editing.
Control the Delphi IDE, register packages natively from the command line, and open files via custom protocols.
OpenUnit: Opens a Delphi source file in the IDE at a specific line or member implementation. Starts the IDE if necessary.DPT.exe LATEST OpenUnit "C:\Projects\MyUnit.pas" GoToLine 42 DPT.exe LATEST OpenUnit "C:\Projects\MyUnit.pas" GoToMemberImplementation TMyClass.Execute
RegisterPackage/RemovePackage: Manage design-time packages (.bpl).DPT.exe D12 RegisterPackage "C:\Dev\Bpl\JclBaseExpert240.bpl" DPT.exe D12 RemovePackage JclBaseExpert240 DPT.exe D12 RemovePackagesBySourceDir "C:\Dev\Bpl"
PrintPath/Start/Stop: Output IDE internal paths (BDSBinPath), manually start or violently terminate the IDE process.
To use the dpt:// URL protocol (e.g., to open units directly from a browser or log viewers), you need to register it in Windows.
- Run
_GenerateRegisterDptProtocol.bat. - Execute the generated
RegisterDptProtocol.regfile to update your registry.
Once registered, you can use links like:
dpt://openunit/?file=C:\MyUnit.pas&line=42