Developer

RobinPath Scripts

Call RightPlace APIs from RobinPath scripts via MCP and the rightplace bridge module.

RobinPath Scripts

RobinPath is a scripting language embedded inside RightPlace. Every RightPlace API that is exposed to AI agents over MCP is also callable from a RobinPath script through the rightplace bridge module.

This page is a primer on how scripts interact with the platform. Every API Reference and System APIs page below has a MCP and RobinPath Bridge section that shows the same call from both entry points.

Two ways to call RightPlace from a script

  1. MCP - the stable, versioned protocol used by agents, the RP CLI, and external tools. Every tool name is prefixed rightplace_.
  2. RobinPath Bridge - the rightplace module inside a script. Dynamic tools auto-mount as rightplace.<name> with the rightplace_ prefix stripped. There are also a handful of static methods that don’t round-trip through MCP.

Both paths honor the same permission scopes.

Quick syntax primer

# Variables are prefixed with $ and declared with `var` or `const`.
var $greeting "hello"
const $API "https://api.example.com"

# Module calls are space-separated, no parentheses.
# Capture the result with `into $var`.
rightplace.list_projects into $projects
array.length $projects into $count
log "projects:" $count

# `$` is the last value - implicit return of the previous call.
math.add 10 20
log $                      # 30

# Blocks use explicit keywords.
if $count > 0
  log "have projects"
else
  log "no projects"
endif

# Iteration.
for $p in $projects
  log $p.name
endfor

# Group steps into a scoped block.
do into $sum
  math.add 1 2
  math.add $ 3
enddo
log "sum:" $sum             # 6

# Define reusable functions.
@param string $id "project id"
@required $id
def loadProject
  rightplace.get_project {id: $1} into $info
  log "loaded" $info.name
enddef

loadProject "abc123"

The rightplace bridge

Static methods

These are registered directly - they are NOT exposed via MCP.

MethodPurpose
rightplace.mcp(tool, args)Generic dispatcher - call any MCP tool by name.
rightplace.hook(resourceId, hookName, params, paneId?)Invoke a CallRegistry hook (devtool privilege).
rightplace.hook_list()List every registered hook.
rightplace.hook_schema(hookName)JSON Schema for a hook’s params and return.
rightplace.clipboard_copy(text)Copy text to the system clipboard.
rightplace.open_resource(resourceId)Open a resource in a new tab.
rightplace.open_tab(url)Open an in-app URL (e.g. /tab/project/<id>).

Example:

# Generic dispatch
rightplace.mcp "rightplace_list_projects" {} into $projects

# Call a hook on a browser resource
rightplace.hook "res_abc" "browser.eval" {script: "document.title"} into $title
log "title:" $title

# Copy to clipboard
rightplace.clipboard_copy "sha: a1b2c3d4"

Dynamic MCP tools

Every MCP tool is auto-mounted as a function on the rightplace module. The rightplace_ prefix is stripped:

MCP nameRobinPath call
rightplace_list_projectsrightplace.list_projects {}
rightplace_docs_getrightplace.docs_get {path: "..."}
rightplace_db_queryrightplace.db_query {resourceId: "...", sql: "..."}
rightplace_storage_listrightplace.storage_list {resourceId: "...", prefix: "..."}

Arguments are passed as an object. The return value is the tool’s JSON result.

# List, then iterate
rightplace.list_projects into $projects
for $p in $projects
  log $p.id $p.name
endfor

# Query a database
rightplace.db_query {resourceId: "res_abc", sql: "SELECT id, title FROM notes LIMIT 10"} into $rows
for $r in $rows
  log $r.title
endfor

Running a script

Scripts run in-process inside the RightPlace desktop app via the RobinPath Test playground, or from the terminal via rp run script.rp. The bridge is registered automatically on app start - no setup needed.

Permissions

The bridge enforces the same permission scopes as MCP. If a tool requires storage:write and the calling script doesn’t have it, the call throws. rightplace.hook(...) requires devtool privileges because it bypasses the agent capability whitelist.

Where to go next

Every API Reference and System APIs page has its own MCP and RobinPath Bridge section with exact tool names, arguments, and runnable examples.