Skip to main content
Glama
aliyun

Alibaba Cloud Observability MCP Server

Official
by aliyun

sls_list_projects

List all SLS projects in a specified Alibaba Cloud region, with optional fuzzy search by project name. Retrieve project details including name, description, and region ID for quick identification and management.

Instructions

列出阿里云日志服务中的所有项目。

        ## 功能概述

        该工具可以列出指定区域中的所有SLS项目,支持通过项目名进行模糊搜索。如果不提供项目名称,则返回该区域的所有项目。

        ## 使用场景

        - 当需要查找特定项目是否存在时
        - 当需要获取某个区域下所有可用的SLS项目列表时
        - 当需要根据项目名称的部分内容查找相关项目时

        ## 返回数据结构

        返回的项目信息包含:
        - project_name: 项目名称
        - description: 项目描述
        - region_id: 项目所在区域

        ## 查询示例

        - "有没有叫 XXX 的 project"
        - "列出所有SLS项目"

        Args:
            ctx: MCP上下文,用于访问SLS客户端
            project_name_query: 项目名称查询字符串,支持模糊搜索
            limit: 返回结果的最大数量,范围1-100,默认10
            region_id: 阿里云区域ID,region id format like "xx-xxx",like "cn-hangzhou"

        Returns:
            包含项目信息的字典列表,每个字典包含project_name、description和region_id
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNolimit,max is 100
project_name_queryNoproject name,fuzzy search
region_idYesaliyun region id

Implementation Reference

  • The sls_list_projects tool handler: lists SLS projects in the specified region using Alibaba Cloud SLS ListProject API, with optional fuzzy search by project name and limit. Includes retry and error handling decorators, and comprehensive docstring describing usage.
    @self.server.tool()
    @retry(
        stop=stop_after_attempt(Config.get_retry_attempts()),
        wait=wait_fixed(Config.RETRY_WAIT_SECONDS),
        retry=retry_if_exception_type(Exception),
        reraise=True,
    )
    @handle_tea_exception
    def sls_list_projects(
        ctx: Context,
        projectName: Optional[str] = Field(
            None, description="project name,fuzzy search"
        ),
        limit: int = Field(
            default=50, description="limit,max is 100", ge=1, le=100
        ),
        regionId: str = Field(default=..., description="aliyun region id"),
    ) -> Dict[str, Any]:
        """列出阿里云日志服务中的所有项目。
    
        ## 功能概述
    
        该工具可以列出指定区域中的所有SLS项目,支持通过项目名进行模糊搜索。如果不提供项目名称,则返回该区域的所有项目。
    
        ## 使用场景
    
        - 当需要查找特定项目是否存在时
        - 当需要获取某个区域下所有可用的SLS项目列表时
        - 当需要根据项目名称的部分内容查找相关项目时
    
        ## 返回数据结构
    
        返回的项目信息包含:
        - project_name: 项目名称
        - description: 项目描述
        - region_id: 项目所在区域
    
        ## 查询示例
    
        - "有没有叫 XXX 的 project"
        - "列出所有SLS项目"
    
        Args:
            ctx: MCP上下文,用于访问SLS客户端
            projectName: 项目名称查询字符串,支持模糊搜索
            limit: 返回结果的最大数量,范围1-100,默认50
            regionId: 阿里云区域ID,region id format like "xx-xxx",like "cn-hangzhou"
    
        Returns:
            包含项目信息的字典列表,每个字典包含project_name、description和region_id
        """
        sls_client: SLSClient = ctx.request_context.lifespan_context[
            "sls_client"
        ].with_region(regionId)
    
        request: ListProjectRequest = ListProjectRequest(
            project_name=projectName,
            size=limit,
        )
        response: ListProjectResponse = sls_client.list_project(request)
    
        return {
            "projects": [
                {
                    "project_name": project.project_name,
                    "description": project.description,
                    "region_id": project.region,
                }
                for project in response.body.projects
            ],
            "message": f"当前最多支持查询{limit}个项目,未防止返回数据过长,如果需要查询更多项目,您可以提供 project 的关键词来模糊查询",
        }
  • Input schema definition using Pydantic Field for parameters: projectName (optional fuzzy search), limit (1-100, default 50), regionId (required).
        ctx: Context,
        projectName: Optional[str] = Field(
            None, description="project name,fuzzy search"
        ),
        limit: int = Field(
            default=50, description="limit,max is 100", ge=1, le=100
        ),
        regionId: str = Field(default=..., description="aliyun region id"),
    ) -> Dict[str, Any]:
  • Registers the IaaSToolkit on the FastMCP server, which in turn registers all IaaS tools including sls_list_projects via _register_tools().
    def register_iaas_tools(server: FastMCP):
        """Register IaaS toolkit tools with the FastMCP server
    
        Args:
            server: FastMCP server instance
        """
        IaaSToolkit(server)
  • Top-level registration call to register_iaas_tools when iaas scope is enabled, invoked during MCP server initialization.
    if scope == "all" or scope == "iaas":
        register_iaas_tools(mcp_server)
        registered_scopes.append("IaaS")
Behavior4/5

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

With no annotations provided, the description carries full burden. It discloses key behavioral traits: it's a read-only listing operation (implied by '列出'), supports fuzzy search ('模糊搜索'), has a default limit of 10 with range 1-100, and requires region_id. However, it doesn't mention rate limits, authentication needs, or pagination behavior, leaving some gaps for a tool with no annotation coverage.

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

Conciseness3/5

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

The description is structured with clear sections (功能概述, 使用场景, etc.), but it's verbose with redundant information. For example, the '返回数据结构' section repeats what's in the Returns docstring, and the '查询示例' adds little operational value. Some sentences don't earn their place, making it less concise than ideal.

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?

Given no annotations and no output schema, the description does a good job covering the tool's purpose, usage, parameters, and return format. It explains what the tool does, when to use it, and what data it returns. However, it lacks details on error handling, authentication, or rate limits, which would be helpful for a cloud service tool with no structured metadata.

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 documents all three parameters well. The description adds minimal value beyond the schema: it reiterates that project_name_query supports fuzzy search and that region_id is required, but doesn't provide additional context like format examples beyond 'xx-xxx' or practical usage tips. Baseline 3 is appropriate when schema does the heavy lifting.

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 specific verb ('列出' - list) and resource ('阿里云日志服务中的所有项目' - all projects in Alibaba Cloud Log Service). It distinguishes from siblings like sls_list_logstores (which lists logstores within projects) by focusing on projects rather than logstores, making the scope unambiguous.

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?

The '使用场景' section explicitly provides three scenarios for when to use this tool: checking if a specific project exists, getting all SLS projects in a region, and searching by partial project name. It also mentions '如果不提供项目名称,则返回该区域的所有项目' (if no project name is provided, returns all projects in the region), clarifying the default behavior.

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

Related 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/aliyun/alibabacloud-observability-mcp-server'

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