> For the complete documentation index, see [llms.txt](https://guide.fariaedu.com/professional-learning-community-mbpy/6VBx07Zj330EYGI5zHno/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.fariaedu.com/professional-learning-community-mbpy/6VBx07Zj330EYGI5zHno/tutorials/scripting.md). Agents can also search and read this documentation through its [MCP server](https://guide.fariaedu.com/professional-learning-community-mbpy/6VBx07Zj330EYGI5zHno/~gitbook/mcp).

# Scripting

Once you've imported the data, the most straight-forward thing to do is to run the pre-prepared scripts

### View the scripts available

`mbpy scripts list`

### Run a script

You can run each individual script by appending the line output above after `mbpy scripts run`, like this:

`mbpy scripts run students_id --group health_checks`

### Run an entire group of scripts

Just use the group name by itself:

`mbpy scripts run health_checks`

Example output:

<figure><img src="https://686470866-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjDAwhpkG3bJyNnwiGR%2Fuploads%2FC1XCkGn2cMc4fQ4aqOCR%2Fimage.png?alt=media&amp;token=5fe9446a-bb41-4774-8c99-78e3f54aab41" alt=""><figcaption></figcaption></figure>

### Write a script

These scripts are simply text files in the `scripts` folder. They can be grouped into directories. They have to end with `.mbpy` in order to be executed.

The idea is simple:

1. Write a query with the command line. See "[Querying via the command line](https://guide.fariaedu.com/professional-learning-community-mbpy/6VBx07Zj330EYGI5zHno/querying-and-tranformations/querying-the-database.md)" for how to do that.
2. Copy the query into a text file that ends with `.mbpy`
3. Place it into the appropriate directory
4. Re-use it with `mbpy scripts run your_script`
