Skip to main content
Glama

check_if_file_exists

Verify the existence of a file (notebook) in the user's shared space. Provides a JSON response indicating file status, including existence and a descriptive message.

Instructions

Check if a file (notebook) exists in the user's shared space. Args: file_name: Name of the file to check (with or without .ipynb extension) Returns: JSON object with the file existence status { "exists": True/False, "message": "File exists" or "File does not exist" }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ctxNo
file_nameYes

Implementation Reference

  • The handler function implementing the logic to check if a specified file exists in the user's shared or personal space using the SingleStoreDB file manager SDK.
    def check_if_file_exists(file_name: str, location: str = "shared") -> bool: """ Check if a file exists in the user's shared or personal space. Args: file_name: Name of the file to check (with or without .ipynb extension) location: Location to check ("shared" or "personal") Returns: Boolean indicating whether the file exists """ settings = config.get_settings() org_id = get_org_id() access_token = get_access_token() file_manager = s2.manage_files( access_token=access_token, base_url=settings.s2_api_base_url, organization_id=org_id, ) if location == "shared": return file_manager.shared_space.exists(file_name) else: # personal try: return file_manager.personal_space.exists(file_name) except AttributeError: # If personal space is not supported, return False logger.warning("Personal space not supported by SDK") return False

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/singlestore-labs/mcp-server-singlestore'

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