Skip to main content
Glama

updateProfile

Modify your Nostr profile by updating display name, bio, picture, lightning address, or other details. Merges changes with existing profile data.

Instructions

Update an existing Nostr profile (merges with current)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoDisplay name
aboutNoBio / about text
pictureNoProfile picture URL
nip05NoNIP-05 identifier
lud16NoLightning address
bannerNoBanner image URL
websiteNoWebsite URL
privateKeyNoPrivate key (nsec or hex). Optional when NOSTR_BUNKER_URI is configured.
relaysNoRelays to publish to

Implementation Reference

  • The implementation of the `updateProfile` handler, which fetches existing metadata to perform a merge before publishing.
    export async function updateProfile(params: z.infer<typeof updateProfileSchema>) {
      const { privateKey, relays, ...newFields } = params;
    
      // Fetch existing profile to merge
      const pubkey = resolveSigningPubkey(privateKey);
      const existing = await queryEvent(
        { kinds: [KINDS.METADATA], authors: [pubkey], limit: 1 },
        relays ?? DEFAULT_RELAYS,
      );
    
      let mergedFields: Record<string, string | undefined> = {};
      if (existing) {
        try {
          mergedFields = JSON.parse(existing.content);
        } catch {}
      }
    
      for (const [k, v] of Object.entries(newFields)) {
        if (v !== undefined) mergedFields[k] = v;
      }
    
      return buildAndPublishProfile(mergedFields, privateKey, relays);
    }
  • Definition of the Zod schema for the `updateProfile` tool input.
    export const updateProfileSchema = createProfileSchema;
  • src/index.ts:93-95 (registration)
    Registration of the `updateProfile` tool in the MCP server.
    server.tool('updateProfile', 'Update an existing Nostr profile (merges with current)', updateProfileSchema.shape, async (params) => {
      return textResult(await updateProfile(params));
    });

Latest Blog Posts

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/jorgenclaw/nostr-mcp-server'

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