get-membership-plans
Retrieve your membership plan details from note.com to view current subscription information and available options.
Instructions
自分のメンバーシッププラン一覧を取得する
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/membership-tools.ts:58-92 (registration)Registers the 'get-membership-plans' tool on the MCP server, including the inline handler function that fetches and formats membership plans from the Note API.server.tool( "get-membership-plans", "自分のメンバーシッププラン一覧を取得する", {}, async () => { try { if (!hasAuth()) { return createAuthErrorResponse(); } const data = await noteApiRequest("/v2/circle/plans", "GET", null, true); if (env.DEBUG) { console.error(`\n===== FULL Membership Plans API Response =====\n${JSON.stringify(data, null, 2)}`); } const rawPlans = safeExtractData(data, commonExtractors.plans); const formattedPlans = rawPlans.map(formatMembershipPlan); if (env.DEBUG) { console.error(`Formatted plans: ${formattedPlans.length} items`); if (formattedPlans.length > 0) { console.error(`First formatted plan: ${JSON.stringify(formattedPlans[0], null, 2)}`); } } return createSuccessResponse({ total: formattedPlans.length, plans: formattedPlans }); } catch (error) { return handleApiError(error, "メンバーシッププラン取得"); } } );
- src/utils/formatters.ts:190-211 (helper)Helper function formatMembershipPlan used by the tool handler to format raw API response data into a standardized MembershipPlan structure.export function formatMembershipPlan(plan: any): MembershipPlan { const circle = plan.circle || {}; const circlePlans = plan.circlePlans || []; const owner = circle.owner || {}; return { id: circle.id || plan.id || "", key: circle.key || plan.key || "", name: circlePlans.length > 0 ? circlePlans[0].name || "" : circle.name || plan.name || "", description: circle.description || plan.description || "", price: plan.price || circle.price || 0, memberCount: circle.subscriptionCount || circle.membershipNumber || 0, notesCount: plan.notesCount || 0, status: circle.isCirclePublished ? "active" : "inactive", ownerName: owner.nickname || owner.name || "", headerImagePath: plan.headerImagePath || circle.headerImagePath || "", plans: circlePlans.map((p: any) => p.name || "").filter((n: string) => n), url: owner.customDomain ? `https://${owner.customDomain.host}/membership` : `https://note.com/${owner.urlname || ""}/membership` }; }
- src/tools/index.ts:12-18 (registration)High-level registration entry point that calls registerMembershipTools(server), which registers the get-membership-plans tool.export function registerAllTools(server: McpServer): void { // 各カテゴリのツールを登録 registerSearchTools(server); registerNoteTools(server); registerUserTools(server); registerMembershipTools(server); registerMagazineTools(server);
- src/note-mcp-server-http.ts:975-989 (handler)Fallback/stub handler for HTTP transport version of the tool, directly calling a different API endpoint without formatting.} else if (name === "get-membership-plans") { // get-membership-plansツールの実装 const data = await noteApiRequest( `/v1/users/me/membership_plans`, "GET", null, true ); result = { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };