@@ -16,7 +16,6 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
1616 bgColor : '#E0E0E0' ,
1717 icon : MicrosoftSharepointIcon ,
1818 subBlocks : [
19- // Operation selector
2019 {
2120 id : 'operation' ,
2221 title : 'Operation' ,
@@ -29,9 +28,9 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
2928 { label : 'Create List' , id : 'create_list' } ,
3029 { label : 'Read List' , id : 'read_list' } ,
3130 { label : 'Update List' , id : 'update_list' } ,
31+ { label : 'Add List Items' , id : 'add_list_items' } ,
3232 ] ,
3333 } ,
34- // Sharepoint Credentials
3534 {
3635 id : 'credential' ,
3736 title : 'Microsoft Account' ,
@@ -81,6 +80,7 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
8180 'create_list' ,
8281 'read_list' ,
8382 'update_list' ,
83+ 'add_list_items' ,
8484 ] ,
8585 } ,
8686 } ,
@@ -111,7 +111,7 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
111111 layout : 'full' ,
112112 placeholder : 'Enter list ID (GUID). Required for Update; optional for Read.' ,
113113 canonicalParamId : 'listId' ,
114- condition : { field : 'operation' , value : [ 'read_list' , 'update_list' ] } ,
114+ condition : { field : 'operation' , value : [ 'read_list' , 'update_list' , 'add_list_items' ] } ,
115115 } ,
116116
117117 {
@@ -178,7 +178,7 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
178178 layout : 'full' ,
179179 placeholder : 'Enter list item fields' ,
180180 canonicalParamId : 'listItemFields' ,
181- condition : { field : 'operation' , value : 'update_list' } ,
181+ condition : { field : 'operation' , value : [ 'update_list' , 'add_list_items' ] } ,
182182 } ,
183183 ] ,
184184 tools : {
@@ -189,6 +189,7 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
189189 'sharepoint_create_list' ,
190190 'sharepoint_get_list' ,
191191 'sharepoint_update_list' ,
192+ 'sharepoint_add_list_items' ,
192193 ] ,
193194 config : {
194195 tool : ( params ) => {
@@ -205,14 +206,15 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
205206 return 'sharepoint_get_list'
206207 case 'update_list' :
207208 return 'sharepoint_update_list'
209+ case 'add_list_items' :
210+ return 'sharepoint_add_list_items'
208211 default :
209212 throw new Error ( `Invalid Sharepoint operation: ${ params . operation } ` )
210213 }
211214 } ,
212215 params : ( params ) => {
213216 const { credential, siteSelector, manualSiteId, mimeType, ...rest } = params
214217
215- // Use siteSelector if provided, otherwise use manualSiteId
216218 const effectiveSiteId = ( siteSelector || manualSiteId || '' ) . trim ( )
217219
218220 const {
@@ -234,12 +236,10 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
234236 } )
235237 }
236238 }
237- // Ensure listItemFields is an object for the tool schema
238239 if ( typeof parsedItemFields !== 'object' || parsedItemFields === null ) {
239240 parsedItemFields = undefined
240241 }
241242
242- // Sanitize item ID (required by tool)
243243 const rawItemId = providedItemId ?? listItemId
244244 const sanitizedItemId =
245245 rawItemId === undefined || rawItemId === null
@@ -252,10 +252,9 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
252252 return undefined
253253 }
254254
255- // Debug logging for update_list param mapping
256- if ( others . operation === 'update_list' ) {
255+ if ( others . operation === 'update_list' || others . operation === 'add_list_items' ) {
257256 try {
258- logger . info ( 'SharepointBlock update_list param check' , {
257+ logger . info ( 'SharepointBlock list item param check' , {
259258 siteId : effectiveSiteId || undefined ,
260259 listId : ( others as any ) ?. listId ,
261260 listTitle : ( others as any ) ?. listTitle ,
@@ -275,7 +274,6 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
275274 pageSize : others . pageSize ? Number . parseInt ( others . pageSize as string , 10 ) : undefined ,
276275 mimeType : mimeType ,
277276 ...others ,
278- // Map to tool param names
279277 itemId : sanitizedItemId ,
280278 listItemFields : parsedItemFields ,
281279 includeColumns : coerceBoolean ( includeColumns ) ,
@@ -287,26 +285,20 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
287285 inputs : {
288286 operation : { type : 'string' , description : 'Operation to perform' } ,
289287 credential : { type : 'string' , description : 'Microsoft account credential' } ,
290- // Create Page operation inputs
291288 pageName : { type : 'string' , description : 'Page name' } ,
292289 pageContent : { type : 'string' , description : 'Page content' } ,
293290 pageTitle : { type : 'string' , description : 'Page title' } ,
294- // Read Page operation inputs
295291 pageId : { type : 'string' , description : 'Page ID' } ,
296- // List operation inputs
297292 siteSelector : { type : 'string' , description : 'Site selector' } ,
298293 manualSiteId : { type : 'string' , description : 'Manual site ID' } ,
299294 pageSize : { type : 'number' , description : 'Results per page' } ,
300- // Create List operation inputs
301295 listDisplayName : { type : 'string' , description : 'List display name' } ,
302296 listDescription : { type : 'string' , description : 'List description' } ,
303297 listTemplate : { type : 'string' , description : 'List template' } ,
304- // Read List operation inputs
305298 listId : { type : 'string' , description : 'List ID' } ,
306299 listTitle : { type : 'string' , description : 'List title' } ,
307300 includeColumns : { type : 'boolean' , description : 'Include columns in response' } ,
308301 includeItems : { type : 'boolean' , description : 'Include items in response' } ,
309- // Update List Item operation inputs
310302 listItemId : { type : 'string' , description : 'List item ID' } ,
311303 listItemFields : { type : 'string' , description : 'List item fields' } ,
312304 } ,
0 commit comments