{
  "service": "feishu",
  "displayName": "Feishu",
  "categories": [
    "Productivity",
    "Storage"
  ],
  "authTypes": [
    "oauth2"
  ],
  "auth": [
    {
      "type": "oauth2",
      "authorizationUrl": "https://accounts.feishu.cn/open-apis/authen/v1/authorize",
      "tokenUrl": "https://open.feishu.cn/open-apis/authen/v2/oauth/token",
      "scopes": [
        "offline_access",
        "docx:document:readonly",
        "bitable:app:readonly"
      ],
      "tokenEndpointAuthMethod": "client_secret_post",
      "tokenRequestFormat": "json"
    }
  ],
  "homepageUrl": "https://www.feishu.cn",
  "actions": [
    {
      "id": "feishu.get_current_user",
      "service": "feishu",
      "name": "get_current_user",
      "description": "Get the profile of the Feishu user who authorized this connection, using their user_access_token.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "No input is required."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "openId": {
            "anyOf": [
              {
                "type": "string",
                "description": "The open_id of the authorized user, scoped to this OAuth app."
              },
              {
                "type": "null"
              }
            ]
          },
          "unionId": {
            "anyOf": [
              {
                "type": "string",
                "description": "The union_id of the authorized user, scoped to the developer account."
              },
              {
                "type": "null"
              }
            ]
          },
          "userId": {
            "anyOf": [
              {
                "type": "string",
                "description": "The tenant-scoped user_id of the authorized user."
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "anyOf": [
              {
                "type": "string",
                "description": "The display name of the authorized user."
              },
              {
                "type": "null"
              }
            ]
          },
          "enName": {
            "anyOf": [
              {
                "type": "string",
                "description": "The English name of the authorized user."
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "description": "The email of the authorized user, when the user granted it."
              },
              {
                "type": "null"
              }
            ]
          },
          "avatarUrl": {
            "anyOf": [
              {
                "type": "string",
                "description": "The avatar URL of the authorized user."
              },
              {
                "type": "null"
              }
            ]
          },
          "tenantKey": {
            "anyOf": [
              {
                "type": "string",
                "description": "The tenant key the authorized user belongs to."
              },
              {
                "type": "null"
              }
            ]
          },
          "raw": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "The raw user_info object returned by Feishu."
          }
        },
        "additionalProperties": false,
        "description": "The authenticated Feishu user profile."
      }
    },
    {
      "id": "feishu.get_document",
      "service": "feishu",
      "name": "get_document",
      "description": "Get a Feishu docx document's basic metadata (title and revision) that the authorized user can read.",
      "requiredScopes": [
        "docx:document:readonly"
      ],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "minLength": 1,
            "description": "The docx document id, from the document URL (.../docx/<document_id>)."
          }
        },
        "additionalProperties": false,
        "description": "Identify the document to read."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "description": "The document id (docx document_id)."
          },
          "revisionId": {
            "anyOf": [
              {
                "type": "integer",
                "description": "The current document revision number."
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "anyOf": [
              {
                "type": "string",
                "description": "The document title."
              },
              {
                "type": "null"
              }
            ]
          },
          "raw": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "The raw document object returned by Feishu."
          }
        },
        "additionalProperties": false,
        "description": "A Feishu docx document's basic metadata."
      }
    },
    {
      "id": "feishu.get_document_content",
      "service": "feishu",
      "name": "get_document_content",
      "description": "Read the full plain-text content of a Feishu docx document the authorized user can access.",
      "requiredScopes": [
        "docx:document:readonly"
      ],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "minLength": 1,
            "description": "The docx document id, from the document URL (.../docx/<document_id>)."
          },
          "lang": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1,
            "description": "Language for @user mentions in the text: 0 = default name, 1 = English name."
          }
        },
        "additionalProperties": false,
        "required": [
          "documentId"
        ],
        "description": "Identify the document to read."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "description": "The document id whose content was read."
          },
          "content": {
            "type": "string",
            "description": "The full plain-text content of the document."
          }
        },
        "additionalProperties": false,
        "description": "The plain-text content of a Feishu docx document."
      }
    },
    {
      "id": "feishu.list_bitable_fields",
      "service": "feishu",
      "name": "list_bitable_fields",
      "description": "List the fields (columns) of a Feishu Bitable table, to understand its schema before reading rows.",
      "requiredScopes": [
        "bitable:app:readonly"
      ],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "appToken": {
            "type": "string",
            "minLength": 1,
            "description": "The Bitable app token, from the Base URL (.../base/<app_token>)."
          },
          "tableId": {
            "type": "string",
            "minLength": 1,
            "description": "The Bitable table id (starts with tbl), from the URL (?table=<table_id>)."
          },
          "viewId": {
            "type": "string",
            "description": "Restrict fields to a specific view id (optional)."
          },
          "pageSize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Number of fields per page (max 100, default 20)."
          },
          "pageToken": {
            "type": "string",
            "description": "The page token returned by a previous call; omit for the first page."
          }
        },
        "additionalProperties": false,
        "required": [
          "appToken",
          "tableId"
        ],
        "description": "Identify the Bitable table and page through its fields."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": true,
              "description": "A Bitable field {field_id, field_name, type, property, ui_type}."
            },
            "description": "The items on this page."
          },
          "pageToken": {
            "anyOf": [
              {
                "type": "string",
                "description": "The token to fetch the next page, when hasMore is true."
              },
              {
                "type": "null"
              }
            ]
          },
          "hasMore": {
            "anyOf": [
              {
                "type": "boolean",
                "description": "Whether more pages are available."
              },
              {
                "type": "null"
              }
            ]
          },
          "total": {
            "anyOf": [
              {
                "type": "integer",
                "description": "The total number of items, when the API reports it."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "description": "A page of Bitable fields."
      }
    },
    {
      "id": "feishu.list_bitable_tables",
      "service": "feishu",
      "name": "list_bitable_tables",
      "description": "List the data tables in a Feishu Bitable (多维表格) the authorized user can access.",
      "requiredScopes": [
        "bitable:app:readonly"
      ],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "appToken": {
            "type": "string",
            "minLength": 1,
            "description": "The Bitable app token, from the Base URL (.../base/<app_token>)."
          },
          "pageSize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Number of tables per page (max 100, default 20)."
          },
          "pageToken": {
            "type": "string",
            "description": "The page token returned by a previous call; omit for the first page."
          }
        },
        "additionalProperties": false,
        "required": [
          "appToken"
        ],
        "description": "Identify the Bitable app and page through its tables."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": true,
              "description": "A Bitable table {table_id, name, revision}."
            },
            "description": "The items on this page."
          },
          "pageToken": {
            "anyOf": [
              {
                "type": "string",
                "description": "The token to fetch the next page, when hasMore is true."
              },
              {
                "type": "null"
              }
            ]
          },
          "hasMore": {
            "anyOf": [
              {
                "type": "boolean",
                "description": "Whether more pages are available."
              },
              {
                "type": "null"
              }
            ]
          },
          "total": {
            "anyOf": [
              {
                "type": "integer",
                "description": "The total number of items, when the API reports it."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "description": "A page of Bitable tables."
      }
    },
    {
      "id": "feishu.list_document_blocks",
      "service": "feishu",
      "name": "list_document_blocks",
      "description": "List a Feishu docx document's structured blocks (one page), for reading document structure and rich content.",
      "requiredScopes": [
        "docx:document:readonly"
      ],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "minLength": 1,
            "description": "The docx document id, from the document URL (.../docx/<document_id>)."
          },
          "pageSize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "description": "Number of blocks per page (max 500, default 500)."
          },
          "pageToken": {
            "type": "string",
            "description": "The page token returned by a previous call; omit for the first page."
          },
          "documentRevisionId": {
            "type": "integer",
            "minimum": -1,
            "description": "Document revision to read; -1 (default) reads the latest version."
          },
          "userIdType": {
            "type": "string",
            "enum": [
              "open_id",
              "union_id",
              "user_id"
            ],
            "description": "The user id format for user fields in blocks."
          }
        },
        "additionalProperties": false,
        "required": [
          "documentId"
        ],
        "description": "Identify the document and page through its blocks."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": true,
              "description": "A raw docx block object."
            },
            "description": "The items on this page."
          },
          "pageToken": {
            "anyOf": [
              {
                "type": "string",
                "description": "The token to fetch the next page, when hasMore is true."
              },
              {
                "type": "null"
              }
            ]
          },
          "hasMore": {
            "anyOf": [
              {
                "type": "boolean",
                "description": "Whether more pages are available."
              },
              {
                "type": "null"
              }
            ]
          },
          "total": {
            "anyOf": [
              {
                "type": "integer",
                "description": "The total number of items, when the API reports it."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "description": "A page of a Feishu docx document's structured blocks."
      }
    },
    {
      "id": "feishu.search_bitable_records",
      "service": "feishu",
      "name": "search_bitable_records",
      "description": "Read rows (records) from a Feishu Bitable table, with optional field selection, filter, and sort.",
      "requiredScopes": [
        "bitable:app:readonly"
      ],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "appToken": {
            "type": "string",
            "minLength": 1,
            "description": "The Bitable app token, from the Base URL (.../base/<app_token>)."
          },
          "tableId": {
            "type": "string",
            "minLength": 1,
            "description": "The Bitable table id (starts with tbl), from the URL (?table=<table_id>)."
          },
          "viewId": {
            "type": "string",
            "description": "Query records visible in a specific view id (optional)."
          },
          "fieldNames": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "A Bitable field name."
            },
            "description": "Restrict returned fields to these field names (optional, max 200).",
            "maxItems": 200
          },
          "filter": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "A Feishu Bitable filter condition group (optional)."
          },
          "sort": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": true,
              "description": "A sort condition."
            },
            "description": "Sort conditions, each { field_name, desc } (optional, max 100).",
            "maxItems": 100
          },
          "pageSize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "description": "Number of records per page (max 500, default 20)."
          },
          "pageToken": {
            "type": "string",
            "description": "The page token returned by a previous call; omit for the first page."
          },
          "userIdType": {
            "type": "string",
            "enum": [
              "open_id",
              "union_id",
              "user_id"
            ],
            "description": "The user id format for user fields in records."
          }
        },
        "additionalProperties": false,
        "required": [
          "appToken",
          "tableId"
        ],
        "description": "Identify the Bitable table and query its records."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": true,
              "description": "A Bitable record {record_id, fields}."
            },
            "description": "The items on this page."
          },
          "pageToken": {
            "anyOf": [
              {
                "type": "string",
                "description": "The token to fetch the next page, when hasMore is true."
              },
              {
                "type": "null"
              }
            ]
          },
          "hasMore": {
            "anyOf": [
              {
                "type": "boolean",
                "description": "Whether more pages are available."
              },
              {
                "type": "null"
              }
            ]
          },
          "total": {
            "anyOf": [
              {
                "type": "integer",
                "description": "The total number of items, when the API reports it."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "description": "A page of Bitable records."
      }
    }
  ]
}
