Skip to main content
Glama
list-folders.ts955 B
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { NotesCache } from "../cache"; export function registerListFoldersTool(server: McpServer, cache: NotesCache): void { server.tool("list_folders", "列出所有文件夹", async () => { const folders = cache .getFolders() .sort((a, b) => b.modifyDate - a.modifyDate); if (folders.length === 0) { return { content: [ { type: "text" as const, text: "暂无文件夹。", }, ], }; } const lines = folders.map((folder, index) => { const modified = new Date(folder.modifyDate).toISOString(); const subject = folder.subject || "(未命名)"; return `${index + 1}. [${folder.id}] ${subject} (${modified})`; }); return { content: [ { type: "text" as const, text: lines.join("\n"), }, ], }; }); }

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/LaelLuo/mi_note_mcp'

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