fix(mcp): map tool-not-found to CodeNotFound via registry sentinel
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -90,7 +90,7 @@ func (s *Server) handlePOST(w http.ResponseWriter, r *http.Request) {
|
||||
out, err := s.opts.Registry.Dispatch(r.Context(), p.Name, p.Arguments)
|
||||
if err != nil {
|
||||
code := -32000
|
||||
if errors.Is(err, ErrToolNotFound) {
|
||||
if errors.Is(err, registry.ErrToolNotFound) {
|
||||
code = CodeNotFound
|
||||
}
|
||||
writeJSON(w, http.StatusOK,
|
||||
@@ -125,8 +125,6 @@ func (s *Server) handleGET(w http.ResponseWriter, r *http.Request) {
|
||||
<-r.Context().Done()
|
||||
}
|
||||
|
||||
var ErrToolNotFound = errors.New("tool not found")
|
||||
|
||||
func writeJSON(w http.ResponseWriter, status int, v any) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(status)
|
||||
|
||||
Reference in New Issue
Block a user