Skip to content

Constants

The @contextvm/sdk exports a set of constants that are used throughout the library for event kinds, tags, and other protocol-specific values. These constants ensure consistency and alignment with the ContextVM specification.

The ContextVM protocol defines several Nostr event kinds for different types of messages.

ConstantKindDescription
CTXVM_MESSAGES_KIND25910The kind for standard, ephemeral ContextVM messages.
GIFT_WRAP_KIND1059The kind for encrypted messages, wrapped using the NIP-59 gift wrap standard.
SERVER_ANNOUNCEMENT_KIND11316A replaceable event for announcing a server’s presence and basic info.
TOOLS_LIST_KIND11317A replaceable event for listing a server’s available tools.
RESOURCES_LIST_KIND11318A replaceable event for listing a server’s available resources.
RESOURCETEMPLATES_LIST_KIND11319A replaceable event for listing a server’s available resource templates.
PROMPTS_LIST_KIND11320A replaceable event for listing a server’s available prompts.

The SDK defines an object NOSTR_TAGS that contains constants for the various Nostr event tags used in the ContextVM protocol.

KeyTagDescription
PUBKEYpThe public key of the message recipient.
EVENT_IDeThe event ID used to correlate requests and responses.
CAPABILITYcapA tag for specifying pricing metadata for a tool, resource, or prompt.
NAMEnameThe human-readable name of a server in an announcement.
WEBSITEwebsiteThe URL of a server’s website in an announcement.
PICTUREpictureThe URL of a server’s icon in an announcement.
SUPPORT_ENCRYPTIONsupport_encryptionA tag indicating that a server supports end-to-end encryption.

The announcementMethods object maps capability types to their corresponding MCP method names for server announcements.

export const announcementMethods = {
server: "initialize",
tools: "tools/list",
resources: "resources/list",
resourceTemplates: "resources/templates/list",
prompts: "prompts/list",
} as const;

This object is used internally by the NostrServerTransport to construct announcement events.

With a solid understanding of the core modules, you are now ready to explore the Transports, which are responsible for all network communication in the SDK.