pyslang-mcp
v0.1.0Compiler-backed read-only Verilog and SystemVerilog project analysis.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
pyslang_parse_files
Parse and elaborate an explicit list of Verilog or SystemVerilog files under a declared project root. Returns the normalized project configuration plus a compact parse summary with file, include, define, top-module, and diagnostic counts.
| Parameter | Type | Description |
|---|---|---|
files * | array | Project-relative or absolute source file paths under `project_root`. Use this for explicit-file mode instead of `filelist`. |
project_root * | string | Declared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error. |
defines | Additional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values. | |
include_dirs | Additional include directories under `project_root`. These are merged with any include directories discovered from a filelist. | |
top_modules | Optional top-module override passed into pyslang elaboration. Use when the project contains multiple candidate tops. |
pyslang_parse_filelist
Parse and elaborate a project filelist under a declared project root. Returns the normalized project configuration, parse counts, expanded nested filelists, and any unsupported filelist directives that were reported instead of ignored.
| Parameter | Type | Description |
|---|---|---|
filelist * | string | Project-relative or absolute filelist path under `project_root`. Supports nested `-f` / `-F`, `+incdir+`, `-I`, and `+define+` entries. |
project_root * | string | Declared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error. |
defines | Additional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values. | |
include_dirs | Additional include directories under `project_root`. These are merged with any include directories discovered from a filelist. | |
top_modules | Optional top-module override passed into pyslang elaboration. Use when the project contains multiple candidate tops. |
pyslang_get_diagnostics
Return parse and semantic diagnostics for a project described by explicit files or a filelist. Use this early to confirm the project loads cleanly; the result includes severity counts, per-diagnostic locations, and truncation metadata.
| Parameter | Type | Description |
|---|---|---|
project_root * | string | Declared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error. |
defines | Additional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values. | |
filelist | Project-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both. | |
files | Project-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both. | |
include_dirs | Additional include directories under `project_root`. These are merged with any include directories discovered from a filelist. | |
max_items | integer | Maximum number of list items to return before truncation. |
top_modules | Optional top-module override passed into pyslang elaboration. Use when the project contains multiple candidate tops. |
pyslang_list_design_units
List project-local modules, interfaces, and packages for the analyzed project. Use this as the discovery step before `pyslang_describe_design_unit`; results include stable names, kinds, paths, locations, and truncation metadata.
| Parameter | Type | Description |
|---|---|---|
project_root * | string | Declared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error. |
defines | Additional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values. | |
filelist | Project-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both. | |
files | Project-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both. | |
include_dirs | Additional include directories under `project_root`. These are merged with any include directories discovered from a filelist. | |
max_items | integer | Maximum number of list items to return before truncation. |
top_modules | Optional top-module override passed into pyslang elaboration. Use when the project contains multiple candidate tops. |
pyslang_describe_design_unit
Describe one project-local design unit by exact, case-sensitive name. Start with `pyslang_list_design_units` if you need discovery. The result reports `found` / `ambiguous`, candidate matches, and on success a `design_unit` object with ports, member-kind counts, child instances, and declared names.
| Parameter | Type | Description |
|---|---|---|
name * | string | Exact, case-sensitive design-unit name. Call `pyslang_list_design_units` first if you need to discover the available names. |
project_root * | string | Declared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error. |
defines | Additional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values. | |
filelist | Project-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both. | |
files | Project-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both. | |
include_dirs | Additional include directories under `project_root`. These are merged with any include directories discovered from a filelist. | |
top_modules | Optional top-module override passed into pyslang elaboration. Use when the project contains multiple candidate tops. |
pyslang_get_hierarchy
Return the elaborated instance hierarchy rooted at pyslang top instances. Use `max_depth` and `max_children` to control expansion; nodes include definitions, locations, port-connection snippets, and child truncation markers.
| Parameter | Type | Description |
|---|---|---|
project_root * | string | Declared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error. |
defines | Additional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values. | |
filelist | Project-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both. | |
files | Project-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both. | |
include_dirs | Additional include directories under `project_root`. These are merged with any include directories discovered from a filelist. | |
max_children | integer | Maximum child instances to return per hierarchy node. |
max_depth | integer | Maximum hierarchy depth to expand from each top instance. |
top_modules | Optional top-module override passed into pyslang elaboration. Use when the project contains multiple candidate tops. |
pyslang_find_symbol
Search declarations and references by symbol name, lexical path, or hierarchical path. `match_mode` accepts `exact`, `contains`, or `startswith`. Reference hits can include `named_value`, `package_import`, `instance_definition`, and `declared_type`; set `include_references=false` for a cheaper declaration-only query.
| Parameter | Type | Description |
|---|---|---|
project_root * | string | Declared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error. |
query * | string | Symbol name, lexical path, or hierarchical path to match against declarations and optionally references. |
defines | Additional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values. | |
filelist | Project-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both. | |
files | Project-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both. | |
include_dirs | Additional include directories under `project_root`. These are merged with any include directories discovered from a filelist. | |
include_references | boolean | When true, walk the elaborated design to include reference hits. This is more expensive than declaration-only lookup on larger projects. |
match_mode | string | Match mode for `query`: `exact` matches the full name or path, `contains` matches substrings, and `startswith` matches prefixes. |
max_results | integer | Maximum declaration hits and maximum reference hits to return. |
top_modules | Optional top-module override passed into pyslang elaboration. Use when the project contains multiple candidate tops. |
pyslang_dump_syntax_tree_summary
Summarize syntax-tree shapes per file without dumping full raw ASTs. Returns each file's root kind, top-level member kinds, include directives, and the most common node kinds up to `max_node_kinds`.
| Parameter | Type | Description |
|---|---|---|
project_root * | string | Declared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error. |
defines | Additional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values. | |
filelist | Project-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both. | |
files | Project-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both. | |
include_dirs | Additional include directories under `project_root`. These are merged with any include directories discovered from a filelist. | |
max_files | integer | Maximum number of files to summarize before truncation. |
max_node_kinds | integer | Maximum distinct syntax node kinds to keep per file summary. |
top_modules | Optional top-module override passed into pyslang elaboration. Use when the project contains multiple candidate tops. |
pyslang_preprocess_files
Return conservative preprocessing metadata and leading source excerpts for analyzed files. This is summary-only: it reports include directives and effective defines, but it does not claim to produce a full standalone preprocessed text stream.
| Parameter | Type | Description |
|---|---|---|
project_root * | string | Declared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error. |
defines | Additional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values. | |
filelist | Project-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both. | |
files | Project-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both. | |
include_dirs | Additional include directories under `project_root`. These are merged with any include directories discovered from a filelist. | |
max_excerpt_lines | integer | Maximum number of leading source lines to include per file excerpt. |
max_files | integer | Maximum number of files to summarize before truncation. |
top_modules | Optional top-module override passed into pyslang elaboration. Use when the project contains multiple candidate tops. |
pyslang_get_project_summary
Return a compact project-wide summary of normalized inputs, diagnostics, design-unit counts, top instances, and tracked paths. The summary uses bounded internal limits; tune them with `max_diagnostics`, `max_design_units`, `max_depth`, and `max_children`.
| Parameter | Type | Description |
|---|---|---|
project_root * | string | Declared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error. |
defines | Additional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values. | |
filelist | Project-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both. | |
files | Project-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both. | |
include_dirs | Additional include directories under `project_root`. These are merged with any include directories discovered from a filelist. | |
max_children | integer | Maximum child instances per node in `pyslang_get_project_summary`. |
max_depth | integer | Maximum hierarchy depth to fold into `pyslang_get_project_summary`. |
max_design_units | integer | Maximum design units to fold into `pyslang_get_project_summary`. |
max_diagnostics | integer | Maximum diagnostics to fold into `pyslang_get_project_summary`. |
top_modules | Optional top-module override passed into pyslang elaboration. Use when the project contains multiple candidate tops. |