Skip to content

Commit

Permalink
add shared json content
Browse files Browse the repository at this point in the history
  • Loading branch information
strowk committed Dec 13, 2024
1 parent 3d17fbd commit 99fd9cb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions internal/content/json.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package content

import (
"encoding/json"

"github.com/strowk/foxy-contexts/pkg/mcp"
)

func NewJsonContent(v interface{}) (mcp.TextContent, error) {
contents, err := json.Marshal(v)
if err != nil {
return mcp.TextContent{}, err
}
return mcp.TextContent{
Type: "text",
Text: string(contents),
}, nil
}

0 comments on commit 99fd9cb

Please sign in to comment.