Skip to main content
Glama

get_items

Retrieve articles from Qiita's developer community platform using search queries, pagination, and filtering options to find relevant technical content.

Instructions

記事一覧を取得します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoページ番号(1-100)
perPageNo1ページあたりの件数(1-100)
queryNo検索クエリ

Implementation Reference

  • The execute handler for the 'get_items' MCP tool. Validates input using a Zod schema and delegates execution to the QiitaApiClient.getItems method.
    get_items: { schema: paginationSchema.extend({ query: z.string().optional(), }), execute: async ({ page, perPage, query }, client) => client.getItems(page, perPage, query), },
  • MCP tool definition for 'get_items', including name, description, and JSON input schema.
    { name: 'get_items', description: '記事一覧を取得します', inputSchema: { type: 'object', properties: { page: { type: 'number', description: 'ページ番号(1-100)', default: 1, }, perPage: { type: 'number', description: '1ページあたりの件数(1-100)', default: 20, }, query: { type: 'string', description: '検索クエリ', }, }, required: [], }, },
  • src/index.ts:26-28 (registration)
    Registers the list of available tools (including 'get_items') for the MCP server via ListToolsRequestHandler.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
  • src/index.ts:30-65 (registration)
    Registers the CallToolRequestHandler which looks up the tool handler by name (including 'get_items'), parses arguments, executes it with a QiitaApiClient instance, and returns the result.
    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, }; } });
  • QiitaApiClient.getItems method: Performs the actual API call to fetch items from Qiita's /items endpoint with pagination and optional query parameters.
    async getItems(page = 1, perPage = 20, query?: string) { const response = await this.client.get('/items', { params: { page, per_page: perPage, ...(query && { query }) }, }); return response.data; }

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