osc_list_files
Lists files in a specified bucket on an Eyevinn Open Source Cloud Storage Minio instance, using the instance name and bucket name.
Instructions
List files in a bucket on Eyevinn Open Source Cloud Storage (OSC) Minio instance
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the minio instance | |
| bucket | Yes | Name of the bucket |
Implementation Reference
- src/tools/osc.ts:77-93 (handler)The handler case that executes the 'osc_list_files' tool logic. It parses arguments via ListFilesSchema, calls the listFiles helper, and returns a formatted response with file names.
case 'osc_list_files': { const args = ListFilesSchema.parse(request.params.arguments); const files = await listFiles(args.name, args.bucket, context); return { content: [ { type: 'text', text: `Files in bucket '${args.bucket}' on MinIO instance '${args.name}':` } ].concat( files.map((file) => ({ type: 'text', text: file })) ) }; } - src/tools/osc.ts:166-181 (helper)The listFiles helper function called by the handler. It resolves the MinIO instance from context and delegates to listFilesInMinioBucket.
export async function listFiles( name: string, bucket: string, context: Context ) { const instance = await getMinioInstance(context, name); if (!instance) { throw new Error(`Minio instance with name ${name} not found`); } return await listFilesInMinioBucket( instance.endpoint, instance.accessKeyId, instance.secretAccessKey, bucket ); } - src/resources/minio_minio.ts:115-133 (helper)The low-level helper that connects to the MinIO instance and lists all objects in the bucket, returning their names as an array of strings.
export async function listFilesInMinioBucket( endpoint: string, accessKeyId: string, secretAccessKey: string, bucket: string ): Promise<string[]> { const minioClient = new Minio.Client({ endPoint: new URL(endpoint).hostname, accessKey: accessKeyId, secretKey: secretAccessKey }); const objects = await minioClient.listObjects(bucket, '', true); const fileList: string[] = []; for await (const obj of objects) { fileList.push(obj.name); } return fileList; } - src/schemas.ts:15-23 (schema)The Zod schema for validating input arguments of osc_list_files - requires 'name' (alphanumeric minio instance name) and 'bucket' (bucket name).
export const ListFilesSchema = z.object({ name: z .string() .regex(/^[a-z0-9]+$/) .describe('Name of the minio instance'), bucket: z.string().describe('Name of the bucket') }); export type ListFilesSchema = z.infer<typeof ListFilesSchema>; - src/tools/osc.ts:27-32 (registration)The tool registration entry for 'osc_list_files' inside listOscTools(), which is used by the MCP ListTools handler.
{ name: 'osc_list_files', description: 'List files in a bucket on Eyevinn Open Source Cloud Storage (OSC) Minio instance', inputSchema: zodToJsonSchema(ListFilesSchema) },