Skip to main content
Glama
zhixiaoqiang

Desktop Image Manager MCP Server

list-desktop-images

Retrieve a list of image file names stored on your desktop using the Desktop Image Manager MCP Server to organize and manage image files efficiently.

Instructions

获取桌面上的图片文件名称列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'list-desktop-images' tool. It retrieves image files from the desktop using getDesktopImageFiles(), formats them into a numbered list, and returns as text content. Handles empty list and errors.
    async () => {
      try {
        const imageFiles = await getDesktopImageFiles();
        if (imageFiles.length === 0) {
          return {
            content: [{ type: "text", text: "桌面上没有找到图片文件。" }]
          };
        }
        
        const fileList = imageFiles.map((file, index) => `${index + 1}. ${file}`).join('\n');
        return {
          content: [{ 
            type: "text", 
            text: `桌面上的图片文件列表:\n${fileList}` 
          }]
        };
      } catch (error) {
        return {
          content: [{ 
            type: "text", 
            text: `获取图片列表时出错: ${error instanceof Error ? error.message : String(error)}` 
          }],
          isError: true
        };
      }
    }
  • server.ts:75-105 (registration)
    Registers the 'list-desktop-images' tool with the MCP server, specifying name, Chinese description, empty input schema, and inline handler function.
    server.tool(
      "list-desktop-images",
      "获取桌面上的图片文件名称列表",
      {},
      async () => {
        try {
          const imageFiles = await getDesktopImageFiles();
          if (imageFiles.length === 0) {
            return {
              content: [{ type: "text", text: "桌面上没有找到图片文件。" }]
            };
          }
          
          const fileList = imageFiles.map((file, index) => `${index + 1}. ${file}`).join('\n');
          return {
            content: [{ 
              type: "text", 
              text: `桌面上的图片文件列表:\n${fileList}` 
            }]
          };
        } catch (error) {
          return {
            content: [{ 
              type: "text", 
              text: `获取图片列表时出错: ${error instanceof Error ? error.message : String(error)}` 
            }],
            isError: true
          };
        }
      }
    );
  • Core helper function that reads the desktop directory, filters for image files using isImageFile(), and returns their basenames. Used by both count-desktop-images and list-desktop-images tools.
    const getDesktopImageFiles = async (): Promise<string[]> => {
      const desktopPath = getDesktopPath();
      try {
        const files = await fs.readdir(desktopPath);
        const imagePaths = files.filter(file => {
          const filePath = path.join(desktopPath, file);
          return fs.statSync(filePath).isFile() && isImageFile(filePath);
        });
        return imagePaths;
      } catch (error) {
        console.error(`Error reading desktop directory: ${error}`, );
        return [];
      }
    };
  • Helper function to check if a file path has an image extension. Supports common formats.
    const isImageFile = (filePath: string): boolean => {
      const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp', '.tiff', '.svg'];
      const ext = path.extname(filePath).toLowerCase();
      return imageExtensions.includes(ext);
    };
  • Helper function to get the path to the user's Desktop directory.
    const getDesktopPath = () => {
      const { homedir } = os.userInfo();
      return path.join(homedir, 'Desktop');
    };
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 retrieves a list of image file names, implying a read-only operation, but doesn't specify whether it requires permissions, how it handles errors, what formats are supported, or if there are rate limits. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 in Chinese that directly states the tool's purpose without any fluff or redundancy. It's front-loaded with the core action and resource, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate. It explains what the tool does but lacks details on behavior, usage context, or output format. For a basic read operation, this might suffice, but it could benefit from more completeness regarding how the list is structured or returned.

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 no parameter documentation is needed. The description appropriately doesn't discuss parameters, and baseline for 0 parameters is 4. It adds no extra parameter semantics, but that's acceptable here.

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 ('获取' meaning 'get' or 'retrieve') and resource ('桌面上的图片文件名称列表' meaning 'list of image file names on the desktop'). It's specific about what it returns (file names, not file contents or metadata). However, it doesn't explicitly differentiate from sibling tools like 'count-desktop-images' which might return a count rather than a list.

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 sibling tools like 'compress-image' (for processing) or 'count-desktop-images' (for counting), nor does it specify any prerequisites, exclusions, or contextual factors for usage.

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

Related 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/zhixiaoqiang/desktop-image-manager-mcp'

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