internal/mcp/internal/util: add Wrapf

Add Wrapf, a function that helps with error wrapping.

Change-Id: I102695f75e4d217e09f828f4723cbfcbbe83f887
Reviewed-on: https://go-review.googlesource.com/c/tools/+/679177
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Jonathan Amsterdam 2025-06-09 07:11:18 -04:00
commit d9a7859c3b

View file

@ -26,6 +26,8 @@ import (
"reflect"
"strconv"
"strings"
"github.com/modelcontextprotocol/go-sdk/internal/util"
)
var (
@ -69,7 +71,7 @@ func parseJSONPointer(ptr string) (segments []string, err error) {
// This implementation suffices for JSON Schema: pointers are applied only to Schemas,
// and refer only to Schemas.
func dereferenceJSONPointer(s *Schema, sptr string) (_ *Schema, err error) {
defer wrapf(&err, "JSON Pointer %q", sptr)
defer util.Wrapf(&err, "JSON Pointer %q", sptr)
segments, err := parseJSONPointer(sptr)
if err != nil {