Skip to main content
Glama

save_draft

Save draft posts to note.com by reading titles, content, and tags from Markdown files, enabling automated content preparation.

Instructions

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

Input Schema

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

Implementation Reference

  • Handler for the 'save_draft' tool: parses arguments with SaveDraftSchema and invokes postToNote function with isPublic set to false to save as draft.
    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),
          },
        ],
      };
    }
  • Zod schema for validating input parameters of the 'save_draft' tool.
    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, including name, description, and inputSchema.
    {
      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'],
      },
    },
  • Specific logic in the shared postToNote helper function that handles saving the note as a draft (when isPublic is false), including clicking the save draft button and returning the result.
    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: '下書きを保存しました',
      };
Install Server

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