update_survey_summary_property
Modify survey summary properties in Notion to update survey data, using property definitions from get_property_definition for accurate configuration.
Instructions
Update survey summary property
To know definition of properties, use `get_property_definition` tool in advance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page_id | Yes | ||
| updates | Yes |
Implementation Reference
- server.py:93-126 (handler)The handler function that implements the core logic for updating properties on a Notion survey summary page.def update_survey_summary_property(page_id: str, updates: list[SetPageProperty], ctx: Context): """ Update survey summary property To know definition of properties, use `get_property_definition` tool in advance. """ parent = notion.pages.retrieve(page_id) properties = parent["properties"] for update in updates: update.assert_type_and_value() if update.property_name not in properties: ctx.warning(f"Property {update.property_name} not found, skipping") continue prop = properties[update.property_name] if prop["type"] != update.type: ctx.warning(f"Property {update.property_name} is not of type {update.type}") continue type_ = prop["type"] if type_ == "number": prop[update.type] = float(update.number_value) elif type_ == "date": prop[update.type] = {"start": update.date_value} elif type_ == "rich_text": prop[update.type] = [{"type": "text", "text": {"content": update.rich_text_value}}] elif type_ == "select": prop[update.type] = {"id": update.selection_value} elif type_ == "multi_select": prop[update.type] = [{"id": v} for v in update.multi_select_values] elif type_ == "status": prop[update.type] = {"id": update.status_value} else: ctx.warning(f"Property {update.property_name} is of type {type_}, which is not supported yet.") continue return notion.pages.update(page_id, properties=properties)
- research_mcp/data/notion_ops.py:5-28 (schema)Pydantic model used for validating and structuring each property update in the tool's 'updates' parameter. Includes a validation method called by the handler.class SetPageProperty(BaseModel): property_name: str = Field(..., title="Property Name") type: str = Field(..., title="Type") rich_text_value: Optional[str] = Field(None, title="Rich text value. It must be a plain text. Only for rich_text.") number_value: Optional[float] = Field(None, title="Number property value, Only for number.") selection_value: Optional[str] = Field(None, title="Selection property value. It must be an option id. Only for select.") multi_select_values: Optional[list[str]] = Field(None, title="Multi select property Value. they must be option ids. Only for multi_select.") status_value: Optional[str] = Field(None, title="Status property value. It must be an option id. Only for status.") date_value: Optional[str] = Field(None, title="Date Value, Only for date.") def assert_type_and_value(self): if self.type == "rich_text" and self.rich_text_value is None: raise ValueError("Rich text value is required for rich_text type") if self.type == "number" and self.number_value is None: raise ValueError("Number value is required for number type") if self.type == "select" and self.selection_value is None: raise ValueError("Selection value is required for select type") if self.type == "multi_select" and self.multi_select_values is None: raise ValueError("Multi select values are required for multi_select type") if self.type == "status" and self.status_value is None: raise ValueError("Status value is required for status type") if self.type == "date" and self.date_value is None: raise ValueError("Date value is required for date type")
- server.py:92-92 (registration)The @mcp.tool() decorator that registers the update_survey_summary_property function as an MCP tool.@mcp.tool()
- server.py:86-90 (helper)Supporting tool to retrieve the property definitions/schema from the Notion database, recommended for use before updating properties.@mcp.tool() def get_property_definition(): """Get property definition for survey summary""" return notion.databases.retrieve(root_database_id)["properties"]