Skip to main content
Glama
mikechao

Met Museum MCP Server

list-departments

Retrieve all department names from the Metropolitan Museum of Art to explore their collection by category and identify specific areas for further research.

Instructions

List all departments in the Metropolitan Museum of Art (Met Museum)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
__intentYesIn ≤ 30 words, describe why you are calling this tool and how its result advances your overall task. Don't use first-person pronouns like "I" or "my". Make sure to give a gist of the whole task and how this tool fits into it.

Implementation Reference

  • The `execute` method fetches the departments list from the Met Museum API, validates the response using `DepartmentsSchema`, formats the departments into a text string, and returns it. Handles errors gracefully.
    public async execute() { try { const response = await metMuseumRateLimiter.fetch(this.apiUrl); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const jsonData = await response.json(); const parseResult = DepartmentsSchema.safeParse(jsonData); if (!parseResult.success) { throw new Error(`Invalid response shape: ${JSON.stringify(parseResult.error.issues, null, 2)}`); } const text = parseResult.data.departments.map((department) => { return `Department ID: ${department.departmentId}, Display Name: ${department.displayName}`; }).join('\n'); return { content: [{ type: 'text' as const, text }], isError: false, }; } catch (error) { console.error('Error listing departments:', error); return { content: [{ type: 'text' as const, text: `Error listing departments: ${error}` }], isError: true, }; } }
  • src/index.ts:61-66 (registration)
    Registers the 'list-departments' tool with the MCP server by providing its name, description, input schema shape, and bound execute method.
    this.server.tool( this.listDepartments.name, this.listDepartments.description, this.listDepartments.inputSchema.shape, this.listDepartments.execute.bind(this.listDepartments), );
  • Zod input schema for the tool, which requires no parameters.
    public readonly inputSchema = z.object({}).describe('No input required');
  • Zod schema used to validate the API response containing the list of departments. References `DepartmentSchema` defined earlier.
    export const DepartmentsSchema = z.object({ departments: z.array(DepartmentSchema).describe( 'An array containing the JSON objects that contain each department\'s ' + 'departmentId and display name. The departmentId is to be used as a ' + 'query parameter on the `/objects` endpoint', ), });
  • Import of the rate limiter utility used in the execute method to fetch the API without exceeding rate limits.
    import { metMuseumRateLimiter } from '../utils/RateLimiter.js';

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/mikechao/metmuseum-mcp'

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