Skip to main content
Glama

uploadContentFileAboutOrganization

Upload organizational content files to the Content Server, specifying file content, name, and user roles for secure storage and management.

Instructions

Upload content file about the organization

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesThe file content to upload
fileNameYesThe file name
roleNoThe roles of the user

Implementation Reference

  • The handler function implementing the tool logic. It receives file content, filename, and optional role, then calls RagService.upload_file to perform the upload and returns a success message.
    def upload_content_file_about_organization(self, file: str, file_name: str, role: str = "") -> list[str]: """ Upload content file about the organization. Args: file: The file content to upload file_name: The file name (required) role: The roles of the user Returns: Success message """ self.rag_service.upload_file(file, file_name, role, self.user_id_from_environment) return ["File uploaded successfully"]
  • JSON input schema defining parameters: file (required string), fileName (required string), role (optional string).
    inputSchema={ "type": "object", "properties": { "file": { "type": "string", "description": "The file content to upload" }, "fileName": { "type": "string", "description": "The file name" }, "role": { "type": "string", "description": "The roles of the user" } }, "required": ["file", "fileName"], "additionalProperties": False }
  • mcp_server.py:164-173 (registration)
    Tool dispatch logic in the MCP call_tool handler, validating arguments and invoking the RagTools handler.
    elif name == "uploadContentFileAboutOrganization": if "file" not in arguments or "fileName" not in arguments: raise ValueError("file and fileName parameters are required") result = rag_tools.upload_content_file_about_organization( arguments["file"], arguments["fileName"], arguments.get("role", "") ) logger.debug(f"Tool {name} executed successfully") return [types.TextContent(type="text", text=str(result))]
  • Supporting function that handles the actual file upload via HTTP POST to the content service, including temp file creation and cleanup.
    def upload_file(self, content: str, file_name: str, role: str, user_id: str = "invalid") -> None: """Upload content file about the organization""" url = f"{self.content_service_url}/contents/file" headers = {'userId': user_id} # Create temporary file temp_file = self._convert_string_to_file(content, file_name) try: with open(temp_file, 'rb') as f: files = {'file': (file_name, f, 'text/plain')} data = { 'role': role, 'userId': user_id } response = requests.post(url, files=files, data=data, headers=headers) response.raise_for_status() except requests.RequestException as e: print(f"Error uploading file: {e}") raise finally: # Clean up temporary file if temp_file.exists(): temp_file.unlink()

Other Tools

Related 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/yogeshkulkarni553/rag-mcp-py'

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