pyslang-mcp

v0.1.0
io.github.ariklapid/pyslang-mcp Checked 3 days ago Published 6 months ago

Compiler-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.

ParameterTypeDescription
files *arrayProject-relative or absolute source file paths under `project_root`. Use this for explicit-file mode instead of `filelist`.
project_root *stringDeclared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error.
definesAdditional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values.
include_dirsAdditional include directories under `project_root`. These are merged with any include directories discovered from a filelist.
top_modulesOptional 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.

ParameterTypeDescription
filelist *stringProject-relative or absolute filelist path under `project_root`. Supports nested `-f` / `-F`, `+incdir+`, `-I`, and `+define+` entries.
project_root *stringDeclared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error.
definesAdditional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values.
include_dirsAdditional include directories under `project_root`. These are merged with any include directories discovered from a filelist.
top_modulesOptional 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.

ParameterTypeDescription
project_root *stringDeclared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error.
definesAdditional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values.
filelistProject-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both.
filesProject-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both.
include_dirsAdditional include directories under `project_root`. These are merged with any include directories discovered from a filelist.
max_itemsintegerMaximum number of list items to return before truncation.
top_modulesOptional 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.

ParameterTypeDescription
project_root *stringDeclared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error.
definesAdditional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values.
filelistProject-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both.
filesProject-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both.
include_dirsAdditional include directories under `project_root`. These are merged with any include directories discovered from a filelist.
max_itemsintegerMaximum number of list items to return before truncation.
top_modulesOptional 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.

ParameterTypeDescription
name *stringExact, case-sensitive design-unit name. Call `pyslang_list_design_units` first if you need to discover the available names.
project_root *stringDeclared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error.
definesAdditional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values.
filelistProject-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both.
filesProject-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both.
include_dirsAdditional include directories under `project_root`. These are merged with any include directories discovered from a filelist.
top_modulesOptional 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.

ParameterTypeDescription
project_root *stringDeclared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error.
definesAdditional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values.
filelistProject-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both.
filesProject-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both.
include_dirsAdditional include directories under `project_root`. These are merged with any include directories discovered from a filelist.
max_childrenintegerMaximum child instances to return per hierarchy node.
max_depthintegerMaximum hierarchy depth to expand from each top instance.
top_modulesOptional 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.

ParameterTypeDescription
project_root *stringDeclared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error.
query *stringSymbol name, lexical path, or hierarchical path to match against declarations and optionally references.
definesAdditional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values.
filelistProject-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both.
filesProject-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both.
include_dirsAdditional include directories under `project_root`. These are merged with any include directories discovered from a filelist.
include_referencesbooleanWhen true, walk the elaborated design to include reference hits. This is more expensive than declaration-only lookup on larger projects.
match_modestringMatch mode for `query`: `exact` matches the full name or path, `contains` matches substrings, and `startswith` matches prefixes.
max_resultsintegerMaximum declaration hits and maximum reference hits to return.
top_modulesOptional 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`.

ParameterTypeDescription
project_root *stringDeclared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error.
definesAdditional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values.
filelistProject-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both.
filesProject-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both.
include_dirsAdditional include directories under `project_root`. These are merged with any include directories discovered from a filelist.
max_filesintegerMaximum number of files to summarize before truncation.
max_node_kindsintegerMaximum distinct syntax node kinds to keep per file summary.
top_modulesOptional 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.

ParameterTypeDescription
project_root *stringDeclared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error.
definesAdditional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values.
filelistProject-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both.
filesProject-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both.
include_dirsAdditional include directories under `project_root`. These are merged with any include directories discovered from a filelist.
max_excerpt_linesintegerMaximum number of leading source lines to include per file excerpt.
max_filesintegerMaximum number of files to summarize before truncation.
top_modulesOptional 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`.

ParameterTypeDescription
project_root *stringDeclared project root. Every source file, filelist, and include directory must resolve inside this directory or the tool returns an error.
definesAdditional preprocessor defines. Use `{NAME: null}` for valueless defines and `{NAME: "VALUE"}` for explicit values.
filelistProject-relative or absolute filelist path under `project_root`. Provide this or `files`, but not both.
filesProject-relative or absolute source file paths under `project_root`. Provide this or `filelist`, but not both.
include_dirsAdditional include directories under `project_root`. These are merged with any include directories discovered from a filelist.
max_childrenintegerMaximum child instances per node in `pyslang_get_project_summary`.
max_depthintegerMaximum hierarchy depth to fold into `pyslang_get_project_summary`.
max_design_unitsintegerMaximum design units to fold into `pyslang_get_project_summary`.
max_diagnosticsintegerMaximum diagnostics to fold into `pyslang_get_project_summary`.
top_modulesOptional top-module override passed into pyslang elaboration. Use when the project contains multiple candidate tops.