tables_db_update_datetime_column
Modify a datetime column's properties in Appwrite database tables, including requirements and default values, without affecting existing data.
Instructions
Update a date time column. Changing the default value will not update already existing rows.
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 | Yes | Default value for column when not provided. Cannot be set when column is required. | |
| new_key | No | New Column Key. |
Implementation Reference
- src/mcp_server_appwrite/server.py:70-72 (registration)Registers the TablesDB Appwrite service with name 'tables_db'. This service dynamically generates MCP tools for each public method, prefixed with 'tables_db_', so 'update_datetime_column' becomes 'tables_db_update_datetime_column'.if args.tables_db: tools_manager.register_service(Service(TablesDB(client), "tables_db")) if args.users:
- Generic handler for all MCP tools. For 'tables_db_update_datetime_column', it retrieves the bound method from TablesDB.update_datetime_column and executes it with the provided arguments.@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's input parameters based on the Appwrite method's type hints, docstring, and signature. Used for all tools including this one.tool_definition = Tool( name=tool_name, description=f"{docstring.short_description or "No description available"}", inputSchema={ "type": "object", "properties": properties, "required": required } )
- src/mcp_server_appwrite/tool_manager.py:10-13 (registration)ToolManager.register_service adds the tools from a service (including all tables_db tools) to the global registry used by list_tools and call_tool.def register_service(self, service: Service): """Register a new service and its tools""" self.services.append(service) self.tools_registry.update(service.list_tools())
- Parses method parameters to build 'properties' and 'required' for the inputSchema of each tool.for param_name, param in signature.parameters.items(): if param_name == 'self': continue param_type = type_hints.get(param_name, str) properties[param_name] = self.python_type_to_json_schema(param_type) properties[param_name]["description"] = f"Parameter '{param_name}'" for doc_param in docstring.params: if doc_param.arg_name == param_name: properties[param_name]["description"] = doc_param.description if param.default is param.empty: required.append(param_name)