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(),
          ),
        ],
      };
    });
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It discloses the return format (markdown table with specific fields) which is valuable behavioral information. However, it doesn't mention important traits like whether this is a read-only operation, if it requires authentication, rate limits, or pagination behavior. The description adds some context but leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise and well-structured in two sentences. The first sentence states the purpose and usage guidelines, while the second specifies the return format. Every word earns its place with zero waste or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description provides the return format which is essential. However, for a tool that lists resources, it doesn't mention important contextual details like whether it returns all files or is filtered/scoped, sorting behavior (especially relevant for 'most recent' queries), or error conditions. The description is adequate but has clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage. The description doesn't need to explain any parameters, and it appropriately doesn't attempt to do so. A baseline of 4 is appropriate since there are no parameters to document, and the description focuses on its actual purpose rather than parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: to list available files and resources, with specific examples of user requests that should trigger its use. It distinguishes itself from sibling tools (FLUX_1-schnell-infer and search-spaces) by focusing on file enumeration rather than inference or space searching. However, it doesn't explicitly contrast with these siblings, keeping it from a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage context: 'If the User requests things like 'most recent image' or 'the audio' use this tool to identify the intended resource.' This gives explicit when-to-use guidance with concrete examples. It doesn't mention when NOT to use it or explicitly name alternatives among siblings, preventing a score of 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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