MCP server for FortiManager using Code Mode pattern — 2 tools (search + execute) with QuickJS WASM sandbox
Two tools with substantial documentation but critical schema and parameter definition gaps. Both tools accept arbitrary JavaScript code as input with minimal validation. The 'search' tool has a detailed description (1200+ chars) explaining available globals and examples, but the 'execute' tool description is truncated in the source. Neither tool exposes input schemas in the visible code, parameter definitions are inferred from descriptions rather than formally declared. No output schemas are documented. Error handling is minimal: tools return raw execution results without recovery guidance or error classification. The code-mode pattern itself (arbitrary code execution) is high-risk and lacks safeguards typical of production tools.
Execute FortiManager JSON-RPC API calls via sandboxed JavaScript. Write JavaScript code that calls the FortiManager API. The code runs in a sandboxed environment with access to the `fortimanager` proxy object. All API calls appear synchronous — no `await` needed. Use `var` (not `const`) for variable declarations. ## Available Globals - `fortimanager.request(method, params)` — Send a JSON-RPC request to FortiManager - `method`: `"get" | "set" | "add" | "update" | "delete" | "exec" | "clone" | "move" | "replace"` - `params`: Array of parameter objects, each with at least `url` field - Returns: `{ id, result: [{ status: { code, message }, url, data? }] }` - `status.code`: `0` = success, non-zero = error (e.g., `-6` = invalid URL, `-11` = no permission) - `console.log()` — Captured in output logs ## Parameter Object Fields - `url` (required) — API URL path (e.g., `"/dvmdb/adom"`) - `data` — Request payload for add/set/update/exec - `filter` — Filter expression: `["field", "operator", "value"]` - `fields` — Array of field names to return - `sortings` — Sort order: `[{ "field": 1 }]` (1=asc, -1=desc) - `range` — Pagination: `[start, count]` - `loadsub` — Load sub-tables: `0` or `1` - `option` — Request options: `"count"`, `"object member"`, `"loadsub"`, etc.
Search the FortiManager JSON-RPC API specification. Write JavaScript code that queries the API spec to find URLs, objects, attributes, methods, and error codes. Use `var` (not `const`) for variable declarations. ## Available Globals - `specIndex` — Array of all API objects (lightweight). Each entry: `{ name, type, module, description, urls: string[], methods: string[], attributeNames: string[] }` - `methods` values are like `"get-obj"`, `"get-table"`, `"add"`, `"set"`, `"exec"`, etc. - `module` is the spec module name (e.g., `"sys"`, `"dvmdb"`, `"cli"`, `"pkg76-3645"`) - `getObject(nameOrUrl)` — Get full object details by name (e.g., `"firewall/address"`) or URL path. Returns the complete object with all attributes, or null. - `moduleList` — Array of all modules: `{ name, title, objectCount, methodCount }` - `errorCodes` — Array of all error codes: `{ code, message }` - `specVersion` — API spec version string (e.g., `"7.6"`) - `console.log()` — Captured in output logs ## Return Value Your code's final expression is the result. Use it to return the data you found.
No input schemas visible in source code. Both tools accept a 'code' parameter but no JSON Schema definition is shown.
No output schemas documented. Tools return raw execution results (search returns final expression value; execute returns { id, result: [...] }). LLMs cannot plan downstream calls without knowing response structure.
Arbitrary code execution without input validation or sandboxing guarantees. The 'execute' tool allows any JavaScript code against live FortiManager API. No mention of code review, rate limiting, or permission gates. High security risk.
Error handling is minimal. Tools return raw execution errors without recovery guidance. No error classification (retryable vs fatal). LLMs cannot determine next steps on failure.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 41 | 2026-07-28+ | v2 |
Execute tool description is truncated in source (ends mid-sentence at 'data, '). Full description is incomplete, violating the 10 - 1024 character guideline and leaving parameter documentation unfinished.