Analyze code
analyzeRuns the open-source hefesto-ai engine (hefesto analyze --no-config, free tier) on the files you send to the hosted analyzer and returns its findings: rule id, severity, file, line, message and the SARIF hefestoFingerprint/v1 fingerprint (format "sarif" adds the full SARIF 2.1.0 log). Use it to check a file or snippet the user shares (for example "analyze this file") for security and quality issues before committing. Try it: {"code":"password = "Sup3rS3cret!2026""} returns a HARDCODED_SECRET finding. Minimum call: {"code": ""}. Add path (e.g. "app/run.py") so the language comes from the extension; without path or language the language is inferred from the content, else python. For several files send files=[{"path", "content"}] instead. severity and format are optional. Covers Python, COBOL, the DevOps/IaC formats hefesto analyze routes, and TypeScript, JavaScript, Java, Go, Rust and C# through the multilang tree-sitter grammars (the first such request on a fresh server instance downloads the grammars and can take a few seconds longer). Limits: 20 files, 100 KB per file, 256 KB in total, 20 seconds, 10 requests per minute per IP, shared across server instances. No .hefesto.yaml is read. Files are deleted after the run; nothing is stored. For a whole repository, run hefesto analyze . locally.
Example tool call
This call uses example arguments supplied in the tool’s input schema.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "import sqlite3\n\npassword = \"Sup3rS3cret!2026\"\n\n\ndef find_user(db, name):\n return db.execute(\"SELECT * FROM users WHERE name = '\" + name + \"'\")\n"
},
"name": "analyze"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Contents of one file or snippet, used when files is omitted. At most 100 KB. This is the only argument a first call needs. | |
| path | No | Optional file name for code, e.g. "app/run.py" or "Dockerfile". The extension picks the language. Same rules as files[].path. Ignored when files is set. | |
| files | No | Several files to analyze. Used instead of code when present. path: relative POSIX, at most 200 characters and 8 levels; each segment is letters, digits, "_", "." or "-" and must not start with "-"; no "..", no absolute paths, no ".git" or ".hefesto.yaml". content: UTF-8 text, no NUL bytes, at most 100 KB. | |
| format | No | Optional. json (default): findings only; sarif: also the full SARIF 2.1.0 log. | |
| language | No | Optional language of code. Ignored when files or path is set. When omitted it is inferred from the content (python if unsure). An unknown language is rejected; send path or files instead. | |
| severity | No | Optional minimum severity to report (default LOW). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | true when the engine returned analyzed: true. | |
| error | No | Failure code when ok is false. invalid_json when the analyzer body was not JSON. | |
| message | No | Same string as content[0].text when ok is false. | |
| analysis | No | Analyzer JSON. The content text is a one-line summary plus this object. |