test(album,cabana,pier,surf,admin): add Phase 37 test suites and fail-closed check-phase37.sh gate
This commit is contained in:
519
modules/pier/media_mcp_test.go
Normal file
519
modules/pier/media_mcp_test.go
Normal file
@@ -0,0 +1,519 @@
|
||||
//go:build summercms_mcp
|
||||
|
||||
package pier_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.golem15.com/golem15/summercms/modules/album"
|
||||
"git.golem15.com/golem15/summercms/modules/backpack"
|
||||
"git.golem15.com/golem15/summercms/modules/bouncer"
|
||||
"git.golem15.com/golem15/summercms/modules/cabana"
|
||||
"git.golem15.com/golem15/summercms/modules/compass"
|
||||
"git.golem15.com/golem15/summercms/modules/pact"
|
||||
"git.golem15.com/golem15/summercms/modules/party"
|
||||
"github.com/modelcontextprotocol/go-sdk/mcp"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// mediaBackendGuard implements pact.MCPGuardProvider for the "backend" guard
|
||||
// with real scope-to-permission enforcement (media:read vs media) matching cabana.
|
||||
type mediaBackendGuard struct{}
|
||||
|
||||
func (mediaBackendGuard) MCPGuardName() string { return "backend" }
|
||||
|
||||
func (mediaBackendGuard) MCPTokenGuarded(mw []string) bool {
|
||||
return slices.Contains(mw, "backend")
|
||||
}
|
||||
|
||||
func (mediaBackendGuard) MCPRequirements(perms []string) (pact.MCPRequirements, error) {
|
||||
return pact.MCPRequirements{Permissions: perms}, nil
|
||||
}
|
||||
|
||||
func (mediaBackendGuard) MCPAllows(_ context.Context, subject pact.MCPSubject, _ pact.MCPRequirements, permissions []string) (bool, error) {
|
||||
if slices.Contains(subject.Scopes, "media") {
|
||||
return true, nil
|
||||
}
|
||||
if slices.Contains(subject.Scopes, "media:read") {
|
||||
for _, p := range permissions {
|
||||
if p != cabana.PermissionViewMedia {
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (mediaBackendGuard) MCPDispatch(_ context.Context, subject pact.MCPSubject, _ string) (pact.MCPDispatch, error) {
|
||||
return pact.MCPDispatch{
|
||||
Principal: &bouncer.Principal{
|
||||
ID: subject.UserID,
|
||||
Backend: true,
|
||||
PermissionGrants: map[string]bool{
|
||||
cabana.PermissionViewMedia: true,
|
||||
cabana.PermissionManageMedia: true,
|
||||
},
|
||||
},
|
||||
Guards: []string{"backend"},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// mediaTokenVerifier issues two bearer tokens: one with "media:read" and one with "media".
|
||||
type mediaTokenVerifier struct{}
|
||||
|
||||
func (mediaTokenVerifier) MCPVerifyToken(_ context.Context, raw string) (pact.MCPGrant, error) {
|
||||
switch raw {
|
||||
case "oas_at_media_read":
|
||||
return pact.MCPGrant{
|
||||
Subject: pact.MCPGrantSubjectBackend,
|
||||
BackendUserID: 11,
|
||||
ClientID: "c-read",
|
||||
TokenID: 1,
|
||||
Scopes: []string{"media:read"},
|
||||
ExpiresAt: time.Now().Add(time.Hour),
|
||||
}, nil
|
||||
case "oas_at_media_write":
|
||||
return pact.MCPGrant{
|
||||
Subject: pact.MCPGrantSubjectBackend,
|
||||
BackendUserID: 12,
|
||||
ClientID: "c-write",
|
||||
TokenID: 2,
|
||||
Scopes: []string{"media"},
|
||||
ExpiresAt: time.Now().Add(time.Hour),
|
||||
}, nil
|
||||
default:
|
||||
return pact.MCPGrant{}, pact.ErrMCPTokenInvalid
|
||||
}
|
||||
}
|
||||
|
||||
func (mediaTokenVerifier) MCPResource() string { return "http://acme.test/mcp" }
|
||||
|
||||
// mediaStubRoutesPlugin mounts the /admin/api/v1/media/* routes behind the
|
||||
// "backend" middleware plus raw PUT /media/upload/{token} in memory so
|
||||
// TestMediaMCPTools exercises all 7 media_* tools, signed PUT upload, and the
|
||||
// 5 MB base64 cap end-to-end without requiring Docker.
|
||||
type mediaStubRoutesPlugin struct {
|
||||
mu sync.Mutex
|
||||
nextID uint
|
||||
folders map[uint]map[string]any
|
||||
items map[uint]map[string]any
|
||||
tokens map[string]string // token -> filename
|
||||
baseURL string
|
||||
}
|
||||
|
||||
func newMediaStubRoutesPlugin() *mediaStubRoutesPlugin {
|
||||
return &mediaStubRoutesPlugin{
|
||||
nextID: 1,
|
||||
folders: map[uint]map[string]any{},
|
||||
items: map[uint]map[string]any{},
|
||||
tokens: map[string]string{},
|
||||
}
|
||||
}
|
||||
|
||||
func (*mediaStubRoutesPlugin) ID() string { return "test.media_stub" }
|
||||
func (*mediaStubRoutesPlugin) Requires() []string { return nil }
|
||||
func (*mediaStubRoutesPlugin) Register(*backpack.App) error { return nil }
|
||||
func (*mediaStubRoutesPlugin) Boot(*backpack.App) error { return nil }
|
||||
|
||||
func (*mediaStubRoutesPlugin) Middlewares() map[string]pact.Middleware {
|
||||
return map[string]pact.Middleware{
|
||||
"backend": func(next http.Handler) http.Handler { return next },
|
||||
}
|
||||
}
|
||||
|
||||
func (p *mediaStubRoutesPlugin) Routes(r pact.Router) error {
|
||||
r.Group("/admin/api/v1", []string{"backend"}, func(g pact.Router) {
|
||||
g.Post("/media/folders", p.createFolder)
|
||||
g.Post("/media/uploads/prepare", p.prepareUpload)
|
||||
g.Post("/media/items/base64", p.uploadBase64)
|
||||
g.Get("/media/items", p.listItems)
|
||||
g.Get("/media/items/{id}", p.getItem)
|
||||
g.Put("/media/items/{id}", p.updateItem)
|
||||
g.Delete("/media/items/{id}", p.deleteItem)
|
||||
})
|
||||
r.GroupRaw("/media", nil, func(g pact.Router) {
|
||||
g.Put("/upload/{token}", p.signedUpload)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *mediaStubRoutesPlugin) createFolder(w http.ResponseWriter, r *http.Request) {
|
||||
var req struct {
|
||||
Name string `json:"name"`
|
||||
ParentID *uint `json:"parent_id"`
|
||||
}
|
||||
_ = json.NewDecoder(r.Body).Decode(&req)
|
||||
p.mu.Lock()
|
||||
id := p.nextID
|
||||
p.nextID++
|
||||
f := map[string]any{"id": id, "name": req.Name, "slug": album.SanitizeSlug(req.Name), "parent_id": req.ParentID}
|
||||
p.folders[id] = f
|
||||
p.mu.Unlock()
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{"data": f})
|
||||
}
|
||||
|
||||
func (p *mediaStubRoutesPlugin) prepareUpload(w http.ResponseWriter, r *http.Request) {
|
||||
var req struct {
|
||||
Filename string `json:"filename"`
|
||||
}
|
||||
_ = json.NewDecoder(r.Body).Decode(&req)
|
||||
p.mu.Lock()
|
||||
tok := fmt.Sprintf("tok-%d", p.nextID)
|
||||
p.nextID++
|
||||
p.tokens[tok] = req.Filename
|
||||
base := p.baseURL
|
||||
p.mu.Unlock()
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{
|
||||
"data": map[string]any{
|
||||
"upload_url": base + "/media/upload/" + tok,
|
||||
"method": http.MethodPut,
|
||||
"expires_at": time.Now().Add(5 * time.Minute).UTC().Format(time.RFC3339),
|
||||
"max_bytes": album.DefaultMaxBytes,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (p *mediaStubRoutesPlugin) signedUpload(w http.ResponseWriter, r *http.Request) {
|
||||
tok := r.PathValue("token")
|
||||
p.mu.Lock()
|
||||
filename, ok := p.tokens[tok]
|
||||
if ok {
|
||||
delete(p.tokens, tok)
|
||||
}
|
||||
p.mu.Unlock()
|
||||
if !ok {
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
_, _ = w.Write([]byte(`{"error":"invalid token"}`))
|
||||
return
|
||||
}
|
||||
raw, _ := io.ReadAll(r.Body)
|
||||
p.mu.Lock()
|
||||
id := p.nextID
|
||||
p.nextID++
|
||||
item := map[string]any{
|
||||
"id": id,
|
||||
"file_name": filename,
|
||||
"file_size": len(raw),
|
||||
"url": fmt.Sprintf("/media/abc123456789/%s", filename),
|
||||
"alt": "",
|
||||
}
|
||||
p.items[id] = item
|
||||
p.mu.Unlock()
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{"data": item})
|
||||
}
|
||||
|
||||
func (p *mediaStubRoutesPlugin) uploadBase64(w http.ResponseWriter, r *http.Request) {
|
||||
var req struct {
|
||||
Filename string `json:"filename"`
|
||||
ContentBase64 string `json:"content_base64"`
|
||||
Alt string `json:"alt"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
w.WriteHeader(http.StatusUnprocessableEntity)
|
||||
_, _ = w.Write([]byte(`{"error":{"code":"validation_failed","message":"invalid json"}}`))
|
||||
return
|
||||
}
|
||||
decoded, err := base64.StdEncoding.DecodeString(req.ContentBase64)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusUnprocessableEntity)
|
||||
_, _ = w.Write([]byte(`{"error":{"code":"validation_failed","message":"invalid base64"}}`))
|
||||
return
|
||||
}
|
||||
if int64(len(decoded)) > album.DefaultBase64MaxBytes {
|
||||
w.WriteHeader(http.StatusRequestEntityTooLarge)
|
||||
_, _ = w.Write([]byte(`{"error":{"code":"payload_too_large","message":"file exceeds 5 MB base64 cap"}}`))
|
||||
return
|
||||
}
|
||||
p.mu.Lock()
|
||||
id := p.nextID
|
||||
p.nextID++
|
||||
item := map[string]any{
|
||||
"id": id,
|
||||
"file_name": req.Filename,
|
||||
"file_size": len(decoded),
|
||||
"alt": req.Alt,
|
||||
"url": fmt.Sprintf("/media/def123456789/%s", req.Filename),
|
||||
}
|
||||
p.items[id] = item
|
||||
p.mu.Unlock()
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{"data": item})
|
||||
}
|
||||
|
||||
func (p *mediaStubRoutesPlugin) listItems(w http.ResponseWriter, _ *http.Request) {
|
||||
p.mu.Lock()
|
||||
out := make([]map[string]any, 0, len(p.items))
|
||||
for _, it := range p.items {
|
||||
out = append(out, it)
|
||||
}
|
||||
p.mu.Unlock()
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{"data": out, "meta": map[string]any{"total": len(out)}})
|
||||
}
|
||||
|
||||
func (p *mediaStubRoutesPlugin) getItem(w http.ResponseWriter, r *http.Request) {
|
||||
id, _ := strconv.Atoi(r.PathValue("id"))
|
||||
p.mu.Lock()
|
||||
it, ok := p.items[uint(id)]
|
||||
p.mu.Unlock()
|
||||
if !ok {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
_, _ = w.Write([]byte(`{"error":{"code":"not_found"}}`))
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{"data": it})
|
||||
}
|
||||
|
||||
func (p *mediaStubRoutesPlugin) updateItem(w http.ResponseWriter, r *http.Request) {
|
||||
id, _ := strconv.Atoi(r.PathValue("id"))
|
||||
var req map[string]any
|
||||
_ = json.NewDecoder(r.Body).Decode(&req)
|
||||
p.mu.Lock()
|
||||
it, ok := p.items[uint(id)]
|
||||
if ok {
|
||||
if alt, has := req["alt"].(string); has {
|
||||
it["alt"] = alt
|
||||
}
|
||||
}
|
||||
p.mu.Unlock()
|
||||
if !ok {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{"data": it})
|
||||
}
|
||||
|
||||
func (p *mediaStubRoutesPlugin) deleteItem(w http.ResponseWriter, r *http.Request) {
|
||||
id, _ := strconv.Atoi(r.PathValue("id"))
|
||||
p.mu.Lock()
|
||||
_, ok := p.items[uint(id)]
|
||||
delete(p.items, uint(id))
|
||||
p.mu.Unlock()
|
||||
if !ok {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{"data": map[string]any{"deleted": true}})
|
||||
}
|
||||
|
||||
func callMCPToolJSON(t *testing.T, session *mcp.ClientSession, name string, args map[string]any) (map[string]any, bool) {
|
||||
t.Helper()
|
||||
res, err := session.CallTool(context.Background(), &mcp.CallToolParams{
|
||||
Name: name,
|
||||
Arguments: args,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("CallTool(%s): %v", name, err)
|
||||
}
|
||||
var text string
|
||||
for _, c := range res.Content {
|
||||
if tc, ok := c.(*mcp.TextContent); ok {
|
||||
text += tc.Text
|
||||
}
|
||||
}
|
||||
var out map[string]any
|
||||
_ = json.Unmarshal([]byte(text), &out)
|
||||
return out, res.IsError
|
||||
}
|
||||
|
||||
func TestMediaMCPTools(t *testing.T) {
|
||||
logBuf := captureLogs(t)
|
||||
stub := newMediaStubRoutesPlugin()
|
||||
dir := t.TempDir()
|
||||
for name, body := range map[string]string{
|
||||
"app.yaml": "name: acme\nurl: http://acme.test\n",
|
||||
"http.yaml": "body_limits:\n default_bytes: 10485760\n upload_bytes: 10485760\n",
|
||||
"mcp.yaml": "enabled: false\n",
|
||||
} {
|
||||
if err := os.WriteFile(filepath.Join(dir, name), []byte(body), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
cfg, err := compass.Open(compass.Options{Dir: dir, Environ: []string{"SUMMER_ENV=development"}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
app := backpack.New(cfg)
|
||||
if err := app.Publish[pact.MCPTokenVerifier](mediaTokenVerifier{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
reg := pact.NewMCPGuards()
|
||||
if err := reg.Register(mediaBackendGuard{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := app.Publish(reg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
plugins := []party.Plugin{stub, cabana.MediaMCPPlugin("/admin")}
|
||||
host, err := mountPier(t, app, plugins)
|
||||
if err != nil {
|
||||
t.Fatalf("mountPier: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { _ = host.pier.Close() })
|
||||
|
||||
// Assert zero warnUncoveredBackendWriteTools warnings at boot.
|
||||
if n := countWarningLines(logBuf.String()); n != 0 {
|
||||
t.Fatalf("expected 0 uncovered-write-tool boot warnings, got %d:\n%s", n, logBuf.String())
|
||||
}
|
||||
|
||||
// Serve both MCP endpoints (host) and raw /media/upload/{token} (stub router).
|
||||
uploadHandler, ok := host.r.Handler(http.MethodPut, "/media/upload/{token}")
|
||||
if !ok {
|
||||
t.Fatal("expected PUT /media/upload/{token} on router")
|
||||
}
|
||||
uploadMux := http.NewServeMux()
|
||||
uploadMux.Handle("PUT /media/upload/{token}", uploadHandler)
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if strings.HasPrefix(r.URL.Path, "/media/upload/") {
|
||||
uploadMux.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
host.ServeHTTP(w, r)
|
||||
}))
|
||||
t.Cleanup(srv.Close)
|
||||
stub.baseURL = srv.URL
|
||||
|
||||
// 1. Scope filtering: media:read sees only media_list and media_get.
|
||||
readSession := sdkClient(t, context.Background(), srv.URL+host.path, "oas_at_media_read", clientOpts{})
|
||||
readTools, err := readSession.ListTools(context.Background(), nil)
|
||||
if err != nil {
|
||||
t.Fatalf("ListTools(media:read): %v", err)
|
||||
}
|
||||
var readNames []string
|
||||
for _, tool := range readTools.Tools {
|
||||
readNames = append(readNames, tool.Name)
|
||||
}
|
||||
slices.Sort(readNames)
|
||||
if !slices.Equal(readNames, []string{"media_get", "media_list"}) {
|
||||
t.Fatalf("media:read tools = %v, want [media_get media_list]", readNames)
|
||||
}
|
||||
|
||||
// 2. Scope filtering: media sees all 7 media_* tools.
|
||||
writeSession := sdkClient(t, context.Background(), srv.URL+host.path, "oas_at_media_write", clientOpts{})
|
||||
writeTools, err := writeSession.ListTools(context.Background(), nil)
|
||||
if err != nil {
|
||||
t.Fatalf("ListTools(media): %v", err)
|
||||
}
|
||||
var writeNames []string
|
||||
for _, tool := range writeTools.Tools {
|
||||
writeNames = append(writeNames, tool.Name)
|
||||
}
|
||||
slices.Sort(writeNames)
|
||||
wantAll := []string{
|
||||
"media_create_folder",
|
||||
"media_delete",
|
||||
"media_get",
|
||||
"media_list",
|
||||
"media_prepare_upload",
|
||||
"media_update",
|
||||
"media_upload",
|
||||
}
|
||||
if !slices.Equal(writeNames, wantAll) {
|
||||
t.Fatalf("media tools = %v, want %v", writeNames, wantAll)
|
||||
}
|
||||
|
||||
// 3. media_create_folder
|
||||
folderRes, isErr := callMCPToolJSON(t, writeSession, "media_create_folder", map[string]any{"name": "Editorial"})
|
||||
if isErr {
|
||||
t.Fatalf("media_create_folder error: %v", folderRes)
|
||||
}
|
||||
|
||||
// 4. media_prepare_upload -> HTTP PUT /media/upload/{token} end-to-end
|
||||
prepRes, isErr := callMCPToolJSON(t, writeSession, "media_prepare_upload", map[string]any{"filename": "hero.png"})
|
||||
if isErr {
|
||||
t.Fatalf("media_prepare_upload error: %v", prepRes)
|
||||
}
|
||||
dataMap, _ := prepRes["data"].(map[string]any)
|
||||
uploadURL, _ := dataMap["upload_url"].(string)
|
||||
if !strings.Contains(uploadURL, "/media/upload/") {
|
||||
t.Fatalf("unexpected upload_url: %q", uploadURL)
|
||||
}
|
||||
putReq, err := http.NewRequest(http.MethodPut, uploadURL, bytes.NewReader([]byte("binary-image-bytes")))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
putResp, err := http.DefaultClient.Do(putReq)
|
||||
if err != nil {
|
||||
t.Fatalf("PUT signed upload: %v", err)
|
||||
}
|
||||
_ = putResp.Body.Close()
|
||||
if putResp.StatusCode != http.StatusCreated {
|
||||
t.Fatalf("PUT %s status = %d, want 201", uploadURL, putResp.StatusCode)
|
||||
}
|
||||
// Replay of same signed URL returns 401.
|
||||
putReq2, _ := http.NewRequest(http.MethodPut, uploadURL, bytes.NewReader([]byte("replay")))
|
||||
putResp2, err := http.DefaultClient.Do(putReq2)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_ = putResp2.Body.Close()
|
||||
if putResp2.StatusCode != http.StatusUnauthorized {
|
||||
t.Fatalf("replay PUT status = %d, want 401", putResp2.StatusCode)
|
||||
}
|
||||
|
||||
// 5. media_upload base64: exact 5 MB payload succeeds (proves 8 MiB pier.maxRequestBody).
|
||||
fiveMB := bytes.Repeat([]byte("A"), int(album.DefaultBase64MaxBytes))
|
||||
upRes, isErr := callMCPToolJSON(t, writeSession, "media_upload", map[string]any{
|
||||
"filename": "exact-5mb.pdf",
|
||||
"content_base64": base64.StdEncoding.EncodeToString(fiveMB),
|
||||
"alt": "Five MB",
|
||||
})
|
||||
if isErr {
|
||||
t.Fatalf("5 MB media_upload failed: %v", upRes)
|
||||
}
|
||||
itemData, _ := upRes["data"].(map[string]any)
|
||||
itemID := uint(itemData["id"].(float64))
|
||||
|
||||
// >5 MB decoded payload is rejected.
|
||||
overFiveMB := bytes.Repeat([]byte("B"), int(album.DefaultBase64MaxBytes)+1024)
|
||||
if _, isErr := callMCPToolJSON(t, writeSession, "media_upload", map[string]any{
|
||||
"filename": "over-5mb.pdf",
|
||||
"content_base64": base64.StdEncoding.EncodeToString(overFiveMB),
|
||||
}); !isErr {
|
||||
t.Fatal(">5 MB decoded media_upload must fail")
|
||||
}
|
||||
|
||||
// 6. media_list, media_get, media_update, media_delete
|
||||
listRes, isErr := callMCPToolJSON(t, readSession, "media_list", map[string]any{})
|
||||
if isErr {
|
||||
t.Fatalf("media_list error: %v", listRes)
|
||||
}
|
||||
getRes, isErr := callMCPToolJSON(t, readSession, "media_get", map[string]any{"id": itemID})
|
||||
if isErr {
|
||||
t.Fatalf("media_get error: %v", getRes)
|
||||
}
|
||||
updRes, isErr := callMCPToolJSON(t, writeSession, "media_update", map[string]any{"id": itemID, "alt": "New Alt"})
|
||||
if isErr {
|
||||
t.Fatalf("media_update error: %v", updRes)
|
||||
}
|
||||
delRes, isErr := callMCPToolJSON(t, writeSession, "media_delete", map[string]any{"id": itemID})
|
||||
if isErr {
|
||||
t.Fatalf("media_delete error: %v", delRes)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user