Skip to main content
Glama

available-files

List available files and resources in HuggingFace Spaces, including images, audio, and text, with details like URI, size, and modification date.

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Executes the 'available-files' tool by invoking WorkingDirectory.generateResourceTable() to produce a markdown table of available resources, packaged as a text/markdown resource.
    if (AVAILABLE_FILES === request.params.name) { return { content: [ { type: `resource`, resource: { uri: `resource://mcp-hfspace/available-files`, mimeType: `text/markdown`, text: await workingDir.generateResourceTable(), }, }, ], }; }
  • Core helper function that lists files in the working directory, formats their details (URI, name, MIME type, size, last modified) into a markdown table, 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(); }
  • Tool schema definition provided in ListTools response: name 'available-files', detailed description, and empty input schema (no parameters required).
    { 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/index.ts:77-115 (registration)
    Registers the 'available-files' tool by including it in the ListTools response alongside dynamic endpoint tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { 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: {}, }, }, { name: SEARCH_FOR_SPACE, description: "Use semantic search to find an endpoint on the `Hugging Face Spaces` service. The search term will usually " + "be 3-7 words describing a task or activity the Person is trying to accomplish. The results are returned in a markdown table. " + "Present all results to the Person. Await specific guidance from the Person before making further Tool calls.", inputSchema: { type: "object", properties: { query: { type: "string", // TODO description assumes user is using claude desktop which has knowledge of HF Spaces. // consider updating for not CLAUDE_DESKTOP mode. 3.7 sys prompt refers to Human as Person description: "The semantic search term to use.", }, }, }, }, ...Array.from(endpoints.values()).map((endpoint) => endpoint.toolDefinition(), ), ], }; });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/evalstate/mcp-hfspace'

If you have feedback or need assistance with the MCP directory API, please join our Discord server