Skip to main content
Glama

read_icon

Read an existing .icon bundle to extract its manifest JSON and list of assets. Useful for inspecting icon contents programmatically.

Instructions

Read and inspect an existing .icon bundle. Returns the manifest JSON and list of assets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bundle_pathYesPath to .icon bundle

Implementation Reference

  • src/server.ts:183-191 (registration)
    Registration of the 'read_icon' MCP tool with its schema (bundle_path string) and handler binding to inspectBundle.
    // ── Tool: read_icon ──
    server.tool(
      'read_icon',
      'Read and inspect an existing .icon bundle. Returns the manifest JSON and list of assets.',
      {
        bundle_path: z.string().describe('Path to .icon bundle'),
      },
      async (params) => inspectBundle(params),
    );
  • The inspectBundle handler function that executes the read_icon tool logic. Reads the bundle via readIconBundle and returns formatted manifest + asset list.
    export async function inspectBundle(params: { bundle_path: string }): Promise<McpResult> {
      try {
        const { manifest, assets } = await readIconBundle(params.bundle_path);
        const assetList = Array.from(assets.keys()).map((name) => {
          const buf = assets.get(name)!;
          return `  ${name} (${(buf.length / 1024).toFixed(1)} KB)`;
        });
    
        return {
          content: [{
            type: 'text',
            text: `Manifest:\n${JSON.stringify(manifest, null, 2)}\n\nAssets:\n${assetList.join('\n') || '  (none)'}`,
          }],
        };
      } catch (error: unknown) {
        const msg = error instanceof Error ? error.message : 'Unknown error';
        return {
          content: [{ type: 'text', text: `Error: ${msg}` }],
          isError: true,
        };
      }
    }
  • The readIconBundle helper function that reads an .icon bundle from disk: parses icon.json manifest and loads Assets/ directory into a Map of filename to Buffer.
    export async function readIconBundle(
      bundlePath: string,
      maxAssetBytes: number = DEFAULT_MAX_ASSET_BYTES,
    ): Promise<{
      manifest: IconManifest;
      assets: Map<string, Buffer>;
    }> {
      const manifestPath = path.join(bundlePath, 'icon.json');
      const manifestJson = await fs.readFile(manifestPath, 'utf-8');
    
      // Let SyntaxError propagate naturally
      const parsed: unknown = JSON.parse(manifestJson);
    
      if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
        throw new Error('icon.json does not contain a valid IconManifest object');
      }
    
      const manifest = parsed as IconManifest;
      const assets = new Map<string, Buffer>();
      const assetsPath = path.join(bundlePath, 'Assets');
    
      try {
        const files = await fs.readdir(assetsPath);
        for (const file of files) {
          const filePath = path.join(assetsPath, file);
          const stat = await fs.stat(filePath);
          if (stat.size > maxAssetBytes) {
            const sizeMB = (stat.size / (1024 * 1024)).toFixed(1);
            const limitMB = (maxAssetBytes / (1024 * 1024)).toFixed(1);
            throw new Error(
              `Asset "${file}" exceeds maximum size (${sizeMB} MB > ${limitMB} MB)`,
            );
          }
          const buffer = await fs.readFile(filePath);
          assets.set(file, buffer);
        }
      } catch (err: unknown) {
        if (err instanceof Error && (err as NodeJS.ErrnoException).code === 'ENOENT') {
          // Assets dir doesn't exist — valid state, return empty map
        } else {
          throw err;
        }
      }
    
      return { manifest, assets };
    }
  • Input schema for read_icon: single required string parameter 'bundle_path' describing the path to the .icon bundle.
    {
      bundle_path: z.string().describe('Path to .icon bundle'),
    },
Behavior2/5

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

The description mentions the tool reads and returns data but does not explicitly state it is read-only or non-destructive. Given no annotations, the description should carry the burden of behavioral disclosure, but it lacks details on permissions, side effects, or safety.

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 concise sentence that efficiently conveys the tool's purpose and output, with no unnecessary information.

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

Completeness4/5

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

For a simple read tool with one parameter and no output schema, the description adequately explains functionality and return value. It could be slightly improved by noting the read-only nature, but is largely complete.

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?

The input schema covers 100% of parameters with description for 'bundle_path'. The tool description adds no additional semantic meaning beyond the schema, achieving the baseline score.

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

Purpose5/5

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

The description clearly states the tool reads and inspects an existing .icon bundle, specifying the return of manifest JSON and assets list. This distinguishes it clearly from sibling tools like 'create_icon' or 'add_layer_to_icon'.

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

Usage Guidelines3/5

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

The description implies usage for reading icon bundles but offers no explicit guidance on when to prefer this tool over alternatives like 'export_marketing' or 'export_preview'. No when-not-to-use or alternative tool references are provided.

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/ethbak/icon-composer-mcp'

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