Skip to main content
Glama
ast-grep

ast-grep MCP Server

by ast-grep

dump_syntax_tree

Debug code rules by inspecting syntax tree structures. Use to discover correct syntax kinds and analyze how patterns are interpreted in ast-grep.

Instructions

Dump code's syntax structure or dump a query's pattern structure. This is useful to discover correct syntax kind and syntax tree structure. Call it when debugging a rule. The tool requires three arguments: code, language and format. The first two are self-explanatory. format is the output format of the syntax tree. use format=cst to inspect the code's concrete syntax tree structure, useful to debug target code. use format=pattern to inspect how ast-grep interprets a pattern, useful to debug pattern rule.

Internally calls: ast-grep run --pattern --lang --debug-query=

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe code you need
languageYesThe language of the code. Supported: bash, c, cpp, csharp, css, elixir, go, haskell, html, java, javascript, json, jsx, kotlin, lua, nix, php, python, ruby, rust, scala, solidity, swift, tsx, typescript, yaml
formatNoCode dump format. Available values: pattern, ast, cstcst

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ast-grep/ast-grep-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server