Skip to main content
Glama

create_subdirectory

Organize downloaded markdown files by creating a new subdirectory in the root folder. Specify the directory name to efficiently structure and manage stored webpage content.

Instructions

Create a new subdirectory in the root download folder

Input Schema

NameRequiredDescriptionDefault
nameYesName of the subdirectory to create

Input Schema (JSON Schema)

{ "properties": { "name": { "description": "Name of the subdirectory to create", "type": "string" } }, "required": [ "name" ], "type": "object" }

Implementation Reference

  • Handler function for the 'create_subdirectory' tool. Validates the input name parameter, retrieves the download directory from config, constructs the full path, creates the subdirectory using fs.ensureDir, and returns a success message or error.
    // Create subdirectory if (request.params.name === 'create_subdirectory') { const subdirectoryName = request.params.arguments?.name; if (!subdirectoryName || typeof subdirectoryName !== 'string') { throw new McpError( ErrorCode.InvalidParams, 'A valid subdirectory name must be provided' ); } try { const config = getConfig(); const newSubdirectoryPath = path.join(config.downloadDirectory, subdirectoryName); // Create the subdirectory await fs.ensureDir(newSubdirectoryPath); return { content: [ { type: 'text', text: `Subdirectory created: ${newSubdirectoryPath}` } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; return { content: [ { type: 'text', text: `Failed to create subdirectory: ${errorMessage}` } ], isError: true }; } }
  • Input schema definition for the 'create_subdirectory' tool, specifying the required 'name' parameter as a string.
    inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the subdirectory to create' } }, required: ['name'] }
  • src/index.ts:167-180 (registration)
    Registration of the 'create_subdirectory' tool in the ListTools response, including name, description, and input schema.
    { name: 'create_subdirectory', description: 'Create a new subdirectory in the root download folder', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the subdirectory to create' } }, required: ['name'] } }

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