@@ -4,7 +4,6 @@ package e2e_test
4
4
5
5
import (
6
6
"context"
7
- "encoding/base64"
8
7
"encoding/json"
9
8
"fmt"
10
9
"net/http"
@@ -508,17 +507,14 @@ func TestFileDeletion(t *testing.T) {
508
507
require .NoError (t , err , "expected to call 'get_file_contents' tool successfully" )
509
508
require .False (t , resp .IsError , fmt .Sprintf ("expected result not to be an error: %+v" , resp ))
510
509
511
- textContent , ok = resp .Content [0 ].(mcp.TextContent )
512
- require .True (t , ok , "expected content to be of type TextContent " )
510
+ embeddedResource , ok : = resp .Content [1 ].(mcp.EmbeddedResource )
511
+ require .True (t , ok , "expected content to be of type EmbeddedResource " )
513
512
514
- var trimmedGetFileText struct {
515
- Content string `json:"content"`
516
- }
517
- err = json .Unmarshal ([]byte (textContent .Text ), & trimmedGetFileText )
518
- require .NoError (t , err , "expected to unmarshal text content successfully" )
519
- b , err := base64 .StdEncoding .DecodeString (trimmedGetFileText .Content )
520
- require .NoError (t , err , "expected to decode base64 content successfully" )
521
- require .Equal (t , fmt .Sprintf ("Created by e2e test %s" , t .Name ()), string (b ), "expected file content to match" )
513
+ // raw api
514
+ textResource , ok := embeddedResource .Resource .(mcp.TextResourceContents )
515
+ require .True (t , ok , "expected embedded resource to be of type TextResourceContents" )
516
+
517
+ require .Equal (t , fmt .Sprintf ("Created by e2e test %s" , t .Name ()), textResource .Text , "expected file content to match" )
522
518
523
519
// Delete the file
524
520
deleteFileRequest := mcp.CallToolRequest {}
@@ -703,17 +699,14 @@ func TestDirectoryDeletion(t *testing.T) {
703
699
require .NoError (t , err , "expected to call 'get_file_contents' tool successfully" )
704
700
require .False (t , resp .IsError , fmt .Sprintf ("expected result not to be an error: %+v" , resp ))
705
701
706
- textContent , ok = resp .Content [0 ].(mcp.TextContent )
707
- require .True (t , ok , "expected content to be of type TextContent " )
702
+ embeddedResource , ok : = resp .Content [1 ].(mcp.EmbeddedResource )
703
+ require .True (t , ok , "expected content to be of type EmbeddedResource " )
708
704
709
- var trimmedGetFileText struct {
710
- Content string `json:"content"`
711
- }
712
- err = json .Unmarshal ([]byte (textContent .Text ), & trimmedGetFileText )
713
- require .NoError (t , err , "expected to unmarshal text content successfully" )
714
- b , err := base64 .StdEncoding .DecodeString (trimmedGetFileText .Content )
715
- require .NoError (t , err , "expected to decode base64 content successfully" )
716
- require .Equal (t , fmt .Sprintf ("Created by e2e test %s" , t .Name ()), string (b ), "expected file content to match" )
705
+ // raw api
706
+ textResource , ok := embeddedResource .Resource .(mcp.TextResourceContents )
707
+ require .True (t , ok , "expected embedded resource to be of type TextResourceContents" )
708
+
709
+ require .Equal (t , fmt .Sprintf ("Created by e2e test %s" , t .Name ()), textResource .Text , "expected file content to match" )
717
710
718
711
// Delete the directory containing the file
719
712
deleteFileRequest := mcp.CallToolRequest {}
0 commit comments