Skip to main content
Glama
libra850
by libra850

list_templates

Retrieve available note templates from the TEMPLATE folder to create structured content in Obsidian vaults.

Instructions

TEMPLATEフォルダ内の利用可能なテンプレート一覧を取得します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/server.ts:81-87 (registration)
    Registration of the 'list_templates' MCP tool including its name, description, and empty input schema
      name: 'list_templates',
      description: 'TEMPLATEフォルダ内の利用可能なテンプレート一覧を取得します',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • MCP server dispatch handler for 'list_templates' tool: calls ObsidianHandler.listTemplates() and returns JSON stringified result
    case 'list_templates':
      const templates = await this.obsidianHandler.listTemplates();
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(templates, null, 2),
          },
        ],
      };
  • ObsidianHandler.listTemplates(): delegates to TemplateEngine.getAvailableTemplates() to list available templates
    async listTemplates() {
      return await this.templateEngine.getAvailableTemplates();
    }
  • 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)}`);
      }
    }

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/libra850/obsidian-mcp-server'

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