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

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the return format (markdown table with specific fields) which is valuable, but doesn't mention important behavioral aspects like whether this lists all files or has pagination, if it requires authentication, or any rate limits. It adds some context but leaves 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 efficiently structured in two sentences: the first states the purpose and usage context, the second specifies the return format. Every sentence adds value with no redundant information, making it appropriately sized and front-loaded.

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

Completeness4/5

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

Given the tool's simplicity (0 parameters, no annotations, no output schema), the description provides sufficient context about what the tool does, when to use it, and what it returns. However, it could be more complete by explicitly differentiating from sibling tools and mentioning any behavioral constraints like access limitations.

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, so the schema already fully documents the lack of parameters. The description appropriately doesn't add parameter information beyond what's in the schema, maintaining focus on the tool's purpose and output. This meets the baseline expectation for a zero-parameter tool.

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: listing available files and resources with specific attributes. It uses the verb 'returns' and specifies the resource type ('files and resources'), but doesn't explicitly differentiate from sibling tools like 'search-spaces' which might have overlapping functionality.

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 guidance on when to use this tool: when the user requests specific resources like 'most recent image' or 'the audio'. However, it doesn't explicitly state when NOT to use it or mention alternatives among the sibling tools, leaving some ambiguity about tool selection.

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

Deploy Server

Other Tools