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
| Name | Required | Description | Default |
|---|---|---|---|
| project | Yes | SLS project name | |
| region | No | Alibaba Cloud region ID where the project resides, e.g. cn-hangzhou, cn-shenzhen. Defaults to SLS_REGION env variable. |
Implementation Reference
- src/tools/list-logstores.ts:14-28 (handler)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'); } - src/tools/list-logstores.ts:4-10 (schema)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'], }, - src/index.ts:85-88 (handler)Tool call handler in the request dispatching logic.
case 'list_logstores': { const input = listLogStoresSchema.parse(args); text = await handleListLogStores(input); break;