available-files
Identify and retrieve details of available files and resources, including URI, name, size, last modified date, and mime type, organized in a markdown table for quick reference.
Instructions
A list of available file and resources. If the User requests things like 'most recent image' or 'the audio' use this tool to identify the intended resource.This tool returns 'resource uri', 'name', 'size', 'last modified' and 'mime type' in a markdown table
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:98-111 (handler)Handler for calling the 'available-files' tool. Returns a resource containing a markdown table of available files generated by WorkingDirectory.generateResourceTable().if (AVAILABLE_FILES === request.params.name) { return { content: [ { type: `resource`, resource: { uri: `/available-files`, mimeType: `text/markdown`, text: await workingDir.generateResourceTable(), }, }, ], }; }
- src/index.ts:79-89 (registration)Registration of the 'available-files' tool in the ListToolsRequestSchema handler, including name, description, and input schema.name: AVAILABLE_FILES, description: "A list of available file and resources. " + "If the User requests things like 'most recent image' or 'the audio' use " + "this tool to identify the intended resource." + "This tool returns 'resource uri', 'name', 'size', 'last modified' and 'mime type' in a markdown table", inputSchema: { type: "object", properties: {}, }, },
- src/working_directory.ts:132-156 (helper)Core helper function that generates the markdown table of available resources used by the 'available-files' tool handler.async generateResourceTable(): Promise<string> { const files = await this.listFiles(); const resources = await Promise.all( files .filter((entry) => entry.isFile()) .map(async (entry) => await this.getResourceFile(entry)), ); if (resources.length === 0) { return "No resources available."; } return ` The following resources are available for tool calls: | Resource URI | Name | MIME Type | Size | Last Modified | |--------------|------|-----------|------|---------------| ${resources .map( (f) => `| ${f.uri} | ${f.name} | ${f.mimeType} | ${this.formatFileSize(f.size)} | ${f.lastModified.toISOString()} |`, ) .join("\n")} Prefer using the Resource URI for tool parameters which require a file input. URLs are also accepted.`.trim(); }