Skip to main content
Glama

list_artifacts

View all published artifacts in your TOYBOX portfolio to manage and review your GitHub Pages content.

Instructions

List all published artifacts in your TOYBOX

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function for list_artifacts tool that gets active repo, lists artifacts using service, generates URLs and formatted message
    export async function listArtifacts(): Promise<ListArtifactsResult> {
      const configService = new ConfigService();
      
      log.info('Starting artifact listing');
      
      try {
        // Step 1: Get active TOYBOX repository from config
        log.debug('Looking for active TOYBOX repository...');
        log.info('Looking for active TOYBOX repository');
        const activeRepo = await configService.getActiveRepository();
        
        if (!activeRepo) {
          return {
            success: false,
            artifacts: [],
            galleryUrl: '',
            totalCount: 0,
            error: 'No active TOYBOX repository found. Please run initialize_toybox first or set an active repository.',
          };
        }
    
        const localPath = activeRepo.localPath;
        log.info('Using TOYBOX at path', { localPath });
        
        // Update last used timestamp
        await configService.touchRepository(activeRepo.name);
    
        // Step 2: Initialize services
        const artifactService = new ArtifactService(localPath);
    
        // Step 3: List all artifacts
        log.info('Scanning for artifacts');
        const artifactList = await artifactService.listArtifacts();
    
        // Step 4: Generate URLs for each artifact
        const baseUrl = activeRepo.publishedUrl || `https://example.github.io/${activeRepo.name}`;
        
        const artifactsWithUrls = artifactList.map(artifact => ({
          id: artifact.id,
          metadata: artifact.metadata,
          url: artifactService.generateArtifactUrl(artifact.id, baseUrl),
          standaloneUrl: `${baseUrl}/standalone/${artifact.id}`,
        }));
    
        // Step 5: Group by folders if any
        const groupedArtifacts = groupArtifactsByFolder(artifactsWithUrls);
    
        return {
          success: true,
          artifacts: artifactsWithUrls,
          galleryUrl: baseUrl,
          totalCount: artifactsWithUrls.length,
          message: formatArtifactsList(groupedArtifacts, baseUrl),
        };
    
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        
        return {
          success: false,
          artifacts: [],
          galleryUrl: '',
          totalCount: 0,
          error: `Failed to list artifacts: ${errorMessage}`,
        };
      }
    }
  • Output type definition for list_artifacts result
    export interface ListArtifactsResult {
      success: boolean;
      artifacts: Array<{
        id: string;
        metadata: ArtifactMetadata;
        url: string;
        standaloneUrl: string;
      }>;
      galleryUrl: string;
      totalCount: number;
      message?: string;
      error?: string;
    }
  • src/index.ts:159-166 (registration)
    Tool registration in ListToolsRequestHandler, defining name, description, and empty input schema
    {
      name: 'list_artifacts',
      description: 'List all published artifacts in your TOYBOX',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • src/index.ts:251-263 (registration)
    Tool execution handler in CallToolRequestSchema switch statement
    case 'list_artifacts': {
      log.info('Executing list_artifacts');
      const result = await listArtifacts();
      log.info('list_artifacts completed', { artifactCount: result.artifacts?.length || 0 });
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Helper method in ArtifactService that scans the artifacts directory, extracts metadata from .tsx files, and returns sorted list
    async listArtifacts(): Promise<Array<{ id: string; metadata: ArtifactMetadata; filePath: string }>> {
      const artifactsDir = path.join(this.repoPath, 'src', 'artifacts');
      
      if (!await fs.pathExists(artifactsDir)) {
        return [];
      }
      
      const artifactFiles = await glob('*.tsx', { cwd: artifactsDir });
      const artifacts: Array<{ id: string; metadata: ArtifactMetadata; filePath: string }> = [];
      
      for (const file of artifactFiles) {
        const filePath = path.join(artifactsDir, file);
        const artifactId = path.basename(file, '.tsx');
        
        // Skip .gitkeep and other non-artifact files
        if (artifactId.startsWith('.') || artifactId === 'index') {
          continue;
        }
        
        try {
          const metadata = await this.extractMetadata(filePath);
          artifacts.push({
            id: artifactId,
            metadata,
            filePath,
          });
        } catch (error) {
          log.error('Failed to read metadata from file', { file, error });
          // Continue with other files
        }
      }
      
      return artifacts.sort((a, b) => 
        new Date(b.metadata.updatedAt).getTime() - new Date(a.metadata.updatedAt).getTime()
      );
    }
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. It states it lists artifacts but doesn't disclose behavioral traits such as whether this is a read-only operation, if it requires authentication, how results are formatted (e.g., pagination, sorting), or any rate limits. The description is minimal and lacks essential context for safe 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 directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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 doesn't explain what 'published artifacts' entail, the return format, or any behavioral nuances. For a tool with no structured support, more context is needed to ensure proper usage by an AI agent.

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, meaning no parameters are documented in the schema. The description doesn't add parameter details, which is acceptable since there are no parameters to explain. A baseline of 4 is appropriate as it doesn't need to compensate for missing schema information.

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 action ('List') and resource ('all published artifacts in your TOYBOX'), providing a specific verb+resource combination. It doesn't explicitly differentiate from sibling tools like 'publish_artifact' or 'setup_remote', but the scope is clear enough to understand its distinct function.

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 doesn't mention prerequisites (e.g., whether 'initialize_toybox' must be called first), exclusions, or comparisons to other tools like 'update_config' for configuration-related tasks.

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/isnbh0/toybox-mcp-server'

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