Skip to main content
Glama
SuxyEE
by SuxyEE

list_projects

Discover available Alibaba Cloud SLS projects across specified regions to identify log sources before querying logs. Supports single or multiple region queries with environment variable defaults.

Instructions

List all SLS projects in one or more Alibaba Cloud regions. Pass a single region string or an array of region IDs. If omitted, queries all regions configured in SLS_REGIONS / SLS_REGION env variables. Use this to discover available projects before querying logs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionsNoOne or more Alibaba Cloud region IDs to query. Accepts a single string (e.g. "cn-hangzhou") or an array (e.g. ["cn-hangzhou","cn-shenzhen"]). Defaults to all regions configured in SLS_REGIONS / SLS_REGION env variables.

Implementation Reference

  • The handler function that executes the logic for listing SLS projects.
    export async function handleListProjects(input: ListProjectsInput): Promise<string> {
      // Resolve target regions
      let targetRegions: string[];
      if (!input.regions || (Array.isArray(input.regions) && input.regions.length === 0)) {
        targetRegions = getConfiguredRegions();
      } else if (typeof input.regions === 'string') {
        targetRegions = [input.regions];
      } else {
        targetRegions = input.regions;
      }
    
      // Query all regions in parallel
      const results = await Promise.allSettled(
        targetRegions.map((region) => listProjects(region))
      );
    
      const allProjects: { projectName: string; description: string; region: string }[] = [];
      const errors: string[] = [];
    
      for (let i = 0; i < results.length; i++) {
        const result = results[i];
        if (result.status === 'fulfilled') {
          allProjects.push(...result.value);
        } else {
          errors.push(`${targetRegions[i]}: ${result.reason instanceof Error ? result.reason.message : String(result.reason)}`);
        }
      }
    
      const lines: string[] = [];
    
      if (allProjects.length > 0) {
        // Group by region
        const byRegion = new Map<string, typeof allProjects>();
        for (const p of allProjects) {
          if (!byRegion.has(p.region)) byRegion.set(p.region, []);
          byRegion.get(p.region)!.push(p);
        }
    
        lines.push(`Found **${allProjects.length}** SLS projects across **${byRegion.size}** region(s):\n`);
    
        for (const [region, projects] of byRegion) {
          lines.push(`### ${region} (${projects.length} projects)`);
          for (const p of projects) {
            lines.push(`- **${p.projectName}**${p.description ? `  \n  ${p.description}` : ''}`);
          }
          lines.push('');
        }
      } else {
        lines.push('No SLS projects found.');
      }
    
      if (errors.length > 0) {
        lines.push(`\n**Errors in some regions:**`);
        for (const e of errors) {
          lines.push(`- ${e}`);
        }
      }
    
      lines.push('\nUse `list_logstores` to see logstores within a project.');
    
      return lines.join('\n');
    }
  • Zod schema defining the input for the list_projects tool.
    export const listProjectsSchema = z.object({
      regions: z
        .union([z.string(), z.array(z.string())])
        .optional()
        .describe(
          'One or more Alibaba Cloud region IDs to query. Accepts a single string (e.g. "cn-hangzhou") or an array (e.g. ["cn-hangzhou","cn-shenzhen"]). Defaults to all regions configured in SLS_REGIONS / SLS_REGION env variables.'
        ),
    });
  • src/index.ts:19-24 (registration)
    Registration of the list_projects tool in the main TOOLS array.
    {
      name: 'list_projects',
      description:
        'List all SLS projects in one or more Alibaba Cloud regions. Pass a single region string or an array of region IDs. If omitted, queries all regions configured in SLS_REGIONS / SLS_REGION env variables. Use this to discover available projects before querying logs.',
      inputSchema: zodToJsonSchema(listProjectsSchema) as Tool['inputSchema'],
    },
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by explaining the default behavior (uses env variables when regions omitted) and the tool's purpose in the workflow. However, it doesn't mention potential rate limits, authentication needs, or pagination behavior.

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?

Three tightly focused sentences with zero waste: first states core functionality, second explains parameter usage, third provides usage context. Every sentence earns its place by adding distinct value.

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

Completeness4/5

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

For a single-parameter read operation with no annotations and no output schema, the description provides good context about the tool's role in the workflow and default behavior. However, without output schema, it doesn't describe what the returned project list looks like.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already fully documents the single parameter. The description adds minimal value beyond the schema by mentioning the parameter can be omitted, which is already implied by the schema's optional nature.

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 the verb ('List') and resource ('SLS projects'), specifies the scope ('in one or more Alibaba Cloud regions'), and distinguishes from siblings by mentioning its discovery purpose before querying logs (unlike sibling tools that directly query logs).

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?

It explicitly states when to use this tool ('to discover available projects before querying logs'), provides an alternative scenario (if regions omitted, uses env variables), and distinguishes from sibling tools by positioning it as a prerequisite step for log querying operations.

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

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