Skip to main content
Glama

save_draft

Save draft posts to note.com by reading title, body content, and tags from Markdown files, enabling automated content preparation for publishing.

Instructions

note.comに下書きを保存します。Markdownファイルからタイトル、本文、タグを読み取り、下書きとして保存します。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
markdown_pathYesMarkdownファイルのパス(タイトル、本文、タグを含む)
screenshot_dirNoスクリーンショット保存ディレクトリ(オプション)
state_pathNonote.comの認証状態ファイルのパス(デフォルト: /app/.note-state.json)
thumbnail_pathNoサムネイル画像のパス(オプション)
timeoutNoタイムアウト(ミリ秒、デフォルト: 120000)

Implementation Reference

  • Handler for the 'save_draft' tool within the CallToolRequestSchema request handler. Validates arguments using SaveDraftSchema, invokes postToNote with isPublic: false to save draft, and returns the result as text content.
    if (name === 'save_draft') { const params = SaveDraftSchema.parse(args); const result = await postToNote({ markdownPath: params.markdown_path, thumbnailPath: params.thumbnail_path, statePath: params.state_path, screenshotDir: params.screenshot_dir, timeout: params.timeout, isPublic: false, }); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • Core logic in postToNote function that executes the draft saving: clicks the '下書き保存' (save draft) button, waits for confirmation, takes screenshot, and returns success with URL.
    if (!isPublic) { const saveBtn = page.locator('button:has-text("下書き保存"), [aria-label*="下書き保存"]').first(); await saveBtn.waitFor({ state: 'visible', timeout }); if (await saveBtn.isEnabled()) { await saveBtn.click(); await page.locator('text=保存しました').waitFor({ timeout: 4000 }).catch(() => {}); await page.waitForLoadState('networkidle', { timeout: 8000 }).catch(() => {}); } await page.screenshot({ path: screenshotPath, fullPage: true }); const finalUrl = page.url(); log('Draft saved', { url: finalUrl }); await context.close(); await browser.close(); return { success: true, url: finalUrl, screenshot: screenshotPath, message: '下書きを保存しました', };
  • Zod schema used for input validation in the save_draft handler.
    const SaveDraftSchema = z.object({ markdown_path: z.string().describe('Markdownファイルのパス(タイトル、本文、タグを含む)'), thumbnail_path: z.string().optional().describe('サムネイル画像のパス(オプション)'), state_path: z.string().optional().describe(`note.comの認証状態ファイルのパス(デフォルト: ${DEFAULT_STATE_PATH})`), screenshot_dir: z.string().optional().describe('スクリーンショット保存ディレクトリ(オプション)'), timeout: z.number().optional().describe(`タイムアウト(ミリ秒、デフォルト: ${DEFAULT_TIMEOUT})`), });
  • src/index.ts:641-670 (registration)
    Registration of the save_draft tool in the TOOLS array exported for ListToolsRequest, defining name, description, and JSON input schema.
    { name: 'save_draft', description: 'note.comに下書きを保存します。Markdownファイルからタイトル、本文、タグを読み取り、下書きとして保存します。', inputSchema: { type: 'object', properties: { markdown_path: { type: 'string', description: 'Markdownファイルのパス(タイトル、本文、タグを含む)', }, thumbnail_path: { type: 'string', description: 'サムネイル画像のパス(オプション)', }, state_path: { type: 'string', description: `note.comの認証状態ファイルのパス(デフォルト: ${DEFAULT_STATE_PATH})`, }, screenshot_dir: { type: 'string', description: 'スクリーンショット保存ディレクトリ(オプション)', }, timeout: { type: 'number', description: `タイムアウト(ミリ秒、デフォルト: ${DEFAULT_TIMEOUT})`, }, }, required: ['markdown_path'], }, },

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/Go-555/note-post-mcp'

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