Scheme — 18 Operations for AI Agents
Scheme is the minimalist Lisp behind Guix configurations, editor extensions, and language research. act101 navigates definitions structurally — fitting, for the language whose parentheses *are* its structure.
This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Scheme 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.
Worked Scheme examples
act101 reads a Scheme file's (define ...) forms — both (define name expr) value bindings and (define (name args) body) procedure definitions — as declarations: the skeleton tags every one of them function, whether the bound value is a procedure or a plain expression like 0. symbols covers the identical set of define forms but tags every one variable instead, the opposite kind, so neither query distinguishes a value binding from a procedure definition. The skeleton also descends into a function's own body and reports two of the grammar's control-flow forms, cond and if, as block declarations named for their own head keyword, since neither special form carries an identifier of its own; symbols has no rule for either and omits them. The unit of structure in this grammar is the list form: skeleton and symbols alike read a define, cond, or if as one specific list node, named for either its own bound identifier or its own head symbol. 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 the shipping-rate calculator's definitions and branch forms as a skeleton
shipping-rate.scm implements a weight-based shipping cost calculator: predicate helpers (light-package?, oversized-package?), a surcharge counter (surcharge-count) incremented by set! inside apply-surcharge!, the shipping-rate procedure itself, which dispatches on package weight and length with a cond, and a recursive total-weight procedure that sums a list of package weights with an if.
$ act query skeleton shipping-rate.scm
Before
(define (light-package? weight) (< weight 1))
(define (oversized-package? weight length)
(and (> weight 20) (> length 48)))
(define surcharge-count 0)
(define (apply-surcharge! amount)
(set! surcharge-count (+ surcharge-count 1))
amount)
(define (shipping-rate weight length)
(cond ((light-package? weight) 4.99)
((oversized-package? weight length) (apply-surcharge! 34.99))
((> weight 20) 24.99)
(else 12.99)))
(define (total-weight packages)
(if (null? packages)
0
(+ (car packages) (total-weight (cdr packages)))))
Output
{
"type": "Skeleton",
"declarations": [
{
"kind": "function",
"name": "light-package?",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 1,
"column": 1,
"byte_offset": 0
},
"end": {
"file": "shipping-rate.scm",
"line": 1,
"column": 46,
"byte_offset": 45
}
},
"name_range": {
"start": {
"file": "shipping-rate.scm",
"line": 1,
"column": 10,
"byte_offset": 9
},
"end": {
"file": "shipping-rate.scm",
"line": 1,
"column": 24,
"byte_offset": 23
}
}
},
{
"kind": "function",
"name": "oversized-package?",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 3,
"column": 1,
"byte_offset": 47
},
"end": {
"file": "shipping-rate.scm",
"line": 4,
"column": 37,
"byte_offset": 126
}
},
"name_range": {
"start": {
"file": "shipping-rate.scm",
"line": 3,
"column": 10,
"byte_offset": 56
},
"end": {
"file": "shipping-rate.scm",
"line": 3,
"column": 28,
"byte_offset": 74
}
}
},
{
"kind": "function",
"name": "surcharge-count",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 6,
"column": 1,
"byte_offset": 128
},
"end": {
"file": "shipping-rate.scm",
"line": 6,
"column": 27,
"byte_offset": 154
}
},
"name_range": {
"start": {
"file": "shipping-rate.scm",
"line": 6,
"column": 9,
"byte_offset": 136
},
"end": {
"file": "shipping-rate.scm",
"line": 6,
"column": 24,
"byte_offset": 151
}
}
},
{
"kind": "function",
"name": "apply-surcharge!",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 8,
"column": 1,
"byte_offset": 156
},
"end": {
"file": "shipping-rate.scm",
"line": 10,
"column": 10,
"byte_offset": 246
}
},
"name_range": {
"start": {
"file": "shipping-rate.scm",
"line": 8,
"column": 10,
"byte_offset": 165
},
"end": {
"file": "shipping-rate.scm",
"line": 8,
"column": 26,
"byte_offset": 181
}
}
},
{
"kind": "function",
"name": "shipping-rate",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 12,
"column": 1,
"byte_offset": 248
},
"end": {
"file": "shipping-rate.scm",
"line": 16,
"column": 23,
"byte_offset": 447
}
},
"name_range": {
"start": {
"file": "shipping-rate.scm",
"line": 12,
"column": 10,
"byte_offset": 257
},
"end": {
"file": "shipping-rate.scm",
"line": 12,
"column": 23,
"byte_offset": 270
}
}
},
{
"kind": "block",
"name": "cond",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 13,
"column": 3,
"byte_offset": 288
},
"end": {
"file": "shipping-rate.scm",
"line": 16,
"column": 22,
"byte_offset": 446
}
},
"name_range": {
"start": {
"file": "shipping-rate.scm",
"line": 13,
"column": 4,
"byte_offset": 289
},
"end": {
"file": "shipping-rate.scm",
"line": 13,
"column": 8,
"byte_offset": 293
}
}
},
{
"kind": "function",
"name": "total-weight",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 18,
"column": 1,
"byte_offset": 449
},
"end": {
"file": "shipping-rate.scm",
"line": 21,
"column": 57,
"byte_offset": 568
}
},
"name_range": {
"start": {
"file": "shipping-rate.scm",
"line": 18,
"column": 10,
"byte_offset": 458
},
"end": {
"file": "shipping-rate.scm",
"line": 18,
"column": 22,
"byte_offset": 470
}
}
},
{
"kind": "block",
"name": "if",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 19,
"column": 3,
"byte_offset": 483
},
"end": {
"file": "shipping-rate.scm",
"line": 21,
"column": 56,
"byte_offset": 567
}
},
"name_range": {
"start": {
"file": "shipping-rate.scm",
"line": 19,
"column": 4,
"byte_offset": 484
},
"end": {
"file": "shipping-rate.scm",
"line": 19,
"column": 6,
"byte_offset": 486
}
}
}
]
}
The skeleton reports eight declarations: the six top-level defined names — light-package?, oversized-package?, surcharge-count, apply-surcharge!, shipping-rate, and total-weight — all tagged function regardless of whether the binding holds a procedure or, for surcharge-count, a plain 0; plus one cond form from inside shipping-rate and one if form from inside total-weight, each tagged block and named for its own keyword.
List the same definitions as symbols, without the branch forms
surcharge-count is a plain counter, incremented once each time a package triggers the oversized surcharge, while shipping-rate is the four-clause procedure that actually prices a package and total-weight recurses over a list to total it.
$ act query symbols shipping-rate.scm
Before
(define (light-package? weight) (< weight 1))
(define (oversized-package? weight length)
(and (> weight 20) (> length 48)))
(define surcharge-count 0)
(define (apply-surcharge! amount)
(set! surcharge-count (+ surcharge-count 1))
amount)
(define (shipping-rate weight length)
(cond ((light-package? weight) 4.99)
((oversized-package? weight length) (apply-surcharge! 34.99))
((> weight 20) 24.99)
(else 12.99)))
(define (total-weight packages)
(if (null? packages)
0
(+ (car packages) (total-weight (cdr packages)))))
Output
{
"type": "Symbols",
"symbols": [
{
"name": "light-package?",
"kind": "variable",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 1,
"column": 10,
"byte_offset": 9
},
"end": {
"file": "shipping-rate.scm",
"line": 1,
"column": 24,
"byte_offset": 23
}
},
"visibility": "unknown"
},
{
"name": "oversized-package?",
"kind": "variable",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 3,
"column": 10,
"byte_offset": 56
},
"end": {
"file": "shipping-rate.scm",
"line": 3,
"column": 28,
"byte_offset": 74
}
},
"visibility": "unknown"
},
{
"name": "surcharge-count",
"kind": "variable",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 6,
"column": 9,
"byte_offset": 136
},
"end": {
"file": "shipping-rate.scm",
"line": 6,
"column": 24,
"byte_offset": 151
}
},
"visibility": "unknown"
},
{
"name": "apply-surcharge!",
"kind": "variable",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 8,
"column": 10,
"byte_offset": 165
},
"end": {
"file": "shipping-rate.scm",
"line": 8,
"column": 26,
"byte_offset": 181
}
},
"visibility": "unknown"
},
{
"name": "shipping-rate",
"kind": "variable",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 12,
"column": 10,
"byte_offset": 257
},
"end": {
"file": "shipping-rate.scm",
"line": 12,
"column": 23,
"byte_offset": 270
}
},
"visibility": "unknown"
},
{
"name": "total-weight",
"kind": "variable",
"range": {
"start": {
"file": "shipping-rate.scm",
"line": 18,
"column": 10,
"byte_offset": 458
},
"end": {
"file": "shipping-rate.scm",
"line": 18,
"column": 22,
"byte_offset": 470
}
},
"visibility": "unknown"
}
]
}
symbols reports the same six defined names — light-package? through total-weight — but tags every one variable instead of function, the opposite kind skeleton gave them; the cond and if forms that appeared in the skeleton have no rule in symbols.scm and don't appear here.
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