tables_db_create_email_column
Add an email column to an Appwrite database table to store and validate email addresses, supporting required fields, default values, and array formats.
Instructions
Create an email column.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database_id | Yes | Database ID. | |
| table_id | Yes | Table ID. | |
| key | Yes | Column Key. | |
| required | Yes | Is column required? | |
| default | No | Default value for column when not provided. Cannot be set when column is required. | |
| array | No | Is column an array? |
Implementation Reference
- src/mcp_server_appwrite/server.py:70-71 (registration)Registers the TablesDB service with service name 'tables_db'. This service dynamically generates MCP tools for each public method on the TablesDB instance, naming them as 'tables_db_{method_name}', thus creating the 'tables_db_create_email_column' tool.if args.tables_db: tools_manager.register_service(Service(TablesDB(client), "tables_db"))
- The generic MCP tool call handler that retrieves the tool implementation from the registry (the bound TablesDB.create_email_column method) and executes it with user-provided arguments, formatting the result as text content.@server.call_tool() async def handle_call_tool( name: str, arguments: dict | None ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: try: tool_info = tools_manager.get_tool(name) if not tool_info: raise McpError(f"Tool {name} not found") bound_method = tool_info["function"] result = bound_method(**(arguments or {})) if hasattr(result, 'to_dict'): result_dict = result.to_dict() return [types.TextContent(type="text", text=str(result_dict))] return [types.TextContent(type="text", text=str(result))] except AppwriteException as e: return [types.TextContent(type="text", text=f"Appwrite Error: {str(e)}")] except Exception as e: return [types.TextContent(type="text", text=f"Error: {str(e)}")]
- Dynamically generates the JSON schema for the tool input based on the method signature, type hints, and docstring of TablesDB.create_email_column.tool_definition = Tool( name=tool_name, description=f"{docstring.short_description or "No description available"}", inputSchema={ "type": "object", "properties": properties, "required": required } )
- Constructs the tool name 'tables_db_create_email_column' by prefixing the service name 'tables_db' to the original method name 'create_email_column'.tool_name = self._method_name_overrides.get(name, f"{self.service_name}_{name}")
- src/mcp_server_appwrite/tool_manager.py:13-13 (registration)Updates the global tools registry with all tools from the registered service, including 'tables_db_create_email_column'.self.tools_registry.update(service.list_tools())