XML — 18 Operations for AI Agents

XML still carries enterprise weight: Maven POMs, Android manifests, SOAP contracts, build configurations. act101 navigates elements and attributes structurally, so agents work inside deeply nested documents without counting closing tags.

This page is the canonical reference an AI coding agent uses to refactor, query, and analyze XML code through the act MCP server. 18 operations available: 0 refactor, 18 query, 0 analysis. Each operation is callable from Claude Code, Cursor, Codex, OpenCode, or any MCP-compatible agent host. Click any operation for a stable anchor link suitable for citation.

18Query

Worked XML examples

act101 reads an XML document's elements as its declarations: every element, at any nesting depth, surfaces in the skeleton as a module named for its tag. symbols reports the identical set of elements, tagged class instead of module; neither query reads attribute values such as lat or lon, only the element names that carry them. The unit of structure in this grammar is the element, so a document built from deeply nested tags, like a GPS track's points nested inside a segment nested inside a track, reports one declaration per tag at every level rather than collapsing the hierarchy. Each example below is the verbatim output of the command shown, run against the file shown. Query outputs are pretty-printed with the timing block omitted.

Read every element in a document, however deeply nested

trail.xml is a GPX hiking-track file: a gpx root holding metadata, one trk with two trkpt points, and a standalone wpt waypoint.

$ act query skeleton trail.xml

Before

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="TrailMapper">
  <metadata>
    <name>Enchantment Lakes Loop</name>
    <time>2026-07-14T06:00:00Z</time>
  </metadata>
  <trk>
    <name>Snow Lakes Approach</name>
    <trkseg>
      <trkpt lat="47.5301" lon="-121.1401">
        <ele>1220</ele>
        <time>2026-07-14T06:05:00Z</time>
      </trkpt>
      <trkpt lat="47.5289" lon="-121.1355">
        <ele>1340</ele>
        <time>2026-07-14T06:22:00Z</time>
      </trkpt>
    </trkseg>
  </trk>
  <wpt lat="47.5412" lon="-121.1120">
    <name>Snow Lake Camp</name>
    <ele>1780</ele>
  </wpt>
</gpx>

Output

{
    "type": "Skeleton",
    "declarations": [
        {
            "kind": "module",
            "name": "gpx",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 2,
                    "column": 1,
                    "byte_offset": 39
                },
                "end": {
                    "file": "trail.xml",
                    "line": 24,
                    "column": 7,
                    "byte_offset": 622
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 2,
                    "column": 2,
                    "byte_offset": 40
                },
                "end": {
                    "file": "trail.xml",
                    "line": 2,
                    "column": 5,
                    "byte_offset": 43
                }
            }
        },
        {
            "kind": "module",
            "name": "metadata",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 3,
                    "column": 3,
                    "byte_offset": 83
                },
                "end": {
                    "file": "trail.xml",
                    "line": 6,
                    "column": 14,
                    "byte_offset": 185
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 3,
                    "column": 4,
                    "byte_offset": 84
                },
                "end": {
                    "file": "trail.xml",
                    "line": 3,
                    "column": 12,
                    "byte_offset": 92
                }
            }
        },
        {
            "kind": "module",
            "name": "name",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 4,
                    "column": 5,
                    "byte_offset": 98
                },
                "end": {
                    "file": "trail.xml",
                    "line": 4,
                    "column": 40,
                    "byte_offset": 133
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 4,
                    "column": 6,
                    "byte_offset": 99
                },
                "end": {
                    "file": "trail.xml",
                    "line": 4,
                    "column": 10,
                    "byte_offset": 103
                }
            }
        },
        {
            "kind": "module",
            "name": "time",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 5,
                    "column": 5,
                    "byte_offset": 138
                },
                "end": {
                    "file": "trail.xml",
                    "line": 5,
                    "column": 38,
                    "byte_offset": 171
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 5,
                    "column": 6,
                    "byte_offset": 139
                },
                "end": {
                    "file": "trail.xml",
                    "line": 5,
                    "column": 10,
                    "byte_offset": 143
                }
            }
        },
        {
            "kind": "module",
            "name": "trk",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 7,
                    "column": 3,
                    "byte_offset": 188
                },
                "end": {
                    "file": "trail.xml",
                    "line": 19,
                    "column": 9,
                    "byte_offset": 516
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 7,
                    "column": 4,
                    "byte_offset": 189
                },
                "end": {
                    "file": "trail.xml",
                    "line": 7,
                    "column": 7,
                    "byte_offset": 192
                }
            }
        },
        {
            "kind": "module",
            "name": "name",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 8,
                    "column": 5,
                    "byte_offset": 198
                },
                "end": {
                    "file": "trail.xml",
                    "line": 8,
                    "column": 37,
                    "byte_offset": 230
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 8,
                    "column": 6,
                    "byte_offset": 199
                },
                "end": {
                    "file": "trail.xml",
                    "line": 8,
                    "column": 10,
                    "byte_offset": 203
                }
            }
        },
        {
            "kind": "module",
            "name": "trkseg",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 9,
                    "column": 5,
                    "byte_offset": 235
                },
                "end": {
                    "file": "trail.xml",
                    "line": 18,
                    "column": 14,
                    "byte_offset": 507
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 9,
                    "column": 6,
                    "byte_offset": 236
                },
                "end": {
                    "file": "trail.xml",
                    "line": 9,
                    "column": 12,
                    "byte_offset": 242
                }
            }
        },
        {
            "kind": "module",
            "name": "trkpt",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 10,
                    "column": 7,
                    "byte_offset": 250
                },
                "end": {
                    "file": "trail.xml",
                    "line": 13,
                    "column": 15,
                    "byte_offset": 368
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 10,
                    "column": 8,
                    "byte_offset": 251
                },
                "end": {
                    "file": "trail.xml",
                    "line": 10,
                    "column": 13,
                    "byte_offset": 256
                }
            }
        },
        {
            "kind": "module",
            "name": "ele",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 11,
                    "column": 9,
                    "byte_offset": 296
                },
                "end": {
                    "file": "trail.xml",
                    "line": 11,
                    "column": 24,
                    "byte_offset": 311
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 11,
                    "column": 10,
                    "byte_offset": 297
                },
                "end": {
                    "file": "trail.xml",
                    "line": 11,
                    "column": 13,
                    "byte_offset": 300
                }
            }
        },
        {
            "kind": "module",
            "name": "time",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 12,
                    "column": 9,
                    "byte_offset": 320
                },
                "end": {
                    "file": "trail.xml",
                    "line": 12,
                    "column": 42,
                    "byte_offset": 353
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 12,
                    "column": 10,
                    "byte_offset": 321
                },
                "end": {
                    "file": "trail.xml",
                    "line": 12,
                    "column": 14,
                    "byte_offset": 325
                }
            }
        },
        {
            "kind": "module",
            "name": "trkpt",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 14,
                    "column": 7,
                    "byte_offset": 375
                },
                "end": {
                    "file": "trail.xml",
                    "line": 17,
                    "column": 15,
                    "byte_offset": 493
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 14,
                    "column": 8,
                    "byte_offset": 376
                },
                "end": {
                    "file": "trail.xml",
                    "line": 14,
                    "column": 13,
                    "byte_offset": 381
                }
            }
        },
        {
            "kind": "module",
            "name": "ele",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 15,
                    "column": 9,
                    "byte_offset": 421
                },
                "end": {
                    "file": "trail.xml",
                    "line": 15,
                    "column": 24,
                    "byte_offset": 436
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 15,
                    "column": 10,
                    "byte_offset": 422
                },
                "end": {
                    "file": "trail.xml",
                    "line": 15,
                    "column": 13,
                    "byte_offset": 425
                }
            }
        },
        {
            "kind": "module",
            "name": "time",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 16,
                    "column": 9,
                    "byte_offset": 445
                },
                "end": {
                    "file": "trail.xml",
                    "line": 16,
                    "column": 42,
                    "byte_offset": 478
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 16,
                    "column": 10,
                    "byte_offset": 446
                },
                "end": {
                    "file": "trail.xml",
                    "line": 16,
                    "column": 14,
                    "byte_offset": 450
                }
            }
        },
        {
            "kind": "module",
            "name": "wpt",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 20,
                    "column": 3,
                    "byte_offset": 519
                },
                "end": {
                    "file": "trail.xml",
                    "line": 23,
                    "column": 9,
                    "byte_offset": 615
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 20,
                    "column": 4,
                    "byte_offset": 520
                },
                "end": {
                    "file": "trail.xml",
                    "line": 20,
                    "column": 7,
                    "byte_offset": 523
                }
            }
        },
        {
            "kind": "module",
            "name": "name",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 21,
                    "column": 5,
                    "byte_offset": 559
                },
                "end": {
                    "file": "trail.xml",
                    "line": 21,
                    "column": 32,
                    "byte_offset": 586
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 21,
                    "column": 6,
                    "byte_offset": 560
                },
                "end": {
                    "file": "trail.xml",
                    "line": 21,
                    "column": 10,
                    "byte_offset": 564
                }
            }
        },
        {
            "kind": "module",
            "name": "ele",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 22,
                    "column": 5,
                    "byte_offset": 591
                },
                "end": {
                    "file": "trail.xml",
                    "line": 22,
                    "column": 20,
                    "byte_offset": 606
                }
            },
            "name_range": {
                "start": {
                    "file": "trail.xml",
                    "line": 22,
                    "column": 6,
                    "byte_offset": 592
                },
                "end": {
                    "file": "trail.xml",
                    "line": 22,
                    "column": 9,
                    "byte_offset": 595
                }
            }
        }
    ]
}

The skeleton reports all sixteen elements as module declarations, from the root gpx down through both trkpt points to the ele and time children inside each one; the lat/lon attribute values on trkpt and wpt don't appear.

List the same elements as symbols instead of a tree

The two trkpt points and the wpt waypoint each carry their own name, ele, or time child elements, repeating those tag names across the file.

$ act query symbols trail.xml

Before

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="TrailMapper">
  <metadata>
    <name>Enchantment Lakes Loop</name>
    <time>2026-07-14T06:00:00Z</time>
  </metadata>
  <trk>
    <name>Snow Lakes Approach</name>
    <trkseg>
      <trkpt lat="47.5301" lon="-121.1401">
        <ele>1220</ele>
        <time>2026-07-14T06:05:00Z</time>
      </trkpt>
      <trkpt lat="47.5289" lon="-121.1355">
        <ele>1340</ele>
        <time>2026-07-14T06:22:00Z</time>
      </trkpt>
    </trkseg>
  </trk>
  <wpt lat="47.5412" lon="-121.1120">
    <name>Snow Lake Camp</name>
    <ele>1780</ele>
  </wpt>
</gpx>

Output

{
    "type": "Symbols",
    "symbols": [
        {
            "name": "gpx",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 2,
                    "column": 2,
                    "byte_offset": 40
                },
                "end": {
                    "file": "trail.xml",
                    "line": 2,
                    "column": 5,
                    "byte_offset": 43
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "metadata",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 3,
                    "column": 4,
                    "byte_offset": 84
                },
                "end": {
                    "file": "trail.xml",
                    "line": 3,
                    "column": 12,
                    "byte_offset": 92
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "name",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 4,
                    "column": 6,
                    "byte_offset": 99
                },
                "end": {
                    "file": "trail.xml",
                    "line": 4,
                    "column": 10,
                    "byte_offset": 103
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "time",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 5,
                    "column": 6,
                    "byte_offset": 139
                },
                "end": {
                    "file": "trail.xml",
                    "line": 5,
                    "column": 10,
                    "byte_offset": 143
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "trk",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 7,
                    "column": 4,
                    "byte_offset": 189
                },
                "end": {
                    "file": "trail.xml",
                    "line": 7,
                    "column": 7,
                    "byte_offset": 192
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "name",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 8,
                    "column": 6,
                    "byte_offset": 199
                },
                "end": {
                    "file": "trail.xml",
                    "line": 8,
                    "column": 10,
                    "byte_offset": 203
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "trkseg",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 9,
                    "column": 6,
                    "byte_offset": 236
                },
                "end": {
                    "file": "trail.xml",
                    "line": 9,
                    "column": 12,
                    "byte_offset": 242
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "trkpt",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 10,
                    "column": 8,
                    "byte_offset": 251
                },
                "end": {
                    "file": "trail.xml",
                    "line": 10,
                    "column": 13,
                    "byte_offset": 256
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "ele",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 11,
                    "column": 10,
                    "byte_offset": 297
                },
                "end": {
                    "file": "trail.xml",
                    "line": 11,
                    "column": 13,
                    "byte_offset": 300
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "time",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 12,
                    "column": 10,
                    "byte_offset": 321
                },
                "end": {
                    "file": "trail.xml",
                    "line": 12,
                    "column": 14,
                    "byte_offset": 325
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "trkpt",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 14,
                    "column": 8,
                    "byte_offset": 376
                },
                "end": {
                    "file": "trail.xml",
                    "line": 14,
                    "column": 13,
                    "byte_offset": 381
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "ele",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 15,
                    "column": 10,
                    "byte_offset": 422
                },
                "end": {
                    "file": "trail.xml",
                    "line": 15,
                    "column": 13,
                    "byte_offset": 425
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "time",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 16,
                    "column": 10,
                    "byte_offset": 446
                },
                "end": {
                    "file": "trail.xml",
                    "line": 16,
                    "column": 14,
                    "byte_offset": 450
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "wpt",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 20,
                    "column": 4,
                    "byte_offset": 520
                },
                "end": {
                    "file": "trail.xml",
                    "line": 20,
                    "column": 7,
                    "byte_offset": 523
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "name",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 21,
                    "column": 6,
                    "byte_offset": 560
                },
                "end": {
                    "file": "trail.xml",
                    "line": 21,
                    "column": 10,
                    "byte_offset": 564
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "ele",
            "kind": "class",
            "range": {
                "start": {
                    "file": "trail.xml",
                    "line": 22,
                    "column": 6,
                    "byte_offset": 592
                },
                "end": {
                    "file": "trail.xml",
                    "line": 22,
                    "column": 9,
                    "byte_offset": 595
                }
            },
            "visibility": "unknown"
        }
    ]
}

symbols reports the same sixteen elements as class declarations in document order, including the repeated name, ele, and time tags from each trkpt and the wpt waypoint.

Query

18 query tools, the same on every supported language. Descriptions live in the shared reference: /docs/query-tools.

callers control_flow data_flow definition diagnostics effect_closure effect_summary fix_auto get_type graph import_organize interface mutations references repo_outline skeleton symbols symbols_batch

← WITYAML →