list_templates
Retrieve available note templates from the TEMPLATE folder to create structured content in Obsidian vaults.
Instructions
TEMPLATEフォルダ内の利用可能なテンプレート一覧を取得します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:81-87 (registration)Registration of the 'list_templates' MCP tool including its name, description, and empty input schemaname: 'list_templates', description: 'TEMPLATEフォルダ内の利用可能なテンプレート一覧を取得します', inputSchema: { type: 'object', properties: {}, }, },
- src/server.ts:270-279 (handler)MCP server dispatch handler for 'list_templates' tool: calls ObsidianHandler.listTemplates() and returns JSON stringified resultcase 'list_templates': const templates = await this.obsidianHandler.listTemplates(); return { content: [ { type: 'text', text: JSON.stringify(templates, null, 2), }, ], };
- src/obsidian-handler.ts:70-72 (handler)ObsidianHandler.listTemplates(): delegates to TemplateEngine.getAvailableTemplates() to list available templatesasync listTemplates() { return await this.templateEngine.getAvailableTemplates(); }
- src/template-engine.ts:9-27 (helper)TemplateEngine.getAvailableTemplates(): core logic to read template directory, find .md files, parse variables and descriptions, return TemplateInfo[]async getAvailableTemplates(): Promise<TemplateInfo[]> { try { const files = await fs.readdir(this.templatesDir); const templates: TemplateInfo[] = []; for (const file of files) { if (file.endsWith('.md')) { const templatePath = path.join(this.templatesDir, file); const content = await fs.readFile(templatePath, 'utf-8'); const templateInfo = this.parseTemplate(file, templatePath, content); templates.push(templateInfo); } } return templates; } catch (error) { throw new Error(`テンプレートディレクトリの読み込みに失敗しました: ${error instanceof Error ? error.message : String(error)}`); } }