get_download_directory
Retrieve the configured download directory used by the Markdown Downloader for saving webpages as markdown files, ensuring organized storage of downloaded content.
Instructions
Get the current download directory
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/index.ts:321-331 (handler)Handler for the 'get_download_directory' tool. Retrieves the current download directory from the configuration and returns it as text content.if (request.params.name === 'get_download_directory') { const config = getConfig(); return { content: [ { type: 'text', text: config.downloadDirectory } ] }; }
- src/index.ts:159-166 (registration)Registration of the 'get_download_directory' tool in the listTools response, including name, description, and input schema (no required parameters).{ name: 'get_download_directory', description: 'Get the current download directory', inputSchema: { type: 'object', properties: {} } },
- src/index.ts:162-165 (schema)Input schema for the 'get_download_directory' tool: an empty object (no parameters).inputSchema: { type: 'object', properties: {} }
- src/index.ts:35-57 (helper)getConfig() helper function that loads or initializes the configuration containing the downloadDirectory, with fallback to platform-specific default.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 }; } }
- src/index.ts:25-29 (helper)getDefaultDownloadDir() helper that provides the platform-specific default download directory path.const getDefaultDownloadDir = () => { return process.platform === 'win32' ? path.join(homedir, 'Documents', 'markdown-downloads') : path.join(homedir, '.markdown-downloads'); };