Get shorter answers
Most questions need only part of an answer. An agent often wants to know whether something exists, how many there are, or where they are. The full answer also carries signatures, notes and sometimes code. The answer input asks a tool for a short form of the same list.
An everyday comparison: asking a librarian "how many books do you have on this?" instead of "bring me every book on this".
Which tools take it
code_grep, get_call_chain, get_reverse_call_chain, get_blast_radius, get_impact_analysis and get_class_structure.
| Value | What comes back | Use it when |
|---|---|---|
exists |
yes or no, with the total | you only need to know whether there is any |
count |
the numbers only | you need "how many" (callers, affected methods, matches, members) |
locations |
one line per entry: file:line and the exact id to pass to the next call |
you will open a few of them, or ask about one next |
names |
one name per line | you need a list to read, not places |
match (only code_grep) |
only the text the pattern matched, at its place | you want the value, not the whole line |
What stays true in a short answer
- The numbers are the full answer's numbers. They come from the same code. For
code_grep, the count covers every file searched, not only the page shown. - Notes that change what the numbers mean are kept: "confidence: partial", the "Not listed" note about calls Niro could not place, and
code_grep's PARTIAL and SKIPPED lines. - Every short answer ends with one line in square brackets saying what was left out and how to get it. For example:
[shown 39 of 100 callers; offset=39 shows the next callers]. - A short answer never carries code. If you also ask for source (
include_source_code, orpurpose=DEBUG), the footer says the code was left out. - A short name that matches several methods is answered once per match, up to 5. For example,
ErrorResponse.errorin Keycloak has two overloads (methods with the same name and different parameters), andanswer=countgives a count for each: 100 callers and 3 callers. - Without
answer, every answer is exactly what it was before.
purpose and answer together
purpose chooses which list you get, and answer shortens that list. So answer=count with purpose=ASSESS_RISK gives the same number as the ASSESS_RISK answer would.
A real example
A search of the Keycloak source (a public Java project) for an error message, asking only how many places hold it:
niro ask code_grep pattern="User exists with same" answer=count
10 matching lines in 4 files in the files searched so far
PARTIAL: the search stopped at its 1.5 s limit after 9793 of 11045 file(s) ...
[counts only; ask without answer= for the list]
The PARTIAL line is kept, because it changes what "10" means: it is a floor. code_grep stops after a time limit (1.5 seconds a call), so on a busy machine the same search can count fewer, even "0 matching lines" with PARTIAL. A count with PARTIAL never means "none". Call again with the continue_from it gives, or pass a folder as path_pattern to search less; on a busy machine even one folder can stop early, and the PARTIAL line says so.
The graph tools have no such limit: the same question on the same graph gives the same answer.
How much it saves
It depends on the question and on your code: a count is a line or two, while a full list names every entry. The shapes were chosen by reading recorded calls from real sessions with what the agent did next, and checking which short form still held what the agent then used. How that was measured is in Tokens, speed and accuracy.
Not in this release
Line filters (keep only lines matching a pattern, or the first N lines) were planned and not built.