
Routeros Command Tree
- 1 installs
- 404 repo stars
- Updated August 5, 2026
- aiskillstore/marketplace
routeros-command-tree is a skill for introspecting the MikroTik RouterOS command hierarchy through the /console/inspect REST endpoint.
About
routeros-command-tree is a skill for RouterOS command-tree introspection via the /console/inspect REST endpoint. It explains the four node types, child/syntax request formats, recursive tree traversal, and CLI-to-REST verb mapping used by tools like restraml and rosetta. A developer uses it when building tools that parse RouterOS commands or generate API schemas from RouterOS.
- Traverse the RouterOS command tree via /console/inspect
- Map CLI commands to REST verbs for schema generation
- Flags dangerous subtrees that crash the REST server
Routeros Command Tree by the numbers
- 1 all-time installs (skills.sh)
- Ranked #933 of 1,039 Cloud & Infrastructure skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
routeros-command-tree capabilities & compatibility
- Capabilities
- api introspection · schema generation · tree traversal
- Use cases
- api development
What routeros-command-tree says it does
The `/console/inspect` REST endpoint lets you **programmatically explore the entire tree**
These path segments **crash the RouterOS REST server** when their `arg` nodes are queried for syntax via `/console/inspect`.
npx skills add https://github.com/aiskillstore/marketplace --skill routeros-command-treeAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 404 |
| Last updated | August 5, 2026 |
| Repository | aiskillstore/marketplace ↗ |
What it does
Programmatically explore the RouterOS command tree and generate API schemas via /console/inspect.
Who is it for?
Building tools that parse RouterOS commands or generate OpenAPI/RAML schemas from RouterOS
Skip if: General Linux networking or RouterOS v6
When should I use this skill?
Traversing the RouterOS command tree, using /console/inspect, or mapping CLI commands to REST verbs
What you get
A programmatically walked command tree with descriptions and CLI-to-REST verb mappings.
- Recursive tree-walk function
- CLI-to-REST verb map
By the numbers
- 4 command-tree node types
- 6 dangerous path segments to skip
Files
RouterOS Command Tree & /console/inspect
Overview
RouterOS organizes all configuration and commands in a hierarchical tree. Every path in the CLI (like /ip/address/add) corresponds to a node in this tree. The /console/inspect REST endpoint lets you programmatically explore the entire tree — this is how tools like restraml (RAML/OpenAPI schema generator) and rosetta (MCP command lookup) build their databases.
The Command Tree Structure
RouterOS's command hierarchy has four node types:
| Node Type | Meaning | Example |
|---|---|---|
dir | Directory — contains child paths | /ip, /system |
path | Path — a navigable level (often has commands) | /ip/address, /interface/bridge |
cmd | Command — an executable action | add, set, print, remove, get, export |
arg | Argument — a parameter to a command | address=, interface=, disabled= |
Tree Example
/ (root dir)
├── ip/ (dir)
│ ├── address/ (path)
│ │ ├── add (cmd)
│ │ │ ├── address (arg) — "IP address"
│ │ │ ├── interface (arg) — "Interface name"
│ │ │ └── disabled (arg) — "yes | no"
│ │ ├── set (cmd)
│ │ ├── remove (cmd)
│ │ ├── get (cmd)
│ │ ├── print (cmd)
│ │ └── export (cmd)
│ ├── route/ (path)
│ │ └── ...
│ └── dns/ (path)
│ ├── set (cmd)
│ ├── cache/ (path)
│ │ ├── print (cmd)
│ │ └── flush (cmd)
│ └── ...
├── interface/ (dir)
│ └── ...
├── system/ (dir)
│ └── ...
└── .../console/inspect API
Endpoint
POST /rest/console/inspectRequires basic authentication. Available on all RouterOS 7.x versions.
Request Types
| Request | Purpose | Returns |
|---|---|---|
child | List children of a path | Array of {type: "child", name, "node-type"} |
syntax | Get help text for a node | Array of {type: "syntax", text} |
highlight | Syntax highlighting data | Tokenized output (rarely used) |
completion | Tab-completion suggestions | Completion candidates |
Listing Children
// List children of /ip
const children = await fetch(`${base}/console/inspect`, {
method: "POST",
headers: { ...authHeaders, "Content-Type": "application/json" },
body: JSON.stringify({
request: "child",
path: "ip",
}),
}).then(r => r.json());
// Response:
// [
// { "type": "child", "name": "address", "node-type": "path" },
// { "type": "child", "name": "arp", "node-type": "path" },
// { "type": "child", "name": "cloud", "node-type": "path" },
// { "type": "child", "name": "dhcp-client", "node-type": "path" },
// { "type": "child", "name": "dns", "node-type": "path" },
// { "type": "child", "name": "route", "node-type": "path" },
// ...
// ]Getting Syntax Help
// Get description for /ip/address/add → address argument
const syntax = await fetch(`${base}/console/inspect`, {
method: "POST",
headers: { ...authHeaders, "Content-Type": "application/json" },
body: JSON.stringify({
request: "syntax",
path: "ip,address,add,address", // comma-separated path
}),
}).then(r => r.json());
// Response:
// [{ "type": "syntax", "text": "IP address" }]Path Format
The path field uses comma-separated segments (not slashes):
- Root:
""(empty string) /ip:"ip"/ip/address:"ip,address"/ip/address/add:"ip,address,add"/ip/address/add → address arg:"ip,address,add,address"
When using the JavaScript Array.toString() method, this comma-separated format is produced naturally from an array: ["ip", "address", "add"].toString() → "ip,address,add".
Tree Traversal Pattern
To walk the entire tree recursively:
async function walkTree(path = [], tree = {}) {
const children = await fetchInspect("child", path.toString());
for (const child of children) {
if (child.type !== "child") continue;
const childPath = [...path, child.name];
tree[child.name] = { _type: child["node-type"] };
// For args, fetch the syntax description — but NOT inside dangerous subtrees
if (child["node-type"] === "arg") {
if (DANGEROUS_PATHS.some(p => childPath.includes(p))) continue;
const syntax = await fetchInspect("syntax", childPath.toString());
if (syntax.length === 1 && syntax[0].text.length > 0) {
tree[child.name].desc = syntax[0].text;
}
}
// Recurse into this child (child enumeration is safe even in dangerous subtrees)
await walkTree(childPath, tree[child.name]);
}
return tree;
}Dangerous Paths — Must Skip
These path segments crash the RouterOS REST server when their arg nodes are queried for syntax via /console/inspect. Always skip syntax lookups for args inside subtrees containing any of these names:
where, do, else, rule, command, on-errorThese are RouterOS scripting constructs. Specifically, `fetchSyntax()` on `arg` node-types within these subtrees terminates the HTTP server process. Enumerating children (child request) is safe even inside these paths — only the syntax/description lookup for arguments crashes.
The conservative approach (used in the example above) skips the entire arg when any ancestor matches a dangerous path. The actual rest2raml.js implementation matches this pattern.
const DANGEROUS_PATHS = ["where", "do", "else", "rule", "command", "on-error"];CLI Command → REST Verb Mapping
RouterOS CLI commands map to HTTP verbs in the REST API:
| CLI Command | HTTP Verb | REST URL Pattern | Notes |
|---|---|---|---|
get (print) | GET | /rest/ip/address | Returns array of all entries |
get (single) | GET | /rest/ip/address/*1 | Single entry by ID |
add | PUT | /rest/ip/address | Creates new entry (not POST!) |
set | PATCH | /rest/ip/address/*1 | Updates existing entry |
remove | DELETE | /rest/ip/address/*1 | Deletes entry by ID |
print | POST | /rest/ip/address/print | Action-style (also works as GET) |
| Other commands | POST | /rest/path/command | Action — reboot, flush, etc. |
Key insight: REST PUT = create, PATCH = update. This is the opposite of many REST API conventions where PUT is idempotent update and POST is create.
RAML/OpenAPI Schema Generation
When generating API schemas from the command tree:
1. Walk the tree to collect all paths, commands, and arguments 2. For each cmd node:
get→ generates bothGET /path(list) andGET /path/{id}(single)add→ generatesPUT /pathwith arg-based request bodyset→ generatesPATCH /path/{id}with arg-based request bodyremove→ generatesDELETE /path/{id}- Other commands →
POST /path/command
3. For each arg under a command, generate request body properties or query parameters 4. The desc field from syntax lookups becomes the description
The .proplist and .query Parameters
All POST-based command endpoints accept two special parameters:
.proplist— selects which properties to return (like SQL SELECT).query— filter expression array (like SQL WHERE)
These are RouterOS REST API conventions, not standard REST patterns.
Output Formats
The inspect tree can be converted to multiple schema formats:
inspect.json (Raw Output)
The raw tree as returned by recursive /console/inspect calls. Each node has:
{
"address": {
"_type": "path",
"add": {
"_type": "cmd",
"address": { "_type": "arg", "desc": "IP address" },
"interface": { "_type": "arg", "desc": "Interface name" }
},
"set": { "_type": "cmd", ... },
"print": { "_type": "cmd", ... }
}
}RAML 1.0 (schema.raml)
Converted to RAML 1.0 resource/method notation:
/ip:
/address:
get:
queryParameters: ...
responses: ...
put:
body:
application/json:
properties:
address: { type: any, description: "IP address" }
/{id}:
get: ...
patch: ...
delete: ...OpenAPI 3.0 (openapi.json)
Standard OpenAPI 3.0 schema generated from the same inspect tree (7.21.1+).
The inspect.json Data Model
Each version's inspect.json is the canonical source of truth for that RouterOS version's command tree. It captures:
- Every navigable path in the CLI hierarchy
- Every executable command at each path level
- Every argument (parameter) for each command
- Syntax descriptions for arguments
Tools can parse inspect.json offline without needing a live router — set INSPECTFILE env var and the schema generator will use the cached file instead of querying a router.
Common Patterns for Working with the Tree
Finding Commands at a Path
// Given an inspect.json node for /ip/address
const node = inspectData.ip.address;
// Commands are children with _type === "cmd"
const commands = Object.entries(node)
.filter(([key, val]) => val._type === "cmd")
.map(([key]) => key);
// → ["add", "set", "remove", "get", "print", "export", ...]Finding Arguments for a Command
// Arguments of /ip/address/add
const addCmd = inspectData.ip.address.add;
const args = Object.entries(addCmd)
.filter(([key, val]) => val._type === "arg")
.map(([key, val]) => ({ name: key, description: val.desc }));
// → [{name: "address", description: "IP address"}, ...]Traversing Directories
// Directories and paths (navigable children)
const children = Object.entries(node)
.filter(([key, val]) => val._type === "dir" || val._type === "path")
.map(([key]) => key);Performance Notes
- Full tree traversal takes many minutes against a live router (thousands of HTTP requests,
each a separate POST to /console/inspect). With KVM acceleration the CHR responds quickly, but the sheer number of sequential requests adds up.
- Each
/console/inspectcall is a separate HTTP request — no batch API - Use
INSPECTFILEfor development/testing to avoid repeated live queries - The tree is version-specific — different RouterOS versions have different command sets
- Extra packages (container, iot, zerotier, etc.) add additional command tree branches
Additional Resources
- For REST API details: see
routeros-fundamentalsskill → REST API patterns - For running a CHR to query: see the
routeros-qemu-chrskill - For /app YAML format (a feature visible in the tree under 7.22+): see the
routeros-app-yamlskill
{
"schema_version": "2.0",
"meta": {
"generated_at": "2026-05-09T15:34:24.034Z",
"slug": "tikoci-routeros-command-tree",
"source_url": "https://github.com/tikoci/routeros-skills/tree/main/routeros-command-tree",
"source_ref": "main",
"model": "claude",
"analysis_version": "3.0.0",
"source_type": "community",
"content_hash": "1f4ed11fb23f0179f73dff4a191cf321a43e782f180b405e50e49b2ad1d2b647",
"tree_hash": "1eb893fbb38a1ea23b44297a26ac080a8519454e3ed215ae61821a76b9c36bca"
},
"skill": {
"name": "routeros-command-tree",
"description": "RouterOS command tree introspection via /console/inspect API. Use when: building tools that parse RouterOS commands, generating API schemas from RouterOS, working with /console/inspect, mapping CLI commands to REST verbs, traversing the RouterOS command hierarchy, or when the user mentions inspect, command tree, RAML, or OpenAPI generation for RouterOS.",
"summary": "Introspect RouterOS command hierarchy via /console/inspect API for schema generation and CLI mapping",
"icon": "📦",
"version": "1.0.0",
"author": "tikoci",
"license": "MIT",
"tags": [
"routeros",
"api",
"schema-generation",
"introspection"
],
"supported_tools": [
"claude",
"codex",
"claude-code"
],
"risk_factors": [
"network"
]
},
"security_audit": {
"risk_level": "low",
"is_blocked": false,
"safe_to_publish": true,
"summary": "Static analysis flagged 138 potential issues, but evaluation reveals 133 are false positives (markdown documentation patterns misinterpreted as code execution). Two network fetch() calls exist but are legitimate API queries to RouterOS /console/inspect endpoint - the documented core functionality. No malicious intent, command injection vectors, or actual security vulnerabilities present. Risk assessed as LOW due to intentional network access required for skill purpose.",
"risk_factor_evidence": [
{
"factor": "network",
"evidence": [
{
"file": "SKILL.md",
"line_start": 79,
"line_end": 79
},
{
"file": "SKILL.md",
"line_start": 104,
"line_end": 104
}
]
},
{
"factor": "filesystem",
"evidence": [
{
"file": "SKILL.md",
"line_start": 326,
"line_end": 326
}
]
}
],
"critical_findings": [],
"high_findings": [],
"medium_findings": [],
"low_findings": [],
"dangerous_patterns": [],
"files_scanned": 1,
"total_lines": 329,
"audit_model": "claude",
"audited_at": "2026-05-09T15:34:24.034Z"
},
"content": {
"user_title": "Introspect RouterOS command trees for schema generation",
"value_statement": "Building tools that interact with RouterOS requires understanding the command hierarchy. This skill provides documentation for the /console/inspect API, enabling developers to programmatically explore RouterOS command trees for API schema generation and CLI-to-REST mapping.",
"seo_keywords": [
"RouterOS command tree",
"MikroTik API",
"/console/inspect",
"RAML schema generator",
"OpenAPI generation",
"RouterOS REST API",
"Claude Codex RouterOS",
"Claude Code MikroTik",
"command hierarchy introspection",
"ROS CLI mapping"
],
"actual_capabilities": [
"Explore RouterOS command tree via /console/inspect REST API",
"Map CLI commands to REST verbs (get, add, set, remove)",
"Generate RAML or OpenAPI schemas from command tree structure",
"Understand node types: dir, path, cmd, arg",
"Traverse the hierarchical command structure recursively",
"Handle dangerous paths that crash the REST server"
],
"limitations": [
"Requires authenticated access to RouterOS device",
"Full tree traversal is slow against live routers",
"Tree structure varies by RouterOS version and installed packages",
"Does not execute commands - only introspects structure"
],
"use_cases": [
{
"title": "API Schema Generation",
"description": "Generate OpenAPI or RAML schemas for RouterOS REST API by traversing the command tree and mapping commands to HTTP endpoints.",
"target_user": "API developers building RouterOS integrations"
},
{
"title": "CLI Reference Tool",
"description": "Build command lookup tools that help users find the correct CLI syntax by querying the command tree hierarchy.",
"target_user": "Network administrators working with RouterOS CLI"
},
{
"title": "Documentation Automation",
"description": "Auto-generate API documentation by extracting command structures, argument types, and descriptions from RouterOS.",
"target_user": "Technical writers documenting RouterOS APIs"
}
],
"prompt_templates": [
{
"title": "Find RouterOS command arguments",
"prompt": "What arguments does the /ip/address/add command accept? Use the routeros-command-tree skill to explain the syntax.",
"scenario": "When user needs to know what parameters to pass to a RouterOS command"
},
{
"title": "Map CLI command to REST",
"prompt": "How do I translate 'set address 192.168.1.1 interface=ether1' to a REST API call? Check the routeros-command-tree skill for CLI-to-REST mapping.",
"scenario": "When user wants to convert CLI commands to REST API calls"
},
{
"title": "Generate API schema for a path",
"prompt": "Generate an OpenAPI schema for the /interface/bridge path in RouterOS using the routeros-command-tree documentation.",
"scenario": "When user needs to generate API documentation"
},
{
"title": "Handle dangerous paths",
"prompt": "What paths in RouterOS crash the REST server when queried for syntax? Document how to handle this using the routeros-command-tree skill.",
"scenario": "When user encounters REST server crashes"
}
],
"output_examples": [
{
"input": "Show me the structure of /ip/address",
"output": "The /ip/address path contains commands: add (PUT /rest/ip/address), set (PATCH /rest/ip/address/{id}), remove (DELETE /rest/ip/address/{id}), get (GET /rest/ip/address), print (POST /rest/ip/address/print), export. Arguments for 'add' include: address (IP address), interface (Interface name), disabled (yes|no)."
},
{
"input": "How do I use the /console/inspect API?",
"output": "POST to /rest/console/inspect with JSON body: {request: 'child', path: 'ip,address'} returns children. Use {request: 'syntax', path: 'ip,address,add,address'} to get argument descriptions. Path uses comma-separated segments."
}
],
"best_practices": [
"Use INSPECTFILE environment variable to cache command tree and avoid repeated live queries",
"Skip syntax lookups for arguments inside dangerous subtrees (where, do, else, rule, command, on-error) to prevent REST server crashes",
"Cache inspect.json files per RouterOS version since command trees differ across versions"
],
"anti_patterns": [
"Do not query syntax for arg nodes inside scripting construct subtrees - this crashes the HTTP server",
"Avoid full tree traversal against production routers - use cached inspect.json files instead",
"Do not assume command trees are identical across RouterOS versions"
],
"faq": [
{
"question": "What is the /console/inspect API?",
"answer": "It is a RouterOS REST endpoint that lets you programmatically explore the command hierarchy. POST to /rest/console/inspect with 'child' or 'syntax' requests to list children or get help text."
},
{
"question": "Why are some paths marked as dangerous?",
"answer": "Querying syntax for argument nodes inside scripting construct subtrees (where, do, else, rule, command, on-error) terminates the RouterOS HTTP server process. Always skip these when fetching descriptions."
},
{
"question": "How do I generate an API schema from RouterOS?",
"answer": "Walk the command tree, map cmd nodes to HTTP verbs (add=PUT, set=PATCH, remove=DELETE, get=GET), and use argument descriptions for property documentation. The skill explains the complete mapping."
},
{
"question": "Why is tree traversal slow?",
"answer": "Each node requires a separate HTTP POST to /console/inspect. A full RouterOS tree has thousands of nodes, meaning thousands of sequential HTTP requests."
},
{
"question": "Can I work offline without a live router?",
"answer": "Yes. Set the INSPECTFILE environment variable to point to a cached inspect.json file. The schema generator will use the cached data instead of querying a router."
},
{
"question": "What RouterOS versions are supported?",
"answer": "The /console/inspect API is available on RouterOS 7.x. Command tree structure varies by version and installed packages (container, iot, zerotier, etc.)."
}
]
},
"file_structure": [
{
"name": "SKILL.md",
"type": "file",
"path": "SKILL.md",
"lines": 329
}
]
}
Related skills
FAQ
How is the /console/inspect path formatted?
The path field uses comma-separated segments, e.g. 'ip,address,add', not slashes.
Which subtrees crash the REST server?
Syntax lookups for arg nodes inside where, do, else, rule, command, and on-error subtrees terminate the HTTP server process.