KScript docs
EN

AI assistants (MCP)

What the assistant gets

Tools

The server gives the assistant these tools to call:

  • search_docs searches the guides and the reference: packages, elements, commands, methods, built-in variables and kscript commands.
  • read_doc reads a whole page as Markdown: a guide (language, code-format, web...), a package (KScript.IO), a type's methods (string methods), variables or cli.
  • lookup gives everything about one name, such as <for>, @read_text, list->map, $args or KScript.Math: its parameters and their types, the return type, retired v1 names and an example.
  • list_make_commands lists the kscript make templates of your project (built in and _templates/) and the project templates.
  • check_code checks code or a file without running it, like kscript check, with your project's lint rules.
  • format_code formats code or a file like kscript fmt, with your project's format settings, and returns the result.
  • convert_code converts between XML and .kscript, like kscript convert.
  • run_code runs a short script in the same sandbox as the docs' Run buttons, and returns what it printed.

Resources

Every page is also a resource, such as kscript://docs/guide/language or kscript://docs/reference/io, for assistants that let you attach resources to a chat.

Syntax and project

Examples come in your project's syntax: make.syntax in kscript.json, or .kscript outside a project. --syntax picks one for every call, and a tool call can ask for the other. The project is the folder the assistant starts the server in; --dir names another.

What the server may touch

Nothing the server does changes your files. check_code and format_code read a file only when the assistant passes its path, and only a script or page (.kscript, .ks.xml, .html, .md) inside the project folder. run_code runs in an empty temporary folder with no network and without your environment variables.

Edit this page on GitHub