MCPcopy
hub / github.com/MiniMax-AI/cli / run

Function run

src/commands/file/list.ts:17–48  ·  view source on GitHub ↗
(config: Config, _flags: GlobalFlags)

Source from the content-addressed store, hash-verified

15 'mmx file list --output json',
16 ],
17 async run(config: Config, _flags: GlobalFlags) {
18 const format = detectOutputFormat(config.output);
19
20 if (config.dryRun) {
21 process.stdout.write('Would list uploaded files.\n');
22 return;
23 }
24
25 const url = fileListEndpoint(config.baseUrl);
26 const response = await requestJson<FileListResponse>(config, { url, method: 'GET' });
27
28 if (format !== 'text') {
29 process.stdout.write(formatOutput(response, format) + '\n');
30 return;
31 }
32
33 if (!response.files || response.files.length === 0) {
34 process.stdout.write('No files found.\n');
35 return;
36 }
37
38 const tableData = response.files.map((f) => ({
39 ID: f.file_id,
40 FILENAME: f.filename,
41 PURPOSE: f.purpose,
42 SIZE_KB: (f.bytes / 1024).toFixed(1),
43 CREATED: new Date(f.created_at * 1000).toISOString().slice(0, 16).replace('T', ' '),
44 }));
45
46 const { formatTable } = await import('../../output/text');
47 process.stdout.write(formatTable(tableData) + '\n');
48 },
49});

Callers

nothing calls this directly

Calls 4

detectOutputFormatFunction · 0.90
fileListEndpointFunction · 0.90
formatOutputFunction · 0.90
formatTableFunction · 0.85

Tested by

no test coverage detected