Skip to main content
Glama

list_collections

Retrieve all user collections including personal, common, and external collections for managing NFT assets through the Uranium API.

Instructions

List all user collections (personal, common, and external)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that executes the logic to list collections: fetches user account, lists contracts via API, categorizes into personal/common/external, computes limits, returns structured result.
    export async function listCollections(): Promise<CollectionListResult> {
      try {
        // Get user info first to determine limits and filter contracts
        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 contracts list
        const contractsResponse = await api.contracts.list(null);
    
        if (contractsResponse.status !== "ok") {
          return {
            success: false,
            error: contractsResponse.errorCode || "Failed to load collections",
          };
        }
    
        const contracts = contractsResponse.data || [];
    
        // Group contracts like in Raycast
        const personalContracts = contracts
          .filter((contract) => contract.type !== "EXTERNAL" && userId === contract.userId)
          .map((contract) => ({
            id: contract.id,
            name: contract.name,
            symbol: contract.symbol,
            type: contract.type,
            status: contract.status,
            ercType: contract.ercType,
            assetCount: contract.count ?? 0,
            address: contract.address || undefined,
            createdAt: contract.createdAt ? new Date(contract.createdAt.seconds * 1000).toISOString() : undefined,
          }));
    
        const commonContracts = contracts
          .filter((contract) => contract.type === "EXTERNAL")
          .map((contract) => ({
            id: contract.id,
            name: contract.name,
            symbol: contract.symbol,
            type: contract.type,
            status: contract.status,
            ercType: contract.ercType,
            assetCount: contract.count ?? 0,
            address: contract.address || undefined,
          }));
    
        const externalContracts = contracts
          .filter((contract) => contract.type !== "EXTERNAL" && userId !== contract.userId)
          .map((contract) => ({
            id: contract.id,
            name: contract.name,
            symbol: contract.symbol,
            type: contract.type,
            status: contract.status,
            ercType: contract.ercType,
            assetCount: contract.count ?? 0,
            address: contract.address || undefined,
          }));
    
        return {
          success: true,
          data: {
            personalCollections: personalContracts,
            commonCollections: commonContracts,
            externalCollections: externalContracts,
            limits: {
              personal: {
                current: personalContracts.length,
                max: smartContractsLimit,
                canCreateMore: personalContracts.length < smartContractsLimit,
              },
            },
          },
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : "Unknown error occurred",
        };
      }
    }
  • Input schema for the list_collections tool (no parameters required).
    export const listCollectionsInputSchema = z.object({});
  • TypeScript interface defining the output structure of the listCollections handler.
    export interface CollectionListResult {
      success: boolean;
      data?: {
        personalCollections: Array<{
          id: string;
          name: string;
          symbol: string;
          type: string;
          status: string;
          ercType: string;
          assetCount: number;
          address?: string;
          createdAt?: string;
        }>;
        commonCollections: Array<{
          id: string;
          name: string;
          symbol: string;
          type: string;
          status: string;
          ercType: string;
          assetCount: number;
          address?: string;
        }>;
        externalCollections: Array<{
          id: string;
          name: string;
          symbol: string;
          type: string;
          status: string;
          ercType: string;
          assetCount: number;
          address?: string;
        }>;
        limits: {
          personal: {
            current: number;
            max: number;
            canCreateMore: boolean;
          };
        };
      };
      error?: string;
    }
  • MCP CallToolRequest handler case for 'list_collections': calls the core listCollections function and returns JSON-formatted result as text content.
    case "list_collections": {
      const result = await listCollections();
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Alternative registration function for the tool on MCP server (wraps the handler, checks API key; not used in main server setup).
    export function registerListCollectionsTool(server: McpServer, config?: { apiKey?: string }): void {
      server.tool(
        "list_collections",
        "List all user collections (personal, common, and external)",
        {},
        {
          title: "View Collections",
        },
        async () => {
          if ((!MCP_CONFIG.API_KEY || MCP_CONFIG.API_KEY === "") && config?.apiKey) {
            MCP_CONFIG.API_KEY = config.apiKey;
          }
    
          if (!MCP_CONFIG.API_KEY || MCP_CONFIG.API_KEY === "") {
            return {
              content: [
                {
                  type: "text",
                  text: "API key is required to use this tool.",
                },
              ],
            };
          }
    
          const result = await listCollections();
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        },
      );
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool lists collections but does not describe any behavioral traits such as permissions needed, rate limits, pagination, or output format. The description is minimal and lacks essential context for safe and effective use.

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 that front-loads the core action ('List all user collections') and specifies the scope. There is no wasted language, and it is appropriately sized for a simple listing tool with no parameters.

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 lack of annotations and output schema, the description is incomplete. It does not explain what the return values look like (e.g., format, structure) or any behavioral aspects like error handling. For a tool with no structured fields to rely on, the description should provide more context to be fully helpful.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so the schema fully documents the lack of inputs. The description adds no parameter information, which is appropriate since there are no parameters. A baseline of 4 is applied for tools with zero parameters, as the description need not compensate for missing schema details.

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 ('List') and resource ('user collections'), specifying the scope includes personal, common, and external collections. It distinguishes the tool from siblings like 'create_collection' (creation vs. listing) and 'list_assets' (collections vs. assets), though it doesn't explicitly contrast with 'create_asset'. The purpose is specific but not fully differentiated from all siblings.

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. It does not mention prerequisites, context for usage, or exclusions. While the tool name and description imply it's for listing collections, there is no explicit comparison to sibling tools like 'list_assets' or advice on when to choose one over the other.

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