update_item
Modify existing Qiita articles by updating titles, content, tags, or visibility settings using article ID.
Instructions
既存の記事を更新します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| itemId | Yes | 記事ID | |
| title | Yes | 記事のタイトル | |
| body | Yes | 記事の本文(Markdown形式) | |
| tags | Yes | タグの配列 | |
| private | No | 非公開記事かどうか |
Implementation Reference
- src/tools/handlers.ts:100-103 (handler)The execution handler for the 'update_item' MCP tool, which destructures itemId from input and forwards the remaining fields as update data to the QiitaApiClient's updateItem method.update_item: { schema: updateItemSchema, execute: async ({ itemId, ...rest }, client) => client.updateItem(itemId, rest), },
- src/tools/handlers.ts:44-50 (schema)Zod schema used for runtime input validation of the update_item tool handler.const updateItemSchema = z.object({ itemId: z.string(), title: z.string(), body: z.string(), tags: z.array(tagSpecificationSchema), private: z.boolean().optional(), });
- src/tools/definitions.ts:230-277 (registration)MCP Tool definition object for 'update_item', including name, description, and JSON inputSchema used for tool listing and validation.{ name: 'update_item', description: '既存の記事を更新します', inputSchema: { type: 'object', properties: { itemId: { type: 'string', description: '記事ID', }, title: { type: 'string', description: '記事のタイトル', }, body: { type: 'string', description: '記事の本文(Markdown形式)', }, tags: { type: 'array', description: 'タグの配列', items: { type: 'object', properties: { name: { type: 'string', description: 'タグ名', }, versions: { type: 'array', description: 'タグのバージョン', items: { type: 'string', }, }, }, required: ['name', 'versions'], }, }, private: { type: 'boolean', description: '非公開記事かどうか', default: false, }, }, required: ['itemId', 'title', 'body', 'tags'], }, },
- src/qiitaApiClient.ts:88-97 (helper)Low-level API client method that sends a PATCH request to Qiita's /items/{itemId} endpoint to update the item, called by the tool handler.async updateItem(itemId: string, item: { title: string; body: string; tags: Array<{ name: string; versions: string[] }>; private?: boolean; }) { this.assertAuthenticated(); const response = await this.client.patch(`/items/${itemId}`, item); return response.data; }