Skip to main content
Glama

create_collection

Create a new NFT collection on the Uranium MCP Server by specifying name, symbol, and type (ERC721 or ERC1155) for managing digital assets.

Instructions

Create a new NFT collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesCollection name (3-30 characters, letters, numbers, and [_.-] symbols)
symbolYesCollection symbol (3-30 characters, letters, numbers, and underscores)
typeYesCollection type: ERC721 (single NFTs) or ERC1155 (multi-token)

Implementation Reference

  • The exported async createCollection function that implements the core tool logic: input validation, user account and limit checks, listing existing collections, API call to create new collection, result formatting, and comprehensive error handling.
    export async function createCollection(
      params: z.infer<typeof createCollectionInputSchema>,
    ): Promise<CreateCollectionResult> {
      try {
        // First validate input using our schema
        const validatedParams = createCollectionInputSchema.parse(params);
    
        // Get user info to check limits
        const accountResponse = await api.account.getMe({
          deviceId: MCP_CONFIG.DEVICE_ID,
        });
    
        if (accountResponse.status !== "ok" || !accountResponse.ok) {
          return {
            success: false,
            error: "Failed to get user account information",
          };
        }
    
        const user = accountResponse.ok;
        const isAdmin = user.role === "ADMIN";
        const userId = user.userId;
        const smartContractsLimit = isAdmin ? SMART_CONTRACTS_ADMIN_LIMIT : SMART_CONTRACTS_USER_LIMIT;
    
        // Get existing contracts to check limits
        const contractsResponse = await api.contracts.list(null);
    
        if (contractsResponse.status !== "ok") {
          return {
            success: false,
            error: "Failed to check existing collections",
          };
        }
    
        const contracts = contractsResponse.data || [];
        const personalContracts = contracts.filter(
          (contract) => contract.type !== "EXTERNAL" && userId === contract.userId,
        );
    
        // Check if user can create more contracts
        if (personalContracts.length >= smartContractsLimit) {
          return {
            success: false,
            error: `You have reached the limit of ${smartContractsLimit} collections`,
          };
        }
    
        // Create the contract
        const createResponse = await api.contracts.create({
          name: validatedParams.name,
          symbol: validatedParams.symbol,
          type: validatedParams.type,
        });
    
        if (createResponse.status !== "ok" || !createResponse.data) {
          return {
            success: false,
            error: createResponse.errorCode || "Failed to create collection",
          };
        }
    
        const createdContract = createResponse.data;
    
        return {
          success: true,
          data: {
            collection: {
              id: createdContract.id,
              name: createdContract.name,
              symbol: createdContract.symbol,
              type: createdContract.type,
              status: createdContract.status,
              ercType: createdContract.ercType,
              address: createdContract.address || undefined,
              createdAt: createdContract.createdAt
                ? new Date(createdContract.createdAt.seconds * 1000).toISOString()
                : undefined,
            },
            message: `Collection "${createdContract.name}" created successfully!`,
          },
        };
      } catch (error) {
        if (error instanceof z.ZodError) {
          const errorMessages = error.issues.map((err) => err.message).join(", ");
          return {
            success: false,
            error: `Validation error: ${errorMessages}`,
          };
        }
    
        return {
          success: false,
          error: error instanceof Error ? error.message : "Unknown error occurred",
        };
      }
    }
  • Zod input schema for creating smart contracts/collections, defining validated fields: name (regex), symbol (regex), type (ERC721|ERC1155). Reused as createCollectionInputSchema.
    export const createSmartContractSchema = z.object({
      name: z
        .string()
        .regex(
          smartContractNameRegex,
          "Name must be between 3 and 30 characters long and can contain only letters, numbers and [_.-] symbols",
        ),
      symbol: z
        .string()
        .regex(
          smartContractSymbolRegex,
          "Identifier must be between 3 and 30 characters long and can contain only letters, numbers and underscores",
        ),
      type: z.enum(["ERC721", "ERC1155"]),
    });
  • src/server.ts:63-75 (registration)
    Switch case in the MCP CallToolRequest handler that registers 'create_collection': parses args with input schema, calls createCollection handler, returns result as JSON text content.
    case "create_collection": {
      // Validate and parse arguments
      const validatedArgs = createCollectionInputSchema.parse(args);
      const result = await createCollection(validatedArgs);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • TypeScript interface for the tool's output: CreateCollectionResult with success flag, data (collection details), optional error.
    export interface CreateCollectionResult {
      success: boolean;
      data?: {
        collection: {
          id: string;
          name: string;
          symbol: string;
          type: string;
          status: string;
          ercType: string;
          address?: string;
          createdAt?: string;
        };
        message: string;
      };
      error?: string;
    }
  • Exports the input schema for the tool by aliasing createSmartContractSchema.
    export const createCollectionInputSchema = createSmartContractSchema;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'Create' implies a write/mutation operation, but fails to mention permissions, costs, network effects, or response behavior. This is a significant gap for a creation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's appropriately sized and front-loaded, clearly stating the core action without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of creating an NFT collection (a write operation with potential costs and permissions), no annotations, and no output schema, the description is incomplete. It lacks critical behavioral and contextual details needed for safe and effective tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all three parameters. The description adds no additional parameter semantics beyond what's in the schema, meeting the baseline for high coverage but not enhancing understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Create') and resource ('new NFT collection'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'create_asset' or 'list_collections' beyond the resource type, so it's not fully specific to sibling context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'create_asset' or 'list_collections'. It lacks context about prerequisites, typical scenarios, or exclusions, leaving the agent with minimal usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/xkelxmc/uranium-mcp'

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