@@ -537,6 +537,26 @@ const deleteBlockTool: Tool = {
537
537
} ,
538
538
} ;
539
539
540
+ const updateBlockTool : Tool = {
541
+ name : "notion_update_block" ,
542
+ description : "Update the content of a block in Notion based on its type. The update replaces the entire value for a given field." ,
543
+ inputSchema : {
544
+ type : "object" ,
545
+ properties : {
546
+ block_id : {
547
+ type : "string" ,
548
+ description : "The ID of the block to update." + commonIdDescription ,
549
+ } ,
550
+ block : {
551
+ type : "object" ,
552
+ description : "The updated content for the block. Must match the block's type schema." ,
553
+ } ,
554
+ format : formatParameter ,
555
+ } ,
556
+ required : [ "block_id" , "block" ] ,
557
+ } ,
558
+ } ;
559
+
540
560
// Pages
541
561
const retrievePageTool : Tool = {
542
562
name : "notion_retrieve_page" ,
@@ -951,6 +971,16 @@ export class NotionClientWrapper {
951
971
return response . json ( ) ;
952
972
}
953
973
974
+ async updateBlock ( block_id : string , block : Partial < BlockResponse > ) : Promise < BlockResponse > {
975
+ const response = await fetch ( `${ this . baseUrl } /blocks/${ block_id } ` , {
976
+ method : "PATCH" ,
977
+ headers : this . headers ,
978
+ body : JSON . stringify ( block ) ,
979
+ } ) ;
980
+
981
+ return response . json ( ) ;
982
+ }
983
+
954
984
async retrievePage ( page_id : string ) : Promise < PageResponse > {
955
985
const response = await fetch ( `${ this . baseUrl } /pages/${ page_id } ` , {
956
986
method : "GET" ,
@@ -1263,6 +1293,18 @@ async function main() {
1263
1293
break ;
1264
1294
}
1265
1295
1296
+ case "notion_update_block" : {
1297
+ const args = request . params . arguments as unknown as {
1298
+ block_id : string ;
1299
+ block: Partial < BlockResponse > ;
1300
+ } ;
1301
+ if ( ! args . block_id || ! args . block ) {
1302
+ throw new Error ( "Missing required arguments: block_id and block" ) ;
1303
+ }
1304
+ response = await notionClient . updateBlock ( args . block_id , args . block ) ;
1305
+ break ;
1306
+ }
1307
+
1266
1308
case "notion_retrieve_page" : {
1267
1309
const args = request . params
1268
1310
. arguments as unknown as RetrievePageArgs ;
@@ -1456,6 +1498,7 @@ async function main() {
1456
1498
retrieveBlockTool ,
1457
1499
retrieveBlockChildrenTool ,
1458
1500
deleteBlockTool ,
1501
+ updateBlockTool ,
1459
1502
retrievePageTool ,
1460
1503
updatePagePropertiesTool ,
1461
1504
listAllUsersTool ,
0 commit comments