list_scripts | read only | Lists the C# scripts in the folders this server can use, with each script's pinned packages and whether it's locked. Paths are relative and can be passed to the other tools. |
read_script | read only | Returns a script's code, its lock file and the hash of its current content (pass it as expected_hash to save_script). Passwords, tokens and keys are shown as [redacted]. Parameters (1)path string, required: Path of the script, relative to the first folder or absolute.
|
check_script | read only | Checks this machine can run a script exactly as locked: directives, lock, .NET runtime, package restore from the feeds, and compiling. Returns one ok or FAIL line per step. Doesn't run the script. Parameters (2)path string, required: Path of the script.source string: For an exported copy: the source script, to check the copy is still up to date.
|
search_packages | read only | Searches the package feeds a script restores from (its nearest nuget.config, with packageSourceMapping applied) and returns each package's id, latest version, feed, downloads and description. Use package_info to see every version, then add_package with an exact version. Parameters (4)query string, required: Search words, for example 'json' or 'Polly'.take integer: How many results to return (1 to 20).prerelease boolean: Include prerelease versions.script string: A script whose feeds to search. By default, the first folder's nuget.config applies.
|
package_info | read only | Lists every version of a package on a script's feeds, newest first, marking prerelease, deprecated and vulnerable ones, and shows one version's dependencies by target framework, license and advisories. Pick an exact version from it for add_package. Parameters (3)id string, required: The package id, for example 'Newtonsoft.Json'.version string: The version to describe. By default, the newest stable one.script string: A script whose feeds to read. By default, the first folder's nuget.config applies.
|
which_feed | read only | Says which of a script's feeds a package may be restored from under its packageSourceMapping, the pattern that decided it, and why. An empty list means restore will fail for that package; fix it with map_package. Parameters (2)script string, required: Path of the script.id string, required: The package id, for example 'Newtonsoft.Json'.
|
list_connections | read only | Lists the named database connections saved on this machine: each one's name and kind of database, never its connection string. A script uses one by declaring '#:connection Name' at the top, pinning the database's driver package, and opening it with 'await Db.Name.OpenAsync()' (or, with '#:connection Name efcore' and the EF Core provider, 'Db.Name.CreateContext()'). describe_database shows its tables and columns. |
describe_database | read only | Lists the tables, views, procedures and functions of one of this machine's named connections (see list_connections), or, with 'table', that table's columns, keys and a C# record for its rows. Reads only the database's catalog, never its data, and never shows the connection string. The schema is cached; pass refresh=true after the database changes. Parameters (5)connection string, required: The connection's name, as in '#:connection Sales'.table string: A table or view, as name or schema.name, to show its columns and a C# record for it.schema string: Only this schema (SQL Server or PostgreSQL schema, MySQL database, Oracle user).refresh boolean: Read the schema from the database again instead of the cache.script string: A script that uses this connection with '#:connection Name efcore': also lists its EF Core model's DbSets, entity classes, properties and navigations, as the script must name them.
|
run_script | yes, asks first | Runs a locked script and returns its exit code and output, including Dump() tables. Always runs frozen: exactly the versions in the lock, and an unlocked script is refused (use lock_script first). Runs have a time limit and an output cap. This runs real code on the user's machine. Parameters (2)path string, required: Path of the script.args string[]: Arguments passed to the script.
|
debug_script | yes, asks first | Runs a locked script under the debugger (netcoredbg, downloaded on first use), stopping at each breakpoint line to record the line, the call stack and the local variables, then going on. Returns JSON: {version, exitCode, output, outputTruncated, breakpoints: [{line, verified, boundLine, message}], hits: [{line, file, stack: [{name, file, line}], locals: [{name, type, value}]}], hitLimitReached, error: null or {type, message, file, line, stack, locals} for an unhandled exception}. Always runs frozen, like run_script, with the same time limit and output cap; values are cut to 1000 characters and secrets are redacted. A line with no code binds to the next line that has some (see boundLine). This runs real code on the user's machine. Parameters (4)path string, required: Path of the script.breakpoints integer[], required: Line numbers in the script to stop at, for example [12, 30].args string[]: Arguments passed to the script.max_hits integer: Stop recording after this many hits (default 50); the breakpoints are then removed and the script runs on.
|
lock_script | yes | Resolves a script's pinned packages and writes its lock file (<script>.lock.json next to it), recording every package with its content hash. Run this after changing #:package lines. Parameters (1)path string, required: Path of the script.
|
save_model | yes | Saves the tables a script's EF Core connection ('#:connection Sales efcore') uses into <script>.schema.json next to it, from this machine's cached schema (refresh=true reads the catalog again). The script's Db.Sales.CreateContext() is built from that file, never from the database. Pick the tables the script needs: EF builds its model from all of them at the start of every run. Without tables it takes every table and view, up to 100. Commit the file with the script. Reads only the catalog, never data. Parameters (5)script string, required: Path of the script.connection string, required: The connection's name, as in '#:connection Sales efcore'.tables string[]: Tables and views to include, as name or schema.name. Leave out for all of them (up to 100).schema string: Only this schema (SQL Server or PostgreSQL schema, MySQL database, Oracle user). A MySQL model needs one when the server has several.refresh boolean: Read the schema from the database again instead of the cache.
|
add_package | yes | Adds a pinned '#:package Id@Version' line to a script and relocks it. The version must be exact (find one with search_packages). If the package can't be restored, the script is left unchanged. Parameters (3)path string, required: Path of the script.id string, required: NuGet package id, for example Dapper.version string, required: Exact version, for example 2.1.35.
|
export_script | yes | Writes a single-file copy of a locked script with its lock embedded at the end, for sharing or deploying. The script and its lock file aren't changed. The copy runs anywhere with 'runthat run --frozen'. Parameters (2)path string, required: Path of the script.output string: Where to write the copy: a folder or a .cs file inside the allowed folders. Defaults to dist/<script>.cs next to the script.
|
save_script | yes, asks first | Creates a .cs script, or replaces one with new text. To replace an existing script, pass the hash read_script returned as expected_hash: if the file changed since then, nothing is written. Packages must be pinned to exact versions. If the #:package lines (or the target framework) changed, the script is relocked, and if the restore fails the old script and lock are put back. Parameters (3)path string, required: Path of the script, for example reports/sales.cs. Folders that don't exist yet are created.content string, required: The whole text of the script.expected_hash string: The hash read_script returned for the current file. Required to replace an existing script; leave it out to create a new one.
|
publish_script | yes, asks first | Compiles a locked script into a folder that runs on a machine with no package feeds (and, when self-contained, no .NET installed). Refused if any package would differ from the lock. Only replaces a folder runthat published before, or an empty one. Returns the folder. Parameters (5)path string, required: Path of the script.runtime string: Runtime identifier, for example win-x64, linux-x64 or osx-arm64. Defaults to this machine's.self_contained boolean: Include the .NET runtime, so the target machine needs nothing installed.single_file boolean: Bundle the app into one executable.output string: The folder to publish into, inside the allowed folders. Defaults to dist/<script>-<runtime> next to the script.
|
import_linq | yes | Turns an existing .linq query file into a runthat script and locks it. Packages the query didn't pin get the version this machine already uses; if it has none, pass pins. Returns the new script's path and hash, and notes on anything that couldn't be carried over (for example a database connection to add with #:connection). Parameters (4)path string, required: Path of the .linq file, inside the allowed folders.output string: The script to write: a .cs file or a folder inside the allowed folders. Defaults to the .linq file's name with .cs, next to it.pins string[]: Exact versions for packages the .linq file doesn't pin, for example ["[email protected]"].expected_hash string: To replace a script that already exists: the hash read_script returned for it.
|
add_feed | yes | Adds a package feed to the nuget.config a script restores with (its nearest one, or a new nuget.config next to it, which starts with the feeds the script already used). The source is an https:// URL or a folder; a relative folder stays relative to the config file. Refuses a name that's already used. Never writes credentials. With packageSourceMapping on, map packages to the new feed with map_package. Parameters (3)script string, required: Path of the script whose feeds to change.name string, required: The feed's name, for example 'acme'.source string, required: An https:// feed URL (usually ending in index.json) or a folder of .nupkg files.
|
remove_feed | yes, asks first | Removes a feed from the script's nuget.config, with its packageSourceMapping patterns, disabled entry and saved credentials in that file. Feeds from the user's or the machine's NuGet config aren't changed; the error says how to turn them off instead. Parameters (2)script string, required: Path of the script whose feeds to change.name string, required: The feed's name.
|
map_package | yes | Adds a packageSourceMapping pattern to the script's nuget.config, so matching packages come only from that feed. A pattern is an exact package id, a prefix ending in * (Contoso.*), or * for everything else. Once any pattern exists, packages that match none can't be restored: check with which_feed. Parameters (3)script string, required: Path of the script whose feeds to change.pattern string, required: The pattern: an exact id, Prefix.*, or *.feed string, required: The feed's name.
|
unmap_package | yes, asks first | Removes a packageSourceMapping pattern from the script's nuget.config: from one feed, or from every feed when feed is left out. When no pattern is left, packageSourceMapping is off and NuGet tries every enabled feed. Parameters (3)script string, required: Path of the script whose feeds to change.pattern string, required: The pattern, exactly as mapped.feed string: The feed to remove it from. By default, every feed.
|