list_data_files
Retrieve a list of available data files in the data directory, optionally filtered by file type, to access Old School RuneScape game data and Wiki resources.
Instructions
List available data files in the data directory.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fileType | No | Optional filter for file type (e.g., 'txt') |
Implementation Reference
- index.ts:225-238 (handler)The core handler function that reads the data directory and returns a list of files, optionally filtered by file type extension.function listDataFiles(fileType?: string): string[] { try { const files = fs.readdirSync(DATA_DIR); if (fileType) { return files.filter(file => file.endsWith(`.${fileType}`)); } return files; } catch (error) { console.error("Error listing data files:", error); return []; } }
- index.ts:66-68 (schema)Zod schema defining the optional 'fileType' input parameter for the tool.const ListDataFilesSchema = z.object({ fileType: z.string().optional().describe("Optional filter for file type (e.g., 'txt')") });
- index.ts:334-337 (registration)Tool registration in the listTools handler, including name, description, and input schema.name: "list_data_files", description: "List available data files in the data directory.", inputSchema: convertZodToJsonSchema(ListDataFilesSchema), },
- index.ts:435-439 (handler)Dispatcher case in the main CallToolRequestSchema handler that parses args and invokes the listDataFiles function.case "list_data_files": const { fileType } = ListDataFilesSchema.parse(args); const files = listDataFiles(fileType); return responseToString({ files, path: DATA_DIR });