Skip to content

Commit 9eedc69

Browse files
fix(tools): ensure proper handling of customDomains and improve documentation
- Updated the `registerSiteTools` function to default `customDomains` to an empty array if not provided. - Added missing commas in function calls for syntax correctness. - Enhanced descriptions in the schema for better clarity and consistency.
1 parent afb338c commit 9eedc69

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

src/tools/sites.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111

1212
export function registerSiteTools(
1313
server: McpServer,
14-
getClient: () => WebflowClient
14+
getClient: () => WebflowClient,
1515
) {
1616
const listSites = async () => {
1717
const response = await getClient().sites.list(requestOptions);
@@ -31,10 +31,10 @@ export function registerSiteTools(
3131
const response = await getClient().sites.publish(
3232
arg.site_id,
3333
{
34-
customDomains: arg.customDomains,
34+
customDomains: arg.customDomains || [],
3535
publishToWebflowSubdomain: arg.publishToWebflowSubdomain,
3636
},
37-
requestOptions
37+
requestOptions,
3838
);
3939
return response;
4040
};
@@ -58,7 +58,7 @@ export function registerSiteTools(
5858
.object({})
5959
.optional()
6060
.describe(
61-
"List all sites accessible to the authenticated user. Returns basic site information including site ID, name, and last published date."
61+
"List all sites accessible to the authenticated user. Returns basic site information including site ID, name, and last published date.",
6262
),
6363
// GET https://api.webflow.com/v2/sites/:site_id
6464
get_site: z
@@ -69,7 +69,7 @@ export function registerSiteTools(
6969
})
7070
.optional()
7171
.describe(
72-
"Get detailed information about a specific site including its settings, domains, and publishing status."
72+
"Get detailed information about a specific site including its settings, domains, and publishing status.",
7373
),
7474
// POST https://api.webflow.com/v2/sites/:site_id/publish
7575
publish_site: z
@@ -79,9 +79,10 @@ export function registerSiteTools(
7979
.describe("Unique identifier for the site."),
8080
customDomains: z
8181
.array(z.string())
82+
.default([])
8283
.optional()
8384
.describe(
84-
"Array of custom domains to publish the site to."
85+
"Array of custom domains to publish the site to.",
8586
),
8687
publishToWebflowSubdomain: z
8788
.boolean()
@@ -90,7 +91,7 @@ export function registerSiteTools(
9091
})
9192
.optional()
9293
.describe(
93-
"Publish a site to specified domains. This will make the latest changes live on the specified domains."
94+
"Publish a site to specified domains. This will make the latest changes live on the specified domains.",
9495
),
9596
})
9697
.strict()
@@ -101,8 +102,8 @@ export function registerSiteTools(
101102
{
102103
message:
103104
"Provide at least one of list_sites, get_site, publish_site.",
104-
}
105-
)
105+
},
106+
),
106107
),
107108
},
108109
},
@@ -127,6 +128,6 @@ export function registerSiteTools(
127128
} catch (error) {
128129
return formatErrorResponse(error);
129130
}
130-
}
131+
},
131132
);
132133
}

0 commit comments

Comments
 (0)