check_compliance
Verify code files against security standards like OWASP and CWE to ensure compliance with established security requirements.
Instructions
Check code compliance with security standards (simplified)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"files": "<files>"
},
"name": "check_compliance"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | File paths to check | |
| standard | No | Compliance standard | general |
Implementation Reference
- src/tools/code-analysis.ts:115-133 (handler)The core handler logic for the 'check_compliance' tool. It processes input files, scans them for security issues using SecurityAnalyzer, and returns a formatted compliance report indicating compliance status and issue details.
case 'check_compliance': { const files = params.files as string[]; const standard = (params.standard as string) || 'general'; const codeFiles = await FileReader.readFiles(files.join(',')); const issues = await securityAnalyzer.scanSecurityIssues(codeFiles); return { standard, compliant: issues.length === 0, totalIssues: issues.length, issues: issues.map((issue) => ({ type: issue.type, severity: issue.severity, location: issue.location, description: issue.description, recommendation: issue.recommendation, })), }; } - src/tools/code-analysis.ts:51-71 (schema)Tool definition including name, description, and input schema specification for validating tool arguments (files array required, optional standard).
{ name: 'check_compliance', description: 'Check code compliance with security standards (simplified)', inputSchema: { type: 'object', properties: { files: { type: 'array', items: { type: 'string' }, description: 'File paths to check', }, standard: { type: 'string', enum: ['owasp', 'cwe', 'general'], description: 'Compliance standard', default: 'general', }, }, required: ['files'], }, }, - src/server.ts:18-25 (registration)Registers the check_compliance tool (via inclusion in codeAnalysisTools) in the complete list of tools returned by the MCP ListTools handler.
const allTools = [ ...codeAnalysisTools, ...codeQualityTools, ...dependencyAnalysisTools, ...lintingTools, ...webScrapingTools, ...apiDiscoveryTools, ]; - src/server.ts:62-64 (registration)Routes tool calls for check_compliance (detected via codeAnalysisTools membership) to the specific handleCodeAnalysisTool dispatcher.
if (codeAnalysisTools.some((t) => t.name === name)) { result = await handleCodeAnalysisTool(name, args || {}); } else if (codeQualityTools.some((t) => t.name === name)) {