| name | functions |
| description | Reference ghidrasql SQL functions and choose the right helper for a task. |
| allowed-tools | ["Bash","Read","Glob","Grep"] |
Functions
Trigger Intents
Use this skill when the user asks:
- what SQL function exists for a task
- whether a helper function is better than a table write
- how to save, parse declarations, edit decompiler locals, or manage source lifecycle
Route to:
decompiler for pseudocode and decompiler-table workflows
types for parse_decls() and signature-related work
annotations for full mutation loops
grep for full-text search functions (search_*)
Catalog (21 functions)
ghidrasql registers 21 distinct names, 22 entries (search_snippet registers at arity 2 and 3). 18 are general-purpose helpers; 3 are cache-control helpers.
There is no shutdown(...) function — set the exit policy at launch via --shutdown and trigger the stop with POST /shutdown. There is no decompile SQL helper; use SELECT text FROM pseudocode WHERE func_addr = ... and cache_invalidate('pseudocode') or refresh_database() to drop stale state.
Decompiler
SELECT text FROM pseudocode WHERE func_addr = 0x401000;
SELECT rename_local(0x401000, '<local_id>', 'buffer');
SELECT set_local_type(0x401000, '<local_id>', 'char *');
Type import
SELECT parse_decls('typedef struct { int x; int y; } Point;');
Search (full-text on tokens / strings / metadata)
SELECT normalize_text('SomeMixed_Case');
SELECT search_match('the quick brown fox', 'quick fox');
SELECT search_score('the quick brown fox', 'quick fox');
SELECT search_snippet('the quick brown fox', 'fox');
SELECT search_snippet('the quick brown fox', 'fox', 10);
SELECT search_rank('strings', 'the quick brown fox', 'fox');
Type analysis (declaration introspection)
SELECT type_family('struct foo { int x; }');
SELECT type_is_pointer('char *');
SELECT type_strip_cv('const volatile int *');
Formatting / housekeeping
SELECT hex(0x401000);
SELECT program_revision();
SELECT string_count();
SELECT rebuild_strings();
Persistence and lifecycle
SELECT save_database();
SELECT discard_changes();
SELECT refresh_database();
Cache helpers
Materialisation is freshness-token scoped for libghidra live sources: repeated /query calls can reuse table rows while program_id, Ghidra's modification number, program path, and available file metadata are unchanged. External Ghidra UI/API edits or active-program switches refresh on the next query. Cache helpers matter mainly inside a batched script (-f, multi-statement REPL input) or when forcing a surface to rebuild:
SELECT cache_stats();
SELECT cache_invalidate('pseudocode');
SELECT cache_invalidate_all();
When to Prefer Functions Over Direct Table Writes
- Use
rename_local() / set_local_type() when a function-shaped
call is clearer than UPDATE decomp_lvars.
- Use
parse_decls() for any C declaration import — it goes through
Ghidra's CParser and avoids per-row INSERTs.
- Use
save_database() explicitly after a mutation batch.
Critical Rules
- Function helpers do not replace the need to verify affected rows or
pseudocode after mutation.
- Saving is explicit. Nothing auto-commits.
- Function-scope discipline still applies to decompiler-backed tables
(
pseudocode, decomp_lvars, decomp_tokens) even when you went
through a helper function. Use func_addr; exact func_name is also
pushed down for pseudocode and decomp_lvars reads.
Additional Resources