Skip to main content
Glama
microcmsio

microCMS MCP Server

by microcmsio

microcms_get_services

Retrieve a list of configured microCMS services and their available APIs. Use this tool to discover available services and obtain the required serviceId for other tools.

Instructions

Get list of configured microCMS services and their available APIs (endpoints). Use this tool first to discover which services are available and find the correct serviceId for other tools. In multi-service mode, serviceId is required for all other tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handleGetServices async function that executes the tool logic. It reads the app config, and in single-service mode fetches APIs and service info for one service; in multi-service mode fetches for all configured services in parallel.
    export async function handleGetServices(): Promise<ServicesResponse> {
      const config = getAppConfig();
    
      if (config.mode === 'single') {
        const [apis, serviceInfo] = await Promise.all([
          fetchApisForService(config.serviceDomain),
          getServiceInfo(config.serviceDomain),
        ]);
        return {
          mode: 'single',
          description: 'Single service mode - serviceId parameter is optional',
          services: [
            {
              id: config.serviceDomain,
              name: serviceInfo.name,
              apis,
            },
          ],
        };
      }
    
      // Multi service mode - fetch APIs and service info for all services in parallel
      const servicesWithApis = await Promise.all(
        config.services.map(async (s) => {
          const [apis, serviceInfo] = await Promise.all([
            fetchApisForService(s.id),
            getServiceInfo(s.id),
          ]);
          return {
            id: s.id,
            name: serviceInfo.name,
            apis,
          };
        })
      );
    
      return {
        mode: 'multi',
        description:
          'Multi service mode - serviceId parameter is required for all tools. Use the serviceId that contains the endpoint you need.',
        services: servicesWithApis,
      };
    }
  • Tool definition with name 'microcms_get_services', description, and inputSchema (empty object, no required params). Also includes the ServicesResponse and ServiceWithApis interfaces.
    export const getServicesTool: Tool = {
      name: 'microcms_get_services',
      description:
        'Get list of configured microCMS services and their available APIs (endpoints). Use this tool first to discover which services are available and find the correct serviceId for other tools. In multi-service mode, serviceId is required for all other tools.',
      inputSchema: {
        type: 'object',
        properties: {},
        required: [],
      },
    };
  • src/server.ts:68-102 (registration)
    Registration of the tool in the tools array (line 69) and handler mapping in toolHandlers (line 102) inside server.ts, plus the import on line 46.
    const tools = [
      getServicesTool,
      getListTool,
      getListMetaTool,
      getContentTool,
      getContentMetaTool,
      createContentPublishedTool,
      createContentDraftTool,
      createContentsBulkPublishedTool,
      createContentsBulkDraftTool,
      updateContentPublishedTool,
      updateContentDraftTool,
      patchContentTool,
      patchContentStatusTool,
      patchContentCreatedByTool,
      deleteContentTool,
      getMediaTool,
      uploadMediaTool,
      deleteMediaTool,
      getApiInfoTool,
      getApiListTool,
      getMemberTool,
    ];
    
    // Tool handlers map - using 'any' for generic handler type that accepts multiple tool parameter types
    const toolHandlers: Record<
      string,
      (
        // biome-ignore lint/suspicious/noExplicitAny: Generic handler type for multiple tools
        params: any,
        serviceId?: string
        // biome-ignore lint/suspicious/noExplicitAny: Generic return type for multiple tools
      ) => Promise<any>
    > = {
      microcms_get_services: handleGetServices,
  • getAppConfig() helper used by handleGetServices to read the current app configuration.
    export function getAppConfig(): AppConfig {
      if (!appConfig) {
        throw new Error('Clients not initialized. Call initializeClients() first.');
      }
      return appConfig;
    }
  • fetchApisForService() helper that retrieves the list of APIs for a given service from the microCMS management API. Used by handleGetServices to populate the apis array.
    export async function fetchApisForService(
      serviceId: string
    ): Promise<{ name: string; endpoint: string; type: string }[]> {
      try {
        const result = await getApiList(serviceId);
        if (result && Array.isArray(result.apis)) {
          return result.apis.map(
            (api: {
              apiName?: string;
              name?: string;
              apiEndpoint?: string;
              endpoint?: string;
              apiType?: string[];
              type?: string;
            }) => ({
              name: api.apiName || api.name || '',
              endpoint: api.apiEndpoint || api.endpoint || '',
              type:
                api.type === 'list' ||
                (Array.isArray(api.apiType) && api.apiType.includes('LIST'))
                  ? 'list'
                  : 'object',
            })
          );
        }
        return [];
      } catch {
        return [];
      }
    }
Behavior4/5

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

No annotations are provided, so the description carries the full burden. While the read-only, safe nature of listing services is implied, it does not explicitly state safety or lack of side effects. However, given the simplicity, the description is largely adequate.

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?

Two succinct sentences. The first states the purpose, and the second provides usage guidance. No unnecessary words, efficiently conveying all needed information.

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?

The tool has no parameters and no output schema, but the description fully covers its purpose and role as a prerequisite for other tools. It is self-contained and complete for its simple function.

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 (0), so the baseline is 4. The description adds value by explaining the tool's output (list of services and endpoints), which is more than the empty schema provides.

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 states 'Get list of configured microCMS services and their available APIs (endpoints)', using a specific verb and resource. It distinguishes this discovery tool from sibling CRUD tools by emphasizing its role in obtaining the serviceId needed by others.

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

Usage Guidelines5/5

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

Explicitly instructs 'Use this tool first to discover which services are available' and explains the consequence: 'In multi-service mode, serviceId is required for all other tools.' Provides clear when-to-use and context.

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/microcmsio/microcms-mcp-server'

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