Skip to main content
Glama
dazeb

Markdown Downloader

list_downloaded_files

Retrieve a list of downloaded markdown files from the Markdown Downloader MCP server, optionally filtered by subdirectory, for easy file management and organization.

Instructions

List all downloaded markdown files

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subdirectoryNoOptional subdirectory to list files from

Implementation Reference

  • The main handler logic for the 'list_downloaded_files' tool. It retrieves the download directory from config, optionally uses a subdirectory, lists the .md files using fs.readdir, and returns the filenames or an error.
    if (request.params.name === 'list_downloaded_files') {
      try {
        const config = getConfig();
        const subdirectory = request.params.arguments?.subdirectory;
        const listDir = subdirectory && typeof subdirectory === 'string'
          ? path.join(config.downloadDirectory, subdirectory)
          : config.downloadDirectory;
        const files = await fs.readdir(listDir);
        return {
          content: [
            {
              type: 'text',
              text: files.join('\n')
            }
          ]
        };
      } catch (listError) {
        const errorMessage = listError instanceof Error ? listError.message : 'Unknown error';
        return {
          content: [
            {
              type: 'text',
              text: `Failed to list files: ${errorMessage}`
            }
          ],
          isError: true
        };
      }
    }
  • src/index.ts:132-144 (registration)
    Registration of the 'list_downloaded_files' tool in the server's ListTools response, defining its name, description, and input schema.
    {
      name: 'list_downloaded_files',
      description: 'List all downloaded markdown files',
      inputSchema: {
        type: 'object',
        properties: {
          subdirectory: {
            type: 'string',
            description: 'Optional subdirectory to list files from'
          }
        }
      }
    },
  • Helper function getConfig() that loads the download directory configuration, used by the list_downloaded_files handler.
    function getConfig(): MarkdownDownloaderConfig {
      try {
        fs.ensureDirSync(CONFIG_DIR);
        if (!fs.existsSync(CONFIG_FILE)) {
          // Default to platform-specific directory if no config exists
          const defaultDownloadDir = getDefaultDownloadDir();
          const defaultConfig: MarkdownDownloaderConfig = {
            downloadDirectory: defaultDownloadDir
          };
          fs.writeJsonSync(CONFIG_FILE, defaultConfig);
          fs.ensureDirSync(defaultConfig.downloadDirectory);
          return defaultConfig;
        }
        return fs.readJsonSync(CONFIG_FILE);
      } catch (error) {
        console.error('Error reading config:', error);
        // Fallback to default
        const defaultDownloadDir = getDefaultDownloadDir();
        return {
          downloadDirectory: defaultDownloadDir
        };
      }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it's a list operation, implying read-only behavior, but doesn't specify whether it returns metadata like file sizes or timestamps, how it handles errors, or if there are any rate limits. This leaves significant gaps for a tool with no structured safety hints.

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's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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 the list output looks like (e.g., file names, paths, formats) or address potential complexities like pagination or error handling. For a list tool with no structured output, more context is needed.

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 has 100% description coverage, clearly documenting the optional 'subdirectory' parameter. The description adds no additional parameter information beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage without compensating value.

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 ('downloaded markdown files'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_download_directory' which might also provide file-related information, so it doesn't reach the highest score.

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 'get_download_directory' or 'download_markdown'. It doesn't mention prerequisites, exclusions, or specific contexts where this tool is preferred, leaving the agent to infer 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/dazeb/markdown-downloader'

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