Skip to main content
Glama
mikechao

Met Museum MCP Server

list-departments

Read-onlyIdempotent

Retrieve a complete list of all departments within the Metropolitan Museum of Art, enabling easy browsing of curatorial areas.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
departmentsYesAn 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

Implementation Reference

  • The ListDepartmentsTool class that implements the 'list-departments' tool. Its execute() method calls the API client, formats results as text, and returns structured content.
    export class ListDepartmentsTool {
      public readonly name: string = 'list-departments';
      public readonly description: string = 'List all departments in the Metropolitan Museum of Art (Met Museum)';
      public readonly inputSchema = z.object({}).describe('No input required');
    
      private readonly apiClient: MetMuseumApiClient;
    
      constructor(apiClient: MetMuseumApiClient) {
        this.apiClient = apiClient;
      }
    
      public async execute(): Promise<CallToolResult> {
        try {
          const departments = await this.apiClient.listDepartments();
          const structuredContent: ListDepartmentsStructuredContent = {
            departments,
          };
          const text = departments.map((department) => {
            return `Department ID: ${department.departmentId}, Display Name: ${department.displayName}`;
          }).join('\n');
          return {
            content: [{ type: 'text', text }],
            structuredContent,
            isError: false,
          };
        }
        catch (error) {
          // Note: Error is returned to user in the tool response below.
          // No need to log to stderr as it would leak implementation details in stdio mode.
          const message = error instanceof MetMuseumApiError && error.isUserFriendly
            ? error.message
            : `Error listing departments: ${error}`;
          return {
            content: [{ type: 'text', text: message }],
            isError: true,
          };
        }
      }
    }
  • Registration of the 'list-departments' tool via registerAppTool(). Wires the tool name, description, input/output schemas, annotations, and execute handler.
    registerAppTool(
      server,
      listDepartments.name,
      {
        description: listDepartments.description,
        inputSchema: listDepartments.inputSchema.shape,
        outputSchema: DepartmentsSchema.shape,
        annotations: {
          title: 'List Met Departments',
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: true,
        },
        _meta: {
          ui: {
            visibility: ['model', 'app'],
          },
        },
      },
      listDepartments.execute.bind(listDepartments),
    );
  • DepartmentSchema and DepartmentsSchema Zod schemas defining the shape of each department object (departmentId, displayName) and the overall response array.
    export const DepartmentSchema = z.object({
      departmentId: z.number().describe(
        'Department ID as an integer. The departmentId is to be used as a query '
        + 'parameter on the `/objects` endpoint',
      ),
      displayName: z.string().describe('Display name for a department'),
    });
  • The listDepartments() method on MetMuseumApiClient that fetches departments from the Met Museum API with caching and request deduplication.
    public async listDepartments(): Promise<z.infer<typeof DepartmentsSchema>['departments']> {
      const now = Date.now();
      if (this.departmentsCache && now < this.departmentsCacheExpiresAt) {
        return this.departmentsCache;
      }
    
      if (!this.departmentsRequestInFlight) {
        this.departmentsRequestInFlight = this.fetchAndParse(this.departmentsUrl, DepartmentsSchema, 'departments')
          .then((data) => {
            this.departmentsCache = data.departments;
            this.departmentsCacheExpiresAt = Date.now() + this.departmentsCacheTtlMs;
            return data.departments;
          })
          .finally(() => {
            this.departmentsRequestInFlight = undefined;
          });
      }
    
      return await this.departmentsRequestInFlight;
    }
  • Instantiation of the ListDepartmentsTool with the API client dependency, and passing it into setupTools().
    const metMuseumApiClient = new MetMuseumApiClient();
    const listDepartments = new ListDepartmentsTool(metMuseumApiClient);
    const search = new SearchMuseumObjectsTool(metMuseumApiClient);
    const getMuseumObject = new GetObjectTool(metMuseumApiClient);
    const openMetExplorer = new OpenMetExplorerTool();
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already provide readOnlyHint, destructiveHint, idempotentHint, and openWorldHint. The description confirms a read-only list operation but adds no behavioral details beyond what annotations provide.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, front-loaded with key action and resource, no unnecessary words. Perfectly concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero parameters and the presence of an output schema, the description is complete. It fully conveys the tool's purpose and scope.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are no parameters, so the description does not need to explain them. The baseline for 0 parameters is 4, and the description is adequate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly specifies the action ('List all departments') and the resource ('Metropolitan Museum of Art'). It distinguishes from sibling tools like 'get-museum-object' and 'search-museum-objects' by focusing on departments rather than objects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving all departments but provides no explicit guidance on when to use this tool versus alternatives or any conditions/limitations. It is functional but lacks contextual direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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