Skip to main content
Glama
Kong

For Five Coffee MCP Server

by Kong

get_items_by_category

Retrieve all menu items from a specified category to quickly access and organize coffee shop offerings by type.

Instructions

Get all menu items from a specific category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesThe category name to filter by

Implementation Reference

  • The main handler function that fetches the menu data, filters items by the given category (case-insensitive), and returns a structured JSON response with the category name, item count, and matching items.
    async getItemsByCategory(category) { const menuData = await this.fetchMenuData(); const categoryItems = menuData.items.filter( item => item.category.toLowerCase() === category.toLowerCase() ); return { content: [ { type: 'text', text: JSON.stringify( { category, itemCount: categoryItems.length, items: categoryItems, }, null, 2 ), }, ], }; }
  • Defines the input schema for the tool, specifying that a 'category' string parameter is required.
    inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'The category name to filter by', }, }, required: ['category'], },
  • server.js:73-86 (registration)
    Registers the tool in the MCP ListToolsRequestSchema response, including name, description, and input schema.
    { name: 'get_items_by_category', description: 'Get all menu items from a specific category', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'The category name to filter by', }, }, required: ['category'], }, },
  • server.js:109-110 (registration)
    Dispatches calls to the getItemsByCategory handler in the MCP CallToolRequestSchema switch statement.
    case 'get_items_by_category': return await this.getItemsByCategory(args.category);
  • server.js:183-192 (registration)
    Registers an HTTP REST API endpoint (/api/menu/category/:category) that calls the getItemsByCategory handler and returns JSON.
    this.app.get('/api/menu/category/:category', async (req, res) => { try { const { category } = req.params; const result = await this.getItemsByCategory(category); const categoryData = JSON.parse(result.content[0].text); res.json(categoryData); } catch (error) { res.status(500).json({ error: error.message }); } });

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/Kong/menu-mpc'

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