Skip to main content
Glama
maoruibin

MCP-Server-Inbox

by maoruibin

write_note

Create notes in your inbox using markdown format with optional titles through conversation-based interactions.

Instructions

Write note to inBox

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleNoOptional title of the note
contentYesText content of the note with markdown format

Implementation Reference

  • MCP tool handler for 'write_note': extracts title and content from request, validates, initializes InboxClient with user token, calls writeNote, formats and returns success response.
    case "write_note": { const content = String(request.params.arguments?.content); const title = request.params.arguments?.title ? String(request.params.arguments.title) : undefined; if (!content) { throw new Error("Content is required"); } // 获取用户Token,优先使用命令行参数,其次使用环境变量 const userToken = args.inbox_user_token || process.env.INBOX_USER_TOKEN; if (!userToken) { throw new Error("inBox token or URL not set. Please provide it via:\n" + "1. Token format: --inbox_user_token=your_token\n" + "2. URL format: --inbox_user_token=https://inbox.gudong.site/api/inbox/your_token"); } // 创建inBox客户端并写入笔记 const inbox = new InboxClient({ userToken }); const result = await inbox.writeNote({ title, content }); // 返回成功信息 let successMessage = `笔记已成功保存到inBox!`; if (title) { successMessage += `\n\n标题: ${title}`; } successMessage += `\n\n${content.substring(0, 50)}${content.length > 50 ? '...' : ''}`; return { content: [ { type: "text", text: successMessage }, ], }; }
  • src/index.ts:56-79 (registration)
    Registers the 'write_note' tool in ListToolsRequestHandler, including name, description, and input schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "write_note", description: "Write note to inBox", inputSchema: { type: "object", properties: { title: { type: "string", description: "Optional title of the note", }, content: { type: "string", description: "Text content of the note with markdown format", }, }, required: ["content"], }, }, ], }; });
  • Input schema definition for the 'write_note' tool: object with optional 'title' string and required 'content' string.
    { name: "write_note", description: "Write note to inBox", inputSchema: { type: "object", properties: { title: { type: "string", description: "Optional title of the note", }, content: { type: "string", description: "Text content of the note with markdown format", }, }, required: ["content"], }, },
  • Helper method in InboxClient that performs the actual POST request to inBox API to create a note with title and content.
    async writeNote({ title, content }: { title?: string; content: string }) { try { if (!content) { throw new Error("invalid content"); } // 检查内容长度 if (content.length > 3000) { throw new Error("note content exceeds 3000 characters limit"); } // 构建请求体,直接传递 title 和 content 参数 const req: { content: string; title?: string } = { content, }; // 如果有title参数,添加到请求中 if (title) { req.title = title; } const resp = await fetch(this.apiUrl, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(req), }); if (!resp.ok) { throw new Error(`request failed with status ${resp.statusText}`); } return resp.json(); } catch (e) { throw e; } }

Other 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/maoruibin/mcp-server-inbox'

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