Skip to main content
Glama
snilld-ai

OpenAI Assistant MCP Server

by snilld-ai

list-files

Retrieve available files for OpenAI assistants to access and use in conversations or tasks.

Instructions

List files available for assistants

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler logic for the 'list-files' tool, which delegates to LLMConnector.list_files() and formats the list of files as text content.
    elif name == "list-files": response = await connector.list_files() files_str = "\\n".join([f"- ID: {f.id}, Name: {f.filename}, Size: {f.bytes} bytes" for f in response]) if not files_str: files_str = "No files found." return [types.TextContent(type="text", text=f"Available Files:\\n{files_str}")]
  • The core implementation of listing OpenAI assistant files using the OpenAI client API.
    async def list_files(self): try: response = await self.client.files.list(purpose="assistants") return response.data except Exception as e: logger.error(f"Failed to list files: {str(e)}") raise
  • Registration of the 'list-files' tool in the server's list_tools() method, including its schema with no required inputs.
    types.Tool( name="list-files", description="List files available for assistants", inputSchema={"type": "object", "properties": {}} ),

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/snilld-ai/openai-assistant-mcp'

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