gograph_sql
Audit PostgreSQL query literals in Go code: filter static SQL by operation, read/write/DDL access, table, function, or module; returns paginated evidence with source locations.
Instructions
Return one bounded gograph.sql.v1 page of static PostgreSQL query literals with operation, read/write/DDL access, referenced tables, enclosing function, module ownership, and source location. Extraction covers direct literals plus statically resolvable local or same-file package const/var declarations, straight-line assignments, and bounded string concatenations. The MCP server checks freshness before this call and refreshes in the current requested analysis mode. Read-only; no side effects. Filters in different categories AND-compose; repeated values within tables, verbs, and accesses OR-compose. Tests remain included by default for backward compatibility; set no_tests=true for production-only results. CTEs resolve to their actual operation, data-modifying CTEs retain write access/table evidence, PostgreSQL UPSERT remains INSERT, and unsupported classification is explicit rather than guessed. WHEN TO USE: Audit database interactions, write paths, or queries touching a table. NOT TO USE: For ORM struct mappings (use gograph_schema) or runtime-generated SQL that is not a static literal. RETURNS: A deterministic page with total/returned/truncated/next_cursor and queries[].
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| term | No | Optional case-insensitive raw SQL substring filter | |
| limit | No | Page size from 1 to 200; defaults to 100 | |
| verbs | No | Optional PostgreSQL operation filters; values OR-compose | |
| cursor | No | Opaque next_cursor from the previous gograph_sql page; reuse the same filters | |
| module | No | Optional exact module path/directory, unique nested basename, or repository basename for a root module | |
| tables | No | Optional PostgreSQL table selectors; values OR-compose and may be table or schema.table | |
| accesses | No | Optional statement access classes; values OR-compose | |
| function | No | Optional case-insensitive enclosing-function substring | |
| no_tests | No | Exclude SQL facts from *_test.go files; tests are included by default |