From 0235ae5fcc15c05f754d12c32355e80d1ee779f2 Mon Sep 17 00:00:00 2001 From: hzrd149 Date: Thu, 27 Mar 2025 19:05:25 +0000 Subject: [PATCH] handle bech32 encoding in mcp actions --- src/services/mcp/tools/actions.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/services/mcp/tools/actions.ts b/src/services/mcp/tools/actions.ts index 195e64a..487a5d2 100644 --- a/src/services/mcp/tools/actions.ts +++ b/src/services/mcp/tools/actions.ts @@ -2,11 +2,12 @@ import z from "zod"; import server from "../server.js"; import { ownerActions, ownerPublish } from "../../owner.js"; import { FollowUser, UnfollowUser } from "applesauce-actions/actions"; +import { normalizeToHexPubkey } from "../../../helpers/nip19.js"; server.tool( "Follow user", "Adds another users pubkey to the owners following list", - { pubkey: z.string() }, + { pubkey: z.string().transform((hex) => normalizeToHexPubkey(hex, true)) }, async ({ pubkey }) => { try { await ownerActions.exec(FollowUser, pubkey).forEach(ownerPublish); @@ -20,7 +21,7 @@ server.tool( server.tool( "Unfollow user", "Removes another users pubkey from the owners following list", - { pubkey: z.string() }, + { pubkey: z.string().transform((hex) => normalizeToHexPubkey(hex, true)) }, async ({ pubkey }) => { try { await ownerActions.exec(UnfollowUser, pubkey).forEach(ownerPublish);