Add MCP server to AST tool
Integrates the MCP server functionality into the AST tool binary. This allows the tool to act as a server for LLM integration, enabling communication over stdio. The server can list available bindings and execute scripts.
This commit is contained in:
@@ -600,6 +600,19 @@ impl Environment {
|
||||
}
|
||||
|
||||
|
||||
/// Returns the names of all bindings registered in the fixed RTL scope.
|
||||
/// Useful for introspection (e.g., MCP server listing available built-ins).
|
||||
pub fn list_bindings(&self) -> Vec<String> {
|
||||
let root_scopes = self.root_scopes.borrow();
|
||||
let mut names: Vec<String> = root_scopes[0]
|
||||
.locals
|
||||
.keys()
|
||||
.map(|sym| sym.name.to_string())
|
||||
.collect();
|
||||
names.sort();
|
||||
names
|
||||
}
|
||||
|
||||
pub fn dump_ast(&self, source: &str) -> Result<String, String> {
|
||||
self.preload_dependencies(source, None)?;
|
||||
let compiled = self.compile(source).into_result()?;
|
||||
|
||||
Reference in New Issue
Block a user