Skip to main content
Glama

post-draft-note

Publishes draft articles on note.com by converting Markdown content to HTML format with title, body, and optional tags.

Instructions

下書き状態の記事を投稿する(Markdown形式の本文を自動でHTMLに変換)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes記事のタイトル
bodyYes記事の本文
tagsNoタグ(最大10個)
idNo既存の下書きID(既存の下書きを更新する場合)

Implementation Reference

  • The complete implementation of the 'post-draft-note' tool handler. Creates a new draft note if no ID provided, or updates existing draft. Uses note.com API endpoints /v1/text_notes and /v1/text_notes/draft_save with custom headers. Handles auth, returns noteId, noteKey, editUrl.
    "post-draft-note", "下書き状態の記事を新規作成または更新する", { title: z.string().describe("記事のタイトル"), body: z.string().describe("記事の本文"), tags: z.array(z.string()).optional().describe("タグ(最大10個)"), id: z.string().optional().describe("既存の下書きID(既存の下書きを更新する場合)"), }, async ({ title, body, tags, id }) => { try { if (!hasAuth()) { return createAuthErrorResponse(); } // 下書き保存用のカスタムヘッダーを構築 const buildCustomHeaders = () => { const headers = buildAuthHeaders(); headers["content-type"] = "application/json"; headers["origin"] = "https://editor.note.com"; headers["referer"] = "https://editor.note.com/"; headers["x-requested-with"] = "XMLHttpRequest"; return headers; }; // 新規作成の場合、まず空の下書きを作成 if (!id) { console.error("新規下書きを作成します..."); const createData = { body: "<p></p>", body_length: 0, name: title || "無題", index: false, is_lead_form: false }; const headers = buildCustomHeaders(); const createResult = await noteApiRequest( "/v1/text_notes", "POST", createData, true, headers ); if (createResult.data?.id) { id = createResult.data.id.toString(); const key = createResult.data.key || `n${id}`; console.error(`下書き作成成功: ID=${id}, key=${key}`); } else { throw new Error("下書きの作成に失敗しました"); } } // 下書きを更新 console.error(`下書きを更新します (ID: ${id})`); const updateData = { body: body || "", body_length: (body || "").length, name: title || "無題", index: false, is_lead_form: false }; const headers = buildCustomHeaders(); const data = await noteApiRequest( `/v1/text_notes/draft_save?id=${id}&is_temp_saved=true`, "POST", updateData, true, headers ); const noteKey = `n${id}`; return createSuccessResponse({ success: true, message: "記事を下書き保存しました", noteId: id, noteKey: noteKey, editUrl: `https://editor.note.com/notes/${noteKey}/edit/`, data: data }); } catch (error) { console.error(`下書き保存処理でエラー: ${error}`); return handleApiError(error, "記事下書き保存"); } } );
  • Zod input schema for the post-draft-note tool parameters: title (required string), body (required string), tags (optional array of strings), id (optional string for updating existing draft).
    title: z.string().describe("記事のタイトル"), body: z.string().describe("記事の本文"), tags: z.array(z.string()).optional().describe("タグ(最大10個)"), id: z.string().optional().describe("既存の下書きID(既存の下書きを更新する場合)"), },
  • Registration of note tools (including post-draft-note) via registerNoteTools call in the central tools index.
    registerNoteTools(server);
  • Top-level registration of all tools in the main MCP server, which includes post-draft-note through tools/index.
    registerAllTools(server);

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/shimayuz/note-com-mcp'

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