File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -49,12 +49,8 @@ async function handleGetPageHistoryTool(
4949 params
5050 ) ;
5151
52- if ( ! data ?. revisions ) {
53- // It's possible for data to be non-null but revisions to be missing
54- // if the API call was successful but the page has no revisions
55- // or due to other valid API responses.
56- // We treat this as an error for the tool's purpose if data itself is null.
57- const errorMessage = data ? 'No revisions found for page' : 'Failed to retrieve page data: No data returned from API' ;
52+ if ( ! data ) {
53+ const errorMessage = 'Failed to retrieve page data: No data returned from API' ;
5854 return {
5955 content : [
6056 { type : 'text' , text : errorMessage } as TextContent
@@ -63,6 +59,14 @@ async function handleGetPageHistoryTool(
6359 } ;
6460 }
6561
62+ if ( data . revisions . length === 0 ) {
63+ return {
64+ content : [
65+ { type : 'text' , text : 'No revisions found for page' } as TextContent
66+ ]
67+ } ;
68+ }
69+
6670 return {
6771 content : data . revisions . map ( getPageHistoryToolResult )
6872 } ;
You can’t perform that action at this time.
0 commit comments