Skip to main content
Glama
emicklei

melrōse musical expression player

by emicklei
inspection.go1.13 kB
package server import ( "encoding/json" "net/http" "github.com/emicklei/melrose/notify" ) func (l *LanguageServer) inspectHandler(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPost { notify.Console.Warnf("HTTP method not allowed:%s", r.Method) w.WriteHeader(http.StatusMethodNotAllowed) return } debug := r.URL.Query().Get("debug") == "true" || notify.IsDebug() if debug { notify.Debugf("service.http: %s", r.URL.String()) } // get token defer r.Body.Close() type tokenHolder struct { Token string } th := new(tokenHolder) if err := json.NewDecoder(r.Body).Decode(th); err != nil { w.WriteHeader(http.StatusBadRequest) return } if debug { notify.Debugf("http.request.body %#v", th) } type markdownHolder struct { MarkdownString string } w.Header().Set("content-type", "application/json") enc := json.NewEncoder(w) msg := l.service.CommandHover(th.Token) err := enc.Encode(markdownHolder{MarkdownString: msg}) if debug { notify.Debugf("service.http.response.MarkdownString: %s", msg) } if err != nil { notify.Console.Errorf("inspect failed:%v\n", err) } }

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/emicklei/melrose'

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