manage_key_nft
The management tool (dapp/app/lib/mcp/tools/keynft-manage.ts) uses the AI signer (configured via AI_PRIVATE_KEY) to interact with the OnePerWalletKeyToken contract.
Capabilities
- query — Re-queries the signer address, returning whether a token exists plus its color palette.
- burn — Destroys the existing token if present.
- mint — Burns any existing token, then mints a fresh one and returns the new token/colors.
Underlying helpers:
getOwnedToken— CallsgetTokenOfOwner(or the legacytokensOfOwner) to fetch the current token.getTokenColors— Reads palette metadata.buildExplorerUrl— UsesgetChainConfig()explorer URLs for user-friendly links in the JSON payload.getSignerClients— Creates viem wallet/public clients pointed at whichever chain the dapp is running on.
// dapp/app/lib/mcp/tools/keynft-manage.ts
const tool: Tool<Params> = {
name: 'manage_key_nft',
requiresJwt: true,
inputSchema: InputSchema,
async handler({ action }) {
const { account, walletClient, publicClient } = await getSignerClients();
const timeline: TimelineEvent[] = [];
const ownership = await getOwnedToken(account.address);
if (action === 'query') return formatQuery(ownership, timeline);
if (action === 'burn') return ownership.hasToken ? burnToken(ownership.tokenId!, timeline, walletClient, publicClient) : noTokenResponse();
if (action === 'mint') return mintNewToken(ownership, timeline, walletClient, publicClient);
fail('Unsupported action');
},
};Presenter Summary
dapp/components/chatBot/ToolActivity/catalog/presenters/keynft_manage.presenter.ts keeps the chip narrative in sync with the timeline:
- Pending labels distinguish
Querying,Burning, orMinting. - Success chips reuse the tool’s own text stream when present, otherwise they construct a short sentence (e.g., “Minted #123 (bg #112233, key #ffee00)”).
- Timeline events are compressed into a
message → message → messagesummary so the user sees progress without exposing tx hashes.
Notes
⚠️
Like the send-crypto tools, manage_key_nft is JWT-gated. If the AI private key is missing, the handler calls fail('... AI_PRIVATE_KEY not configured.'), so deployments must set that secret even on local RitoNet if they want to demo burning/minting.