Skip to main content
Glama

protolint-mcp

by yoheimuta
jsonReporter.go1.41 kB
package reporters import ( "encoding/json" "fmt" "io" "os" "github.com/yoheimuta/protolint/linter/report" ) // JSONReporter prints failures as a single JSON struct, allowing // for simple machine-readable output. // // The format is: // // { // "lints": // [ // {"filename": FILENAME, "line": LINE, "column": COL, "message": MESSAGE, "rule": RULE} // ], // } type JSONReporter struct{} type lintJSON struct { Filename string `json:"filename"` Line int `json:"line"` Column int `json:"column"` Message string `json:"message"` Rule string `json:"rule"` Severity string `json:"severity"` } type outJSON struct { Basedir string `json:"basedir"` Lints []lintJSON `json:"lints"` } // Report writes failures to w. func (r JSONReporter) Report(w io.Writer, fs []report.Failure) error { out := outJSON{} // Write base dir pwd, err := os.Getwd() if err != nil { return err } out.Basedir = pwd // Write failures for _, failure := range fs { out.Lints = append(out.Lints, lintJSON{ Filename: failure.Pos().Filename, Line: failure.Pos().Line, Column: failure.Pos().Column, Message: failure.Message(), Rule: failure.RuleID(), Severity: failure.Severity(), }) } bs, err := json.MarshalIndent(out, "", " ") if err != nil { return err } _, err = fmt.Fprintln(w, string(bs)) if err != nil { return err } return nil }

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/yoheimuta/protolint'

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