Skip to main content
Glama

create_item

Create and publish new articles on Qiita, a Japanese developer community platform, by providing title, markdown content, tags, and privacy settings.

Instructions

新しい記事を作成します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYes記事の本文(Markdown形式)
privateNo非公開記事かどうか
tagsYesタグの配列
titleYes記事のタイトル
tweetNoTwitterに投稿するかどうか

Implementation Reference

  • Handler definition for the 'create_item' tool. It references the input schema and provides an execute function that passes the validated input directly to the QiitaApiClient's createItem method.
    create_item: { schema: createItemSchema, execute: async (input, client) => client.createItem(input),
  • Zod schema used for input validation of the create_item tool.
    const createItemSchema = z.object({ title: z.string(), body: z.string(), tags: z.array(tagSpecificationSchema), private: z.boolean().default(false), tweet: z.boolean().default(false), });
  • Core helper method implementing the Qiita API call to create a new item by posting to /items endpoint.
    async createItem(item: { title: string; body: string; tags: Array<{ name: string; versions: string[] }>; private?: boolean; tweet?: boolean; }) { this.assertAuthenticated(); const response = await this.client.post('/items', item); return response.data; }
  • MCP tool schema definition for 'create_item', used in listTools response.
    { name: 'create_item', description: '新しい記事を作成します', inputSchema: { type: 'object', properties: { 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, }, tweet: { type: 'boolean', description: 'Twitterに投稿するかどうか', default: false, }, }, required: ['title', 'body', 'tags'], }, },
  • src/index.ts:30-65 (registration)
    Generic tool call handler registration in MCP server that dispatches to specific toolHandlers[name].execute for 'create_item' and others.
    server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const accessToken = process.env.QIITA_ACCESS_TOKEN; const qiita = new QiitaApiClient(accessToken); const handler = toolHandlers[name]; try { if (!handler) { throw new Error(`未知のツール: ${name}`); } const parsedArgs = handler.schema.parse(args ?? {}); const result = await handler.execute(parsedArgs, qiita); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error: any) { const message = error?.message ?? String(error); return { content: [ { type: 'text', text: `エラーが発生しました: ${message}`, }, ], isError: true, }; } });

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/Selenium39/mcp-server-qiita'

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