ek9_query_programs
Answers first: status, programCount, programNames - complete for the workspace or the filters given - then programs[] {name, module, file, line, signature, parameters}.
When to use it
'What programs (entry points) does this app expose, with what arguments' is one call with no arguments, or nameFilter / argTypeFilter / moduleFilter to narrow.
When not to use it
- running a program you already know the name of (use
ek9_run_program; this tool only DISCOVERS - query first, then run the chosen one) - callable functions rather than executable entry points (use
ek9_query_functions) - the full source of a program you already know the name of (use
ek9_read_construct)
Details
status is ok (>=1 program) / empty (filtered set empty — NOT an error; carries meta.unmatchedFilters[] when a moduleFilter names no module) / not-compiled (nothing compiled yet — compile first). Each program projects name, module, file, line, a ready-to-read signature string, and parameters[] as {name,type} pairs read off the program's single entry method. argTypeFilter is a leading-prefix, in-order, case-insensitive exact-type match; unresolved arg types render as <unresolved> without degrading status.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
argTypeFilter | array of string | Filter to programs whose argument list STARTS WITH these types, in order (case-insensitive, exact type-name match). Example: ["Date"] matches programs whose first argument is a Date. | |
moduleFilter | array of string | Restrict to specific modules (exact names). Default: workspace-wide. | |
nameFilter | string | Case-insensitive substring match on program names. |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
List all
Request
{ }
Response
{
"meta" : {
"serverMs" : "<timing>"
},
"programCount" : 2,
"programNames" : [ "Main", "DailyBatch" ],
"programs" : [ {
"file" : "app.ek9",
"line" : 6,
"module" : "com.example.app",
"name" : "Main",
"parameters" : [ ],
"signature" : "Main()"
}, {
"file" : "app.ek9",
"line" : 10,
"module" : "com.example.app",
"name" : "DailyBatch",
"parameters" : [ {
"name" : "runDate",
"type" : "Date"
} ],
"signature" : "DailyBatch()\n -> runDate as Date"
} ],
...
Cut short here: 6 more lines. The whole recorded call.