@mwillbanks/ast-mcp 0.6.6 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CONTRIBUTING.md +6 -0
  2. package/dist/ast-mcp.js +358 -337
  3. package/dist/ast-mcp.js.map +45 -32
  4. package/dist/workers/sql-postgres-worker.js +5 -0
  5. package/dist/workers/sql-postgres-worker.js.map +10 -0
  6. package/package.json +3 -2
  7. package/src/cli/doctor.ts +103 -0
  8. package/src/cli/index.ts +9 -1
  9. package/src/config/index.ts +61 -6
  10. package/src/config/registry.ts +209 -67
  11. package/src/config/v2-schema.ts +2 -0
  12. package/src/helpers/installer.ts +10 -1
  13. package/src/http/index.ts +12 -5
  14. package/src/installer/codex.ts +237 -0
  15. package/src/installer/diagnostics.ts +387 -0
  16. package/src/installer/directory-ancestry.ts +55 -0
  17. package/src/installer/index.ts +386 -119
  18. package/src/installer/ownership.ts +165 -0
  19. package/src/installer/service-state.ts +151 -0
  20. package/src/installer/service.ts +131 -7
  21. package/src/installer/transaction.ts +342 -0
  22. package/src/installer/transport.ts +22 -31
  23. package/src/intelligence/mutation/locks.ts +4 -1
  24. package/src/patch/engine.ts +157 -11
  25. package/src/runtime/approval.ts +427 -66
  26. package/src/runtime/config-write.ts +27 -1
  27. package/src/runtime/diagnostics.ts +115 -0
  28. package/src/runtime/file-capabilities.ts +2 -0
  29. package/src/runtime/hosts/codex.ts +16 -0
  30. package/src/runtime/path-policy.ts +2 -0
  31. package/src/runtime/release.ts +220 -0
  32. package/src/runtime/sql-assistance.ts +439 -0
  33. package/src/runtime/sql-options-schema.ts +31 -0
  34. package/src/runtime/sql-postgres-worker.ts +72 -0
  35. package/src/runtime/sql-postgres.ts +245 -0
  36. package/src/server/index.ts +35 -5
  37. package/src/server/lifecycle.ts +1 -1
  38. package/src/tools/configuration.ts +2 -0
  39. package/src/tools/diagnostics.ts +85 -0
  40. package/src/tools/files.ts +2 -0
  41. package/src/tools/index.ts +9 -0
  42. package/templates/skills/ast-mcp/SKILL.md +20 -1
  43. package/templates/skills/ast-mcp/evals/evals.json +274 -0
  44. package/templates/skills/ast-mcp/evals/semantic.ts +2 -0
  45. package/templates/skills/ast-mcp/evals/trigger-queries.json +4 -1
  46. package/templates/skills/ast-mcp/references/cli.md +97 -0
  47. package/templates/skills/ast-mcp/references/configuration.md +11 -3
  48. package/templates/skills/ast-mcp/references/diagnostics.md +106 -0
  49. package/templates/skills/ast-mcp/references/host-context.md +85 -0
  50. package/templates/skills/ast-mcp/references/installation.md +37 -0
  51. package/templates/skills/ast-mcp/references/issue-reporting.md +80 -0
  52. package/templates/skills/ast-mcp/references/patch-state-machine.md +10 -0
  53. package/templates/skills/ast-mcp/references/tool-catalog.md +120 -50
  54. package/templates/skills/ast-mcp/scripts/check-install.ts +223 -24
  55. package/templates/skills/ast-mcp/scripts/release.ts +220 -0
@@ -23,6 +23,13 @@ A failed response does not prove that no file changed.
23
23
 
24
24
  ## Diagnose the host
25
25
 
26
+ Start with [diagnostics.md](diagnostics.md).
27
+ Call MCP `diagnostics` for the connected server, or run `ast-mcp doctor --output json` when MCP is unavailable.
28
+ Both attempt a fresh latest stable version check.
29
+ Record unavailable registry checks explicitly and continue local diagnosis.
30
+ Distinguish the running server from project and global installations before recommending an upgrade.
31
+ For reproducible unexpected behavior, follow [issue-reporting.md](issue-reporting.md) and search existing issues first.
32
+
26
33
  When this skill exists on disk and Bun is available, run its read-only checker from the active skill directory:
27
34
 
28
35
  `bun run scripts/check-install.ts --scope local --target codex`
@@ -34,6 +41,12 @@ For HTTP, pass `--transport http --host <address> --port <port>`.
34
41
  Add `--service` only for a managed HTTP service.
35
42
 
36
43
  The checker inspects managed guidance, host definitions, hooks, services, startup, and selected intelligence tools.
44
+ It launches the configured MCP server and calls `diagnostics` when the server advertises that tool.
45
+ Otherwise, it attempts a standalone fresh release check using a valid server version from initialization when available.
46
+ It labels the connected server version unknown when neither response supplies a valid version.
47
+ It reports unavailable diagnostics explicitly.
48
+ A bounded optional timeout or tool-level error does not invalidate successful required protocol checks.
49
+ Malformed transport, premature EOF, and natural process failures still fail the smoke check.
37
50
  It reports repair commands and stale executable paths.
38
51
  It does not prove complete tool coverage or MCP skill activation.
39
52
  Verify those separately.
@@ -84,20 +97,44 @@ For global managed configuration:
84
97
  `ast-mcp update --scope global --target codex`
85
98
 
86
99
  Targets are `codex`, `claude`, `copilot`, and `all`.
100
+ These targets select managed host configuration, not a restriction on standard MCP clients.
101
+ Claude Desktop, Grok, and other clients use their host's normal MCP connection settings.
87
102
  The default transport is stdio.
88
103
  Use `--transport http --host <address> --port <port>` for HTTP.
89
104
  Use `--service` to manage a supported macOS or Linux user service.
90
105
 
106
+ Managed service operations read the service manager state before changing service files or runtime state.
107
+ Linux supports known missing units and loaded units with enabled or disabled, active or inactive states.
108
+ macOS supports unloaded jobs and loaded running jobs while retaining existing disabled overrides.
109
+ Unknown manager output, unavailable managers, transitional states, and unsupported states stop the operation before service changes.
110
+ Unsupported states include masked or static Linux units and loaded stopped macOS jobs.
111
+ Inspect the manager state and resolve it through a separately authorized host operation before retrying.
112
+ Failed installer operations restore known prior enablement and runtime state after verifying restored service files.
113
+ Unrelated file conflicts do not suppress independent service cleanup.
114
+ Service-file conflicts prevent unsafe recovery commands and report incomplete rollback.
115
+
91
116
  `update` refreshes managed host entries, hooks, and guidance blocks.
92
117
  It preserves surrounding user guidance.
93
118
  It does not upgrade the package or refresh manual skills.
94
119
  Uninstall also preserves manual skill directories.
120
+ Host refresh preserves environment values, timeouts, tool settings, and unrelated configuration.
121
+ Launch ownership receipts let uninstall restore imported launch settings without overwriting later user edits.
122
+ Codex stores receipts in managed comments; JSON hosts use a sibling `<configuration-file>.ast-mcp.json` receipt.
123
+ Keep these receipts through installation and update; do not edit them to force removal.
124
+ Unrecognized or malformed JSON receipts stop refresh before host configuration changes.
125
+ Uninstall preserves unrecognized receipts and their server entries for inspection.
126
+ Historical or customized entries without sufficient ownership evidence remain complete, so retained entries still satisfy host configuration requirements.
127
+ Legacy hook scripts and registrations remain when their ownership cannot be established.
128
+ Inspect retained entries before any separately authorized manual removal.
95
129
  For malformed runtime configuration, explicit output permits removal without loading output defaults:
96
130
 
97
131
  `ast-mcp uninstall --scope global --target codex --output json`
98
132
 
99
133
  Use the local CLI and local scope for local removal.
100
134
  Do not uninstall merely to refresh instructions.
135
+ For Codex, honor `CODEX_HOME`, project overrides, and the selected disk profile.
136
+ A generated configuration does not prove that an active Desktop profile or CLI session loaded it.
137
+ Load [diagnostics.md](diagnostics.md) for effective-session approval conflicts.
101
138
 
102
139
  ## Migrate runtime configuration
103
140
 
@@ -0,0 +1,80 @@
1
+ # Report unexpected behavior
2
+
3
+ Use this workflow for reproducible ast-mcp failures.
4
+ The upstream repository is `mwillbanks/ast-mcp`.
5
+ Diagnosis does not authorize a GitHub issue or comment.
6
+
7
+ ## Check versions first
8
+
9
+ Run MCP `diagnostics` for the connected server before investigating a report.
10
+ Use `ast-mcp doctor --output json` when MCP is unavailable.
11
+ Always attempt a fresh latest stable version check.
12
+ Record registry failures explicitly; never describe an unavailable check as current.
13
+
14
+ Compare the actual failing server version, not only the package installed on disk.
15
+ Check project and global executable differences when relevant.
16
+ Recommend an authorized upgrade and reconnection when outdated.
17
+ Do not silently install packages.
18
+ Preserve useful reproduction evidence when an upgrade cannot be verified.
19
+ Load [diagnostics.md](diagnostics.md) for status interpretation.
20
+
21
+ ## Search before drafting
22
+
23
+ Search both open and closed issues in `mwillbanks/ast-mcp`.
24
+ Use the error code, failing tool or command, symptom, host, and transport.
25
+ Read likely matches and their comments before deciding whether the behavior is new.
26
+ Search results alone do not establish duplication or resolution.
27
+
28
+ Use a GitHub connector when available.
29
+ With an authenticated GitHub CLI, examples are:
30
+
31
+ `gh issue list --repo mwillbanks/ast-mcp --state all --search "approval_denied" --limit 30`
32
+
33
+ `gh issue view 57 --repo mwillbanks/ast-mcp --comments`
34
+
35
+ Adapt terms to the actual failure.
36
+ Narrow broad results with additional queries.
37
+ Record search terms, relevant links, and any unavailable search or authentication step.
38
+ Do not claim that no duplicate exists when search failed.
39
+
40
+ Prefer an existing issue when its reproduction and affected behavior match.
41
+ Treat a recurrence after a documented fix as possible regression evidence.
42
+ Explain why related issues do not cover a proposed new report.
43
+ Do not create a duplicate merely because the host name differs.
44
+
45
+ ## Collect a minimal report
46
+
47
+ Include these facts:
48
+
49
+ - Expected behavior and observed behavior.
50
+ - Minimal reproduction and the failing tool or CLI arguments.
51
+ - Sanitized error code, response outcome, and policy provenance.
52
+ - Running ast-mcp version, latest stable version, and version-check time or failure.
53
+ - Host identity and version when known, plus transport, protocol, and relevant negotiated capabilities.
54
+ - Local versus global package selection and configuration layers when relevant.
55
+ - Reproduction frequency, verification performed, and unverified assumptions.
56
+ - Related issue links and duplicate-search results.
57
+
58
+ Separate observed facts from hypotheses.
59
+ Include only configuration fields needed to reproduce the behavior.
60
+ Redact secrets, credentials, source content, private paths, account identifiers, and replayable challenge keys.
61
+ Do not attach complete environment dumps, databases, or session transcripts.
62
+ Do not weaken authorization to obtain a reproduction.
63
+
64
+ ## Submit only with authorization
65
+
66
+ Prepare the draft before asking for missing reporting authorization.
67
+ Check existing user instructions before asking again.
68
+ Recheck latest stable version immediately before submission.
69
+ Record an unavailable recheck explicitly.
70
+ An unavailable upgrade or registry must not erase valid failure evidence.
71
+
72
+ When authorized, add evidence to the matching issue or create one issue for distinct behavior.
73
+ Use the connector's structured body argument.
74
+ With GitHub CLI, use a body file created through the authorized local file workflow.
75
+ Do not interpolate report text into shell commands.
76
+ Do not post credentials or unsanitized diagnostic output.
77
+
78
+ Return the issue or comment link after a successful authorized submission.
79
+ If GitHub access is unavailable, preserve a sanitized draft and state the missing prerequisite.
80
+ Do not claim that a draft was submitted.
@@ -98,3 +98,13 @@ Default cancellation returns the string error code `aborted`. Incomplete rollbac
98
98
 
99
99
  Formatting defaults to disabled. File operations never download formatters.
100
100
  Load [configuration.md](configuration.md) for formatter selection, path rules, approvals, and immutable revisions.
101
+
102
+ ## Optional SQL candidate validation
103
+
104
+ SQL validation is requested only when the operation supplies a policy, dialect, version, or variant, or when effective policy is `required`. Configuring a dialect alone does not invoke a validator. With no request, the result is `not_requested`. The default policy is `advisory`; its `valid`, `invalid`, `unsupported`, or `unavailable` result never blocks an otherwise safe patch. `skip` explicitly records that validation was skipped and makes no grammar claim.
105
+
106
+ Set SQL options on the preview request. A preview receipt binds the selection, policy, and validation decision to the candidate and configuration. Commit the receipt without new operations or SQL options. Generate a new preview to change SQL options. When required validation lacks support or fails, retry with per-file `sql: { policy: "skip" }` to proceed with the already-authorized patch. Do not edit persistent defaults for one file.
107
+
108
+ Only PostgreSQL 18 core SQL is currently supported, using `variant: "sql"` by default. `DO`, `CREATE FUNCTION`, PL/pgSQL, extensions, catalog state, and execution are outside this grammar check. The adapter accepts 512 KiB per source and 2 MiB outstanding. Eight requests including the active request is the total capacity; one worker runs at a time and up to seven requests wait. The five-second deadline covers queueing, lazy initialization, parsing, and result handling. Bounded worker retirement keeps its capacity reserved until termination is confirmed. Generic `run` SQL AST matching is separate from dialect validation.
109
+
110
+ New operations require an explicit `patchStrategy`. Receipt commits omit patch operations and strategy. A failed or empty AST match does not select Aider automatically. Inspect exact text, then choose Aider when its match is safe and unique.
@@ -7,49 +7,51 @@ Do not transfer options between tools.
7
7
 
8
8
  ## Callable tools
9
9
 
10
- | Tool | Inputs | Purpose |
11
- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
12
- | `workspace_open` | `directory`, `revision?`, `storage?` | Open an exact checkout and revision. |
13
- | `workspace_status` | `workspaceId?` | Inspect selected or known workspaces. |
14
- | `map` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `detail?`, `max_members?` | Inspect source structure. |
15
- | `digest` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `detail?`, `max_members?` | Summarize a bounded project. |
16
- | `show` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `symbols?`, `target?`, `detail?` | Read exact symbols. |
17
- | `implements` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?` | Find implementations. |
18
- | `surface` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?` | Inspect exported APIs. |
19
- | `deps` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `hide_ambiguous?`, `hide_external?` | Inspect outgoing imports. |
20
- | `reverse_deps` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `hide_ambiguous?`, `hide_external?` | Inspect importing modules. |
21
- | `cycles` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `hide_ambiguous?`, `hide_external?` | Find import cycles. |
22
- | `graph` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `hide_ambiguous?`, `hide_external?` | Inspect module relationships. |
23
- | `search` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `query?`, `target?` | Find symbols or source text. |
24
- | `find_related` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `query?`, `target?` | Find related source. |
25
- | `callers` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?`, `depth?`, `direct?`, `detail?` | Find incoming calls. |
26
- | `callees` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?`, `depth?`, `direct?`, `detail?` | Find outgoing calls. |
27
- | `trace` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?`, `depth?`, `direct?`, `detail?` | Trace calls from a target. |
28
- | `impact` | `paths?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?`, `depth?`, `direct?`, `detail?`, `hide_ambiguous?`, `hide_external?` | Inspect shared-symbol impact. |
29
- | `context` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?`, `depth?`, `direct?`, `detail?` | Read a symbol and nearby calls. |
30
- | `run` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `pattern?`, `rewrite?`, `write?`, `json?` | Search AST patterns and preview rewrites. |
31
- | `squeeze` | `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `text?`, `query?` | Condense supplied text. |
32
- | `config_status` | `revision?`, `workspaceId?` | Inspect effective configuration. |
33
- | `policy_check` | `checks`, `revision?`, `workspaceId?` | Check local file policy without writes. |
34
- | `document_query` | `filePath`, `revision?`, `selectors`, `workspaceId?` | Read selected structured-document values. |
35
- | `config_core` | `cli?`, `dependencies?`, `files?`, `formatting?`, `intelligence?`, `http?`, `mcp?`, `safety?`, `telemetry?`, `target?`, `workspace?` | Edit grouped core configuration. |
36
- | `config_paths` | `operations`, `target?` | Edit ordered path rules. |
37
- | `file_read` | `files`, `revision?`, `workspaceId?` | Read bounded text or AST values. |
38
- | `file_capabilities` | `filePaths`, `revision?`, `workspaceId?` | Inspect supported and effective methods. |
39
- | `file_hash` | `filePaths`, `revision?`, `workspaceId?` | Hash whole-file bytes. |
40
- | `file_write` | `files`, `revision?`, `workspaceId?` | Create or replace permitted files. |
41
- | `file_patch` | `files`, `revision?`, `workspaceId?` | Commit guarded patches. |
42
- | `file_chattr` | `files`, `revision?`, `workspaceId?` | Change file metadata. |
43
- | `file_delete` | `files`, `revision?`, `workspaceId?` | Delete guarded files. |
44
- | `file_rename` | `files`, `revision?`, `workspaceId?` | Move guarded files without replacement. |
45
- | `graph_query` | `workspaceId`, `budget?`, `cursor?`, `direction?`, `edgeKinds?`, `operation?`, `resolutionStatuses?`, `startNodeIds` | Traverse or inspect indexed graphs. |
46
- | `graph_path` | `workspaceId`, `budget?`, `direction?`, `edgeKinds?`, `resolutionStatuses?`, `sourceNodeId`, `targetNodeId` | Find an indexed path. |
47
- | `graph_explain` | `workspaceId`, `budget?`, `cursor?`, `nodeId`, `pageSize?` | Explain an indexed entity. |
48
- | `graph_diff` | `base`, `budget?`, `cursor?`, `federation?`, `pageSize?`, `target` | Compare published generations. |
49
- | `retrieve` | `workspaceId`, `budget?`, `deniedPaths?`, `exactSymbols?`, `includedPaths?`, `intent?`, `languages?`, `query`, `semantic?` | Retrieve scoped evidence. |
50
- | `generate` | `workspaceId`, `allowedCorpusArtifactIds`, `budget?`, `evidence`, `prompt` | Generate an answer from explicit evidence. |
51
- | `index` | `workspaceId`, `action?`, `collection?` | Maintain the workspace index. |
52
- | `index_status` | `workspaceId`, `maxRowsPerTable?`, `timeoutMs?` | Read index status. |
10
+ | Tool | Inputs | Purpose |
11
+ | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
12
+ | `diagnostics` | None | Inspect loaded state and check the latest stable package version. |
13
+ | `approval_probe` | None | Explicitly test approval interaction without filesystem grants. |
14
+ | `workspace_open` | `directory`, `revision?`, `storage?` | Open an exact checkout and revision. |
15
+ | `workspace_status` | `workspaceId?` | Inspect selected or known workspaces. |
16
+ | `map` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `detail?`, `max_members?` | Inspect source structure. |
17
+ | `digest` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `detail?`, `max_members?` | Summarize a bounded project. |
18
+ | `show` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `symbols?`, `target?`, `detail?` | Read exact symbols. |
19
+ | `implements` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?` | Find implementations. |
20
+ | `surface` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?` | Inspect exported APIs. |
21
+ | `deps` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `hide_ambiguous?`, `hide_external?` | Inspect outgoing imports. |
22
+ | `reverse_deps` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `hide_ambiguous?`, `hide_external?` | Inspect importing modules. |
23
+ | `cycles` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `hide_ambiguous?`, `hide_external?` | Find import cycles. |
24
+ | `graph` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `hide_ambiguous?`, `hide_external?` | Inspect module relationships. |
25
+ | `search` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `query?`, `target?` | Find symbols or source text. |
26
+ | `find_related` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `query?`, `target?` | Find related source. |
27
+ | `callers` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?`, `depth?`, `direct?`, `detail?` | Find incoming calls. |
28
+ | `callees` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?`, `depth?`, `direct?`, `detail?` | Find outgoing calls. |
29
+ | `trace` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?`, `depth?`, `direct?`, `detail?` | Trace calls from a target. |
30
+ | `impact` | `paths?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?`, `depth?`, `direct?`, `detail?`, `hide_ambiguous?`, `hide_external?` | Inspect shared-symbol impact. |
31
+ | `context` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `target?`, `depth?`, `direct?`, `detail?` | Read a symbol and nearby calls. |
32
+ | `run` | `paths?`, `file?`, `path?`, `root?`, `glob?`, `lang?`, `languages?`, `scan_limit?`, `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `pattern?`, `rewrite?`, `write?`, `json?` | Search AST patterns and preview rewrites. |
33
+ | `squeeze` | `budget?`, `limit?`, `top_k?`, `timeout_ms?`, `workspaceId?`, `text?`, `query?` | Condense supplied text. |
34
+ | `config_status` | `revision?`, `workspaceId?` | Inspect effective configuration. |
35
+ | `policy_check` | `checks`, `revision?`, `workspaceId?` | Check local file policy without writes. |
36
+ | `document_query` | `filePath`, `revision?`, `selectors`, `workspaceId?` | Read selected structured-document values. |
37
+ | `config_core` | `cli?`, `dependencies?`, `files?`, `formatting?`, `intelligence?`, `http?`, `mcp?`, `safety?`, `telemetry?`, `target?`, `workspace?` | Edit grouped core configuration. |
38
+ | `config_paths` | `operations`, `target?` | Edit ordered path rules. |
39
+ | `file_read` | `files`, `revision?`, `workspaceId?` | Read bounded text or AST values. |
40
+ | `file_capabilities` | `filePaths`, `revision?`, `workspaceId?` | Inspect supported and effective methods. |
41
+ | `file_hash` | `filePaths`, `revision?`, `workspaceId?` | Hash whole-file bytes. |
42
+ | `file_write` | `files`, `revision?`, `workspaceId?` | Create or replace permitted files. |
43
+ | `file_patch` | `files`, `revision?`, `workspaceId?` | Commit guarded patches. |
44
+ | `file_chattr` | `files`, `revision?`, `workspaceId?` | Change file metadata. |
45
+ | `file_delete` | `files`, `revision?`, `workspaceId?` | Delete guarded files. |
46
+ | `file_rename` | `files`, `revision?`, `workspaceId?` | Move guarded files without replacement. |
47
+ | `graph_query` | `workspaceId`, `budget?`, `cursor?`, `direction?`, `edgeKinds?`, `operation?`, `resolutionStatuses?`, `startNodeIds` | Traverse or inspect indexed graphs. |
48
+ | `graph_path` | `workspaceId`, `budget?`, `direction?`, `edgeKinds?`, `resolutionStatuses?`, `sourceNodeId`, `targetNodeId` | Find an indexed path. |
49
+ | `graph_explain` | `workspaceId`, `budget?`, `cursor?`, `nodeId`, `pageSize?` | Explain an indexed entity. |
50
+ | `graph_diff` | `base`, `budget?`, `cursor?`, `federation?`, `pageSize?`, `target` | Compare published generations. |
51
+ | `retrieve` | `workspaceId`, `budget?`, `deniedPaths?`, `exactSymbols?`, `includedPaths?`, `intent?`, `languages?`, `query`, `semantic?` | Retrieve scoped evidence. |
52
+ | `generate` | `workspaceId`, `allowedCorpusArtifactIds`, `budget?`, `evidence`, `prompt` | Generate an answer from explicit evidence. |
53
+ | `index` | `workspaceId`, `action?`, `collection?` | Maintain the workspace index. |
54
+ | `index_status` | `workspaceId`, `maxRowsPerTable?`, `timeoutMs?` | Read index status. |
53
55
 
54
56
  ## File inputs and limits
55
57
 
@@ -68,13 +70,13 @@ Text defaults to 100 lines, with limits of 1,000 lines and 1 MiB.
68
70
  Use up to 100 source `symbols` or structured-document RFC 6901 `selectors`, never both.
69
71
  Structured documents include JSON, JSONC, TOML, and YAML.
70
72
 
71
- | Tool | Each keyed file entry |
72
- | ------------- | ---------------------------------------------------------------------------------------------------- |
73
- | `file_write` | Required `content`; optional `expectedSha256`, `chattr`. |
74
- | `file_patch` | `expectedSha256`, `patchStrategy`, `astRules`, `aiderBlocks`, `chattr`, `preview`, `previewReceipt`. |
75
- | `file_rename` | Required `destination`; optional `expectedSha256`. |
76
- | `file_chattr` | Required `chattr`; optional `expectedSha256`. |
77
- | `file_delete` | Optional `expectedSha256`, `forceReferences`. |
73
+ | Tool | Each keyed file entry |
74
+ | ------------- | ------------------------------------------------------------------------------------------------------------ |
75
+ | `file_write` | Required `content`; optional `expectedSha256`, `chattr`. |
76
+ | `file_patch` | `expectedSha256`, `patchStrategy`, `astRules`, `aiderBlocks`, `sql?`, `chattr`, `preview`, `previewReceipt`. |
77
+ | `file_rename` | Required `destination`; optional `expectedSha256`. |
78
+ | `file_chattr` | Required `chattr`; optional `expectedSha256`. |
79
+ | `file_delete` | Optional `expectedSha256`, `forceReferences`. |
78
80
 
79
81
  Existing files require fresh SHA-256 values by default.
80
82
  A supplied hash always remains enforced, even when configuration makes hashes optional.
@@ -232,15 +234,83 @@ Update policies contain only changed fields.
232
234
  Policy values are `allow`, `deny`, or `request`.
233
235
  Rule IDs accept 1–128 characters.
234
236
 
237
+ ## Diagnostic tools
238
+
239
+ `diagnostics({})` accepts no arguments and attempts a fresh latest stable package check.
240
+ It reports sanitized server, client, configuration, version, and session approval state.
241
+ The latest check has a five-second deadline and a 16 KiB response limit.
242
+ Registry failure produces an unavailable result without preventing local diagnostics.
243
+ It does not read arbitrary files or change authorization.
244
+
245
+ `approval_probe({})` also accepts no arguments.
246
+ Invoke it only for an explicitly requested approval interaction test.
247
+ Its outcomes are `accepted`, `declined`, `denied`, `cancelled`, `malformed`, `unsupported`, and `timeout`.
248
+ It checks release currency and never grants filesystem access or persists approval rules.
249
+ Both tools are available before filesystem approval.
250
+ Load [diagnostics.md](diagnostics.md) for version status, deadlines, and host recovery.
251
+
252
+ ## Optional SQL candidate validation
253
+
254
+ `file_patch` accepts optional `sql` on each path-keyed file entry:
255
+
256
+ ```json
257
+ {
258
+ "files": {
259
+ "/repo/migration.sql": {
260
+ "expectedSha256": "<fresh SHA-256>",
261
+ "patchStrategy": "aider_block",
262
+ "aiderBlocks": [{ "search": "old", "replace": "new" }],
263
+ "sql": {
264
+ "policy": "advisory",
265
+ "dialect": "postgresql",
266
+ "version": "18",
267
+ "variant": "sql"
268
+ }
269
+ }
270
+ }
271
+ }
272
+ ```
273
+
274
+ The SQL object accepts optional `policy`, `dialect`, `version`, and `variant`. Policies are `advisory`, `required`, and `skip`. The same object is available at `config_core.files.patch.sql` as persistent defaults. `config_core.target` is `project` or `global` (project by default); configuration edits follow normal approval rules.
275
+
276
+ A dialect setting alone does not invoke validation. Default advisory policy with no per-file SQL selection means `not_requested`. Required policy requests validation even when no dialect is selected; missing or unsupported validation blocks that patch. A per-file `policy: "skip"` overrides required defaults for that operation. `skip` makes no syntax claim.
277
+
278
+ The current adapter supports PostgreSQL 18 core SQL with variant `sql` only. Omitted version/variant select this adapter default. It does not validate `DO`, `CREATE FUNCTION`, PL/pgSQL bodies, database catalogs, execution, or extensions. Other dialects and PostgreSQL extensions can still be patched with advisory results or an explicit skip.
279
+
280
+ The adapter accepts at most 512 KiB per SQL source and 2 MiB of outstanding source bytes. Eight requests, including the active request, is the total capacity; one worker runs at a time and up to seven requests wait. A worker stops after five seconds. Outcomes are `not_requested`, `skipped`, `valid`, `invalid`, `unsupported`, or `unavailable`; bounded diagnostics include a sanitized message and optional line, column, or offset. Advisory outcomes do not block. Required policy allows only `valid`.
281
+
282
+ `run({ lang: "sql" })` performs generic structural SQL matching; it does not select a database dialect or replace this optional validator. New `file_patch` operations require an explicit `patchStrategy`; receipt commits intentionally omit operations and strategy. The tool never falls back from AST to Aider implicitly.
283
+
235
284
  ## MCP protocol methods
236
285
 
237
286
  These methods are not callable tools.
287
+
288
+ | Method | Role |
289
+ | --------------------------- | ---------------------------------------------------------------------- |
290
+ | `initialize` | Negotiate legacy protocol and client capabilities. |
291
+ | `notifications/initialized` | Complete legacy client initialization. |
292
+ | `server/discover` | Discover modern server capabilities. |
293
+ | `tools/list` | Discover actual tool schemas. |
294
+ | `tools/call` | Invoke a tool with its discovered arguments. |
295
+ | `ping` | Check connection responsiveness. |
296
+ | `roots/list` | Let the server request declared roots from a capable client. |
297
+ | `elicitation/create` | Let the server request approval input from a capable legacy client. |
298
+ | `sampling/createMessage` | Let the server request generation through a configured capable client. |
299
+ | `skills/list` | List negotiated skills. |
300
+ | `skills/get` | Retrieve the selected skill manifest. |
301
+ | `resources/list` | Enumerate packaged resources with pagination. |
302
+ | `resources/read` | Read an exact manifest resource URI. |
303
+ | `resources/templates/list` | List resource templates; ast-mcp currently returns none. |
304
+
305
+ Native input-required results carry correlated input requests and responses through the negotiated protocol.
306
+ Do not invent `skills/list` or `resources/read` tools.
238
307
  Supporting hosts negotiate `io.modelcontextprotocol/skills`.
239
308
  Use `skills/list`, then `skills/get` for `skill://ast-mcp/SKILL.md`.
240
309
  Use `resources/read` with exact resource URIs from the returned manifest.
241
310
  Honor pagination, `ttlMs`, `cacheScope`, advertised byte sizes, and SHA-256 digests.
242
311
  Do not infer resource paths or use directory reads.
243
312
  Protocol 2026-07-28 clients supply required protocol-version and client-capabilities request metadata.
313
+
244
314
  Legacy clients retain ordinary tools.
245
315
 
246
316
  The host activates the returned skill. Resource retrieval alone does not activate it.