Skip to main content
Glama
sarif.ts1.26 kB
import type { Finding } from '../types.js'; export function toSarif(findings: Finding[], opts?: { toolName?: string; version?: string }) { const toolName = opts?.toolName ?? 'risk-audit'; return { version: '2.1.0', $schema: 'https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json', runs: [ { tool: { driver: { name: toolName, informationUri: 'https://github.com/', rules: [] } }, results: findings.map((f) => ({ ruleId: f.ruleId, level: f.severity === 'critical' ? 'error' : f.severity === 'medium' ? 'warning' : 'note', message: { text: `${f.message}${f.fix ? `\nFix: ${f.fix}` : ''}` }, locations: f.file ? [ { physicalLocation: { artifactLocation: { uri: f.file }, region: { startLine: f.range.start.line, startColumn: f.range.start.column, endLine: f.range.end.line, endColumn: f.range.end.column } } } ] : [] })) } ] }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rachellarralde/risk-audit-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server