Skip to main content
Glama

Notion MCP Server

by huazhengwang
models.py13.3 kB
# generated by fastapi-codegen: # filename: openapi.yaml # timestamp: 2025-07-07T17:02:39+00:00 from __future__ import annotations from enum import Enum from typing import Any, Dict, List, Optional from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, RootModel, constr class V1BlocksBlockIdPatchRequest(BaseModel): archived: Optional[bool] = Field( True, description='Set to true to archive (delete) a block. Set to false to un-archive (restore) a block.', ) type: Optional[Dict[str, Any]] = Field( None, description='The [block object `type`](ref:block#block-object-keys) value with the properties to be updated. Currently only `text` (for supported block types) and `checked` (for `to_do` blocks) fields can be updated.', ) class Link(BaseModel): url: str class Text(BaseModel): model_config = ConfigDict( extra='forbid', ) content: str link: Optional[Link] = None class Type(Enum): text = 'text' class RichTextItem(BaseModel): model_config = ConfigDict( extra='forbid', ) text: Text type: Optional[Type] = None class BulletedListItem(BaseModel): model_config = ConfigDict( extra='forbid', ) rich_text: List[RichTextItem] = Field(..., max_length=100) class Text1(BaseModel): model_config = ConfigDict( extra='forbid', ) content: str link: Optional[Link] = None class RichTextItem1(BaseModel): model_config = ConfigDict( extra='forbid', ) text: Text1 type: Optional[Type] = None class Paragraph(BaseModel): model_config = ConfigDict( extra='forbid', ) rich_text: List[RichTextItem1] = Field(..., max_length=100) class Type2(Enum): paragraph = 'paragraph' bulleted_list_item = 'bulleted_list_item' class Child(BaseModel): model_config = ConfigDict( extra='forbid', ) bulleted_list_item: Optional[BulletedListItem] = None paragraph: Optional[Paragraph] = None type: Optional[Type2] = None class V1BlocksBlockIdChildrenPatchRequest(BaseModel): after: Optional[str] = Field( None, description='The ID of the existing block that the new block should be appended after.', ) children: List[Child] = Field( ..., description='Child content to append to a container block as an array of [block objects](ref:block)', ) class Parent(BaseModel): page_id: str = Field(..., description='the page ID') class Text2(BaseModel): content: str = Field(..., description='The content of the comment') class RichTextItem2(BaseModel): text: Text2 class V1CommentsPostRequest(BaseModel): parent: Parent = Field(..., description='The page that contains the comment') rich_text: List[RichTextItem2] class Type3(Enum): page_id = 'page_id' class Parent1(BaseModel): page_id: UUID type: Type3 class Properties(BaseModel): model_config = ConfigDict( extra='forbid', ) description: Optional[constr(min_length=1, max_length=280)] = None title: Dict[str, Any] class Text3(BaseModel): model_config = ConfigDict( extra='forbid', ) content: str link: Optional[Link] = None class Type4(Enum): text = 'text' class TitleItem(BaseModel): model_config = ConfigDict( extra='forbid', ) text: Text3 type: Optional[Type4] = None class V1DatabasesPostRequest(BaseModel): parent: Parent1 properties: Dict[str, Properties] = Field( ..., description='Property schema of database. The keys are the names of properties as they appear in Notion and the values are [property schema objects](https://developers.notion.com/reference/property-schema-object).', ) title: Optional[List[TitleItem]] = Field(None, max_length=100) class Text4(BaseModel): model_config = ConfigDict( extra='forbid', ) content: str link: Optional[Link] = None class DescriptionItem(BaseModel): model_config = ConfigDict( extra='forbid', ) text: Text4 type: Optional[Type4] = None class Properties1(BaseModel): name: Optional[str] = None class Text5(BaseModel): model_config = ConfigDict( extra='forbid', ) content: str link: Optional[Link] = None class TitleItem1(BaseModel): model_config = ConfigDict( extra='forbid', ) text: Text5 type: Optional[Type4] = None class V1DatabasesDatabaseIdPatchRequest(BaseModel): model_config = ConfigDict( extra='forbid', ) description: Optional[List[DescriptionItem]] = Field( None, description='An array of [rich text objects](https://developers.notion.com/reference/rich-text) that represents the description of the database that is displayed in the Notion UI. If omitted, then the database description remains unchanged.', max_length=100, ) properties: Optional[Properties1] = Field( None, description='Property schema of database. The keys are the names of properties as they appear in Notion and the values are [property schema objects](https://developers.notion.com/reference/property-schema-object).', ) title: Optional[List[TitleItem1]] = Field( None, description='An array of [rich text objects](https://developers.notion.com/reference/rich-text) that represents the title of the database that is displayed in the Notion UI. If omitted, then the database title remains unchanged.', ) class Direction(Enum): ascending = 'ascending' descending = 'descending' class Sort(BaseModel): direction: Direction property: str class V1DatabasesDatabaseIdQueryPostRequest(BaseModel): archived: Optional[bool] = None filter: Optional[Dict[str, Any]] = Field( None, description='When supplied, limits which pages are returned based on the [filter conditions](ref:post-database-query-filter).', ) in_trash: Optional[bool] = None page_size: Optional[int] = Field( 100, description='The number of items from the full list desired in the response. Maximum: 100', ) sorts: Optional[List[Sort]] = Field( None, description='When supplied, orders the results based on the provided [sort criteria](ref:post-database-query-sort).', ) start_cursor: Optional[str] = Field( None, description='When supplied, returns a page of results starting after the cursor provided. If not supplied, this endpoint will return the first page of results.', ) class FilterProperties(RootModel[List[str]]): root: List[str] class Parent2(BaseModel): page_id: UUID class Text6(BaseModel): content: str class TitleItem2(BaseModel): text: Text6 class Type7(Enum): title = 'title' class Properties2(BaseModel): model_config = ConfigDict( extra='forbid', ) title: List[TitleItem2] = Field(..., max_length=100) type: Optional[Type7] = None class V1PagesPostRequest(BaseModel): children: Optional[List[str]] = Field( None, description='The content to be rendered on the new page, represented as an array of [block objects](https://developers.notion.com/reference/block).', ) cover: Optional[str] = Field( None, description='The cover image of the new page, represented as a [file object](https://developers.notion.com/reference/file-object).', ) icon: Optional[str] = Field( None, description='The icon of the new page. Either an [emoji object](https://developers.notion.com/reference/emoji-object) or an [external file object](https://developers.notion.com/reference/file-object)..', ) parent: Parent2 properties: Properties2 class External(BaseModel): model_config = ConfigDict( extra='forbid', ) url: str class Type8(Enum): external = 'external' class Cover(BaseModel): model_config = ConfigDict( extra='forbid', ) external: External type: Optional[Type8] = None class Icon(BaseModel): model_config = ConfigDict( extra='forbid', ) emoji: str class Text7(BaseModel): model_config = ConfigDict( extra='forbid', ) content: str link: Optional[Link] = None class Type9(Enum): text = 'text' class TitleItem3(BaseModel): model_config = ConfigDict( extra='forbid', ) text: Text7 type: Optional[Type9] = None class Type10(Enum): title = 'title' class Properties3(BaseModel): model_config = ConfigDict( extra='forbid', ) title: List[TitleItem3] = Field(..., max_length=100) type: Optional[Type10] = None class V1PagesPageIdPatchRequest(BaseModel): archived: Optional[bool] = None cover: Optional[Cover] = Field( None, description='A cover image for the page. Only [external file objects](https://developers.notion.com/reference/file-object) are supported.', ) icon: Optional[Icon] = Field( None, description='A page icon for the page. Supported types are [external file object](https://developers.notion.com/reference/file-object) or [emoji object](https://developers.notion.com/reference/emoji-object).', ) in_trash: Optional[bool] = Field( False, description='Set to true to delete a block. Set to false to restore a block.', ) properties: Optional[Properties3] = Field( None, description='The property values to update for the page. The keys are the names or IDs of the property and the values are property values. If a page property ID is not included, then it is not changed.', ) class Filter(BaseModel): property: Optional[str] = Field( None, description='The name of the property to filter by. Currently the only property you can filter by is the object type. Possible values include `object`. Limitation: Currently the only filter allowed is `object` which will filter by type of object (either `page` or `database`)', ) value: Optional[str] = Field( None, description='The value of the property to filter the results by. Possible values for object type include `page` or `database`. **Limitation**: Currently the only filter allowed is `object` which will filter by type of object (either `page` or `database`)', ) class Sort1(BaseModel): direction: Optional[str] = Field( None, description='The direction to sort. Possible values include `ascending` and `descending`.', ) timestamp: Optional[str] = Field( None, description='The name of the timestamp to sort against. Possible values include `last_edited_time`.', ) class V1SearchPostRequest(BaseModel): filter: Optional[Filter] = Field( None, description='A set of criteria, `value` and `property` keys, that limits the results to either only pages or only databases. Possible `value` values are `"page"` or `"database"`. The only supported `property` value is `"object"`.', ) page_size: Optional[int] = Field( 100, description='The number of items from the full list to include in the response. Maximum: `100`.', ) query: Optional[str] = Field( None, description='The text that the API compares page and database titles against.', ) sort: Optional[Sort1] = Field( None, description='A set of criteria, `direction` and `timestamp` keys, that orders the results. The **only** supported timestamp value is `"last_edited_time"`. Supported `direction` values are `"ascending"` and `"descending"`. If `sort` is not provided, then the most recently edited results are returned first.', ) start_cursor: Optional[str] = Field( None, description='A `cursor` value returned in a previous response that If supplied, limits the response to results starting after the `cursor`. If not supplied, then the first page of results is returned. Refer to [pagination](https://developers.notion.com/reference/intro#pagination) for more details.', ) class V1UsersGetResponse(BaseModel): pass class Person(BaseModel): email: Optional[str] = Field(None, examples=['christine@makenotion.com']) class User(BaseModel): avatar_url: Optional[Any] = None id: Optional[str] = Field(None, examples=['5389a034-eb5c-47b5-8a9e-f79c99ef166c']) name: Optional[str] = Field(None, examples=['christine makenotion']) object: Optional[str] = Field(None, examples=['user']) person: Optional[Person] = None type: Optional[str] = Field(None, examples=['person']) class Owner(BaseModel): type: Optional[str] = Field(None, examples=['user']) user: Optional[User] = None class Bot(BaseModel): owner: Optional[Owner] = None class V1UsersMeGetResponse(BaseModel): avatar_url: Optional[Any] = None bot: Optional[Bot] = None id: Optional[str] = Field(None, examples=['16d84278-ab0e-484c-9bdd-b35da3bd8905']) name: Optional[str] = Field(None, examples=['pied piper']) object: Optional[str] = Field(None, examples=['user']) type: Optional[str] = Field(None, examples=['bot']) class V1UsersUserIdGetResponse(BaseModel): pass

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/huazhengwang/notion-api'

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