import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { NotesCache } from "../cache";
export function registerNotesListResource(server: McpServer, cache: NotesCache): void {
server.registerResource(
"notes",
"minote://notes",
{
title: "全部笔记",
description: "列出所有小米笔记的基础信息",
mimeType: "text/plain",
},
async () => {
const items = cache.getNotesListItems().map((item, index) => {
const modify = new Date(item.modifyDate).toISOString();
return `${index + 1}. [${item.id}] ${item.title} (${modify})`;
});
const body = items.length > 0 ? items.join("\n") : "暂无笔记";
return {
contents: [
{
uri: "minote://notes",
text: body,
},
],
};
}
);
}