Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
avatar.go1.27 kB
package avatar import ( "context" "image/png" "io" "path" "github.com/Southclaws/fault" "github.com/Southclaws/fault/fctx" "github.com/Southclaws/storyden/app/resources/account" ) func avatarPath(aid account.AccountID) string { return path.Join("avatar", aid.String()) } func (s *service) Exists(ctx context.Context, accountID account.AccountID) bool { exists, err := s.storage.Exists(ctx, avatarPath(accountID)) if err != nil { return false // errors are ignored for now 🤠 } return exists } func (s *service) Set(ctx context.Context, accountID account.AccountID, stream io.Reader, size int64) error { if err := s.storage.Write(ctx, avatarPath(accountID), stream, size); err != nil { return fault.Wrap(err, fctx.With(ctx)) } return nil } func (s *service) Get(ctx context.Context, accountID account.AccountID) (io.Reader, int64, error) { stream, size, err := s.storage.Read(ctx, avatarPath(accountID)) if err != nil { r, w := io.Pipe() go func() { defer r.Close() i, err := s.generator.Generate(ctx, accountID.String()) if err != nil { r.CloseWithError(err) return } if err := png.Encode(w, i); err != nil { r.CloseWithError(err) return } }() return r, 0, nil } return stream, size, nil }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server