|
| 1 | +{ |
| 2 | + "openrpc": "1.0.0", |
| 3 | + "info": { |
| 4 | + "title": "Language Analyzer", |
| 5 | + "version": "1.0.0", |
| 6 | + "description": "Performs on-demand analysis of a single file using a saved analysis context." |
| 7 | + }, |
| 8 | + "methods": [ |
| 9 | + { |
| 10 | + "name": "analyze_file", |
| 11 | + "summary": "Analyze a file using a stored analysis context.", |
| 12 | + "description": "Performs analysis on the provided file content, leveraging the context identified by contextId. Returns issues and potential analysis problems.", |
| 13 | + "params": [ |
| 14 | + { |
| 15 | + "name": "contextId", |
| 16 | + "description": "The unique ID of the analysis context to use.", |
| 17 | + "required": true, |
| 18 | + "schema": { |
| 19 | + "type": "string" |
| 20 | + } |
| 21 | + }, |
| 22 | + { |
| 23 | + "name": "filename", |
| 24 | + "description": "The name of the file being analyzed.", |
| 25 | + "required": true, |
| 26 | + "schema": { |
| 27 | + "type": "string" |
| 28 | + } |
| 29 | + }, |
| 30 | + { |
| 31 | + "name": "fileContent", |
| 32 | + "description": "The full content of the file to analyze.", |
| 33 | + "required": true, |
| 34 | + "schema": { |
| 35 | + "type": "string" |
| 36 | + } |
| 37 | + }, |
| 38 | + { |
| 39 | + "name": "activeRules", |
| 40 | + "description": "A list of rule keys (e.g., 'java:S1172') to activate for the analysis.", |
| 41 | + "required": true, |
| 42 | + "schema": { |
| 43 | + "type": "array", |
| 44 | + "items": { |
| 45 | + "type": "string" |
| 46 | + } |
| 47 | + } |
| 48 | + } |
| 49 | + ], |
| 50 | + "result": { |
| 51 | + "name": "AnalysisResult", |
| 52 | + "description": "The results of the file analysis, including issues", |
| 53 | + "schema": { |
| 54 | + "title": "AnalysisResult", |
| 55 | + "type": "object", |
| 56 | + "properties": { |
| 57 | + "issues": { |
| 58 | + "type": "array", |
| 59 | + "description": "A list of issues (code smells, bugs, vulnerabilities) found.", |
| 60 | + "items": { |
| 61 | + "$ref": "#/components/schemas/Issue" |
| 62 | + } |
| 63 | + }, |
| 64 | + "analysisProblems": { |
| 65 | + "type": "array", |
| 66 | + "description": "High-level problems encountered during analysis (e.g., missing dependencies, configuration issues).", |
| 67 | + "items": { |
| 68 | + "type": "string" |
| 69 | + } |
| 70 | + } |
| 71 | + }, |
| 72 | + "required": ["issues", "analysisProblems"] |
| 73 | + } |
| 74 | + }, |
| 75 | + "errors": [ |
| 76 | + { |
| 77 | + "$ref": "#/components/errors/ContextNotFound" |
| 78 | + }, |
| 79 | + { |
| 80 | + "$ref": "#/components/errors/InvalidParameters" |
| 81 | + } |
| 82 | + ] |
| 83 | + } |
| 84 | + ], |
| 85 | + "components": { |
| 86 | + "schemas": { |
| 87 | + "TextRange": { |
| 88 | + "type": "object", |
| 89 | + "properties": { |
| 90 | + "startLine": { |
| 91 | + "type": "integer", |
| 92 | + "description": "The starting line number (1-indexed)." |
| 93 | + }, |
| 94 | + "endLine": { |
| 95 | + "type": "integer", |
| 96 | + "description": "The ending line number (1-indexed)." |
| 97 | + }, |
| 98 | + "startOffset": { |
| 99 | + "type": "integer", |
| 100 | + "description": "The starting character offset from the beginning of the file (0-indexed)." |
| 101 | + }, |
| 102 | + "endOffset": { |
| 103 | + "type": "integer", |
| 104 | + "description": "The ending character offset from the beginning of the file (0-indexed)." |
| 105 | + } |
| 106 | + } |
| 107 | + }, |
| 108 | + "FlowLocation": { |
| 109 | + "type": "object", |
| 110 | + "properties": { |
| 111 | + "textRange": { |
| 112 | + "$ref": "#/components/schemas/TextRange" |
| 113 | + }, |
| 114 | + "message": { |
| 115 | + "type": "string", |
| 116 | + "description": "A description of the step in the flow." |
| 117 | + }, |
| 118 | + "file": { |
| 119 | + "type": "string", |
| 120 | + "description": "The file path where this flow location exists." |
| 121 | + } |
| 122 | + } |
| 123 | + }, |
| 124 | + "Flow": { |
| 125 | + "type": "object", |
| 126 | + "properties": { |
| 127 | + "locations": { |
| 128 | + "type": "array", |
| 129 | + "description": "Ordered steps of the data/control flow.", |
| 130 | + "items": { |
| 131 | + "$ref": "#/components/schemas/FlowLocation" |
| 132 | + } |
| 133 | + } |
| 134 | + } |
| 135 | + }, |
| 136 | + "Issue": { |
| 137 | + "type": "object", |
| 138 | + "description": "A single analysis finding.", |
| 139 | + "properties": { |
| 140 | + "id": { |
| 141 | + "type": "string", |
| 142 | + "description": "Unique ID of the issue." |
| 143 | + }, |
| 144 | + "filePath": { |
| 145 | + "type": "string", |
| 146 | + "description": "The path to the file containing the issue." |
| 147 | + }, |
| 148 | + "message": { |
| 149 | + "type": "string", |
| 150 | + "description": "The descriptive message of the issue." |
| 151 | + }, |
| 152 | + "rule": { |
| 153 | + "type": "string", |
| 154 | + "description": "The key of the rule that raised this issue." |
| 155 | + }, |
| 156 | + "textRange": { |
| 157 | + "$ref": "#/components/schemas/TextRange" |
| 158 | + }, |
| 159 | + "flows": { |
| 160 | + "type": "array", |
| 161 | + "description": "Optional list of data/control flow paths for security issues.", |
| 162 | + "items": { |
| 163 | + "$ref": "#/components/schemas/Flow" |
| 164 | + } |
| 165 | + } |
| 166 | + }, |
| 167 | + "required": ["filePath", "message", "rule", "textRange"] |
| 168 | + } |
| 169 | + }, |
| 170 | + "errors": { |
| 171 | + "ContextNotFound": { |
| 172 | + "code": -32001, |
| 173 | + "message": "Context Not Found", |
| 174 | + "data": { |
| 175 | + "type": "object", |
| 176 | + "properties": { |
| 177 | + "contextId": { |
| 178 | + "type": "string", |
| 179 | + "description": "The context ID that could not be found." |
| 180 | + } |
| 181 | + } |
| 182 | + } |
| 183 | + }, |
| 184 | + "InvalidParameters": { |
| 185 | + "code": -32602, |
| 186 | + "message": "Invalid Parameters", |
| 187 | + "data": { |
| 188 | + "type": "object", |
| 189 | + "properties": { |
| 190 | + "details": { |
| 191 | + "type": "string", |
| 192 | + "description": "Details about which parameter was invalid." |
| 193 | + } |
| 194 | + } |
| 195 | + } |
| 196 | + } |
| 197 | + } |
| 198 | + } |
| 199 | +} |
0 commit comments