diff --git a/modules/json/json.go b/modules/json/json.go index d053f91cf7..26942cd2b6 100644 --- a/modules/json/json.go +++ b/modules/json/json.go @@ -109,3 +109,7 @@ func UnmarshalHandleDoubleEncode(bs []byte, v any) error { } return err } + +// RawMessage is a raw encoded JSON value. +// It implements Marshaler and Unmarshaler and can be used to delay JSON decoding. +type RawMessage = json.RawMessage diff --git a/routers/api/v2/mcp.go b/routers/api/v2/mcp.go index 9b0622b367..6093d45764 100644 --- a/routers/api/v2/mcp.go +++ b/routers/api/v2/mcp.go @@ -22,16 +22,13 @@ import ( "code.gitea.io/gitea/services/context" ) -// RawMessage is a raw encoded JSON value (equivalent to encoding/json.RawMessage) -type RawMessage []byte - // MCP Protocol Types (JSON-RPC 2.0) type MCPRequest struct { - JSONRPC string `json:"jsonrpc"` - ID any `json:"id"` - Method string `json:"method"` - Params RawMessage `json:"params,omitempty"` + JSONRPC string `json:"jsonrpc"` + ID any `json:"id"` + Method string `json:"method"` + Params json.RawMessage `json:"params,omitempty"` } type MCPResponse struct {