Skip to main content
Glama
SuxyEE
by SuxyEE

list_logstores

Discover available logstores within an Alibaba Cloud SLS project to identify data sources before querying logs. Lists all logstores by project and region.

Instructions

List all logstores within an SLS project. Use this to discover available logstores before querying logs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesSLS project name
regionNoAlibaba Cloud region ID where the project resides, e.g. cn-hangzhou, cn-shenzhen. Defaults to SLS_REGION env variable.

Implementation Reference

  • The handler function that executes the logic for listing logstores by calling the SLS client.
    export async function handleListLogStores(input: ListLogStoresInput): Promise<string> {
      const logstores = await listLogStores(input.project, input.region);
    
      if (logstores.length === 0) {
        return `No logstores found in project: ${input.project}`;
      }
    
      const lines = logstores.map((l) => `- **${l.logstoreName}**`);
    
      return [
        `Found **${logstores.length}** logstores in project **${input.project}**:\n`,
        lines.join('\n'),
        '\nUse `query_logs` to query log data from a logstore.',
      ].join('\n');
    }
  • Input validation schema for the list_logstores tool using Zod.
    export const listLogStoresSchema = z.object({
      project: z.string().describe('SLS project name'),
      region: z
        .string()
        .optional()
        .describe('Alibaba Cloud region ID where the project resides, e.g. cn-hangzhou, cn-shenzhen. Defaults to SLS_REGION env variable.'),
    });
  • src/index.ts:25-30 (registration)
    Registration of the 'list_logstores' tool in the main server configuration.
    {
      name: 'list_logstores',
      description:
        'List all logstores within an SLS project. Use this to discover available logstores before querying logs.',
      inputSchema: zodToJsonSchema(listLogStoresSchema) as Tool['inputSchema'],
    },
  • Tool call handler in the request dispatching logic.
    case 'list_logstores': {
      const input = listLogStoresSchema.parse(args);
      text = await handleListLogStores(input);
      break;

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/SuxyEE/aliyun-sls-mcp'

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