@@ -346,16 +346,10 @@ func (s *Server) RemoveTools(names ...string) {
346346func (s * Server ) AddResource (r * Resource , h ResourceHandler ) {
347347 s .changeAndNotify (notificationResourceListChanged , & ResourceListChangedParams {},
348348 func () bool {
349- u , err := url .Parse (r .URI )
349+ _ , err := url .Parse (r .URI )
350350 if err != nil {
351- //panic(err) // url.Parse includes the URI in the error
352- fmt .Fprintf (os .Stderr , "invalid resource URI %q: %v\n " , r .URI , err )
353- } else {
354- if ! u .IsAbs () {
355- //panic(fmt.Errorf("URI %s needs a scheme", r.URI))
356- fmt .Fprintf (os .Stderr , "invalid resource URI %q: %v\n " , r .URI , err )
357- }
358- }
351+ panic (err ) // url.Parse includes the URI in the error
352+ }
359353 s .resources .add (& serverResource {r , h })
360354 return true
361355 })
@@ -378,17 +372,6 @@ func (s *Server) AddResourceTemplate(t *ResourceTemplate, h ResourceHandler) {
378372 if err != nil {
379373 panic (fmt .Errorf ("URI template %q is invalid: %w" , t .URITemplate , err ))
380374 }
381- // Ensure the URI template has a valid scheme
382- u , err := url .Parse (t .URITemplate )
383- if err != nil {
384- //panic(err) // url.Parse includes the URI in the error
385- fmt .Fprintf (os .Stderr , "invalid resource template uri %q: %v\n " , t .URITemplate , err )
386- } else {
387- if ! u .IsAbs () {
388- //panic(fmt.Errorf("URI template %q needs a scheme", t.URITemplate))
389- fmt .Fprintf (os .Stderr , "invalid resource template uri %q: %v\n " , t .URITemplate , err )
390- }
391- }
392375 s .resourceTemplates .add (& serverResourceTemplate {t , h })
393376 return true
394377 })
0 commit comments