Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
493 changes: 262 additions & 231 deletions src/tools/cms.ts

Large diffs are not rendered by default.

258 changes: 136 additions & 122 deletions src/tools/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,128 +130,142 @@ export function registerCommentsTools(
inputSchema: {
actions: z
.array(
z.object({
list_comment_threads: z
.object({
site_id: z
.string()
.describe(
"The site's unique ID, used to list its comment threads."
),
localeId: z
.string()
.optional()
.describe(
"Unique identifier for a specific locale. Applicable when using localization."
),
offset: z
.number()
.optional()
.describe(
"Offset used for pagination if the results have more than limit records."
),
limit: z
.number()
.max(100)
.min(1)
.optional()
.describe(
"Maximum number of records to be returned (max limit: 100)"
),
sortBy: z
.enum(["createdOn", "lastUpdated"])
.optional()
.describe("Sort the results by the given field."),
sortOrder: z
.enum(["asc", "desc"])
.optional()
.describe("Sort the results by the given order."),
})
.optional()
.describe(
"List all comment threads for a specific element or page."
),
get_comment_thread: z
.object({
site_id: z
.string()
.describe(
"The site's unique ID, used to get its comment thread."
),
comment_thread_id: z
.string()
.describe(
"The comment thread's unique ID, used to get its details."
),
localeId: z
.string()
.optional()
.describe(
"Unique identifier for a specific locale. Applicable when using localization."
),
offset: z
.number()
.optional()
.describe(
"Offset used for pagination if the results have more than limit records."
),
limit: z
.number()
.max(100)
.min(1)
.optional()
.describe(
"Maximum number of records to be returned (max limit: 100)"
),
sortBy: z
.enum(["createdOn", "lastUpdated"])
.optional()
.describe("Sort the results by the given field."),
sortOrder: z
.enum(["asc", "desc"])
.optional()
.describe("Sort the results by the given order."),
})
.optional()
.describe("Get the details of a specific comment thread."),
list_comment_replies: z
.object({
site_id: z
.string()
.describe(
"The site's unique ID, used to list its comment replies."
),
comment_thread_id: z
.string()
.describe(
"The comment thread's unique ID, used to list its replies."
),
offset: z
.number()
.optional()
.describe(
"Offset used for pagination if the results have more than limit records."
),
limit: z
.number()
.max(100)
.min(1)
.optional()
.describe(
"Maximum number of records to be returned (max limit: 100)"
),
sortBy: z
.enum(["createdOn", "lastUpdated"])
.optional()
.describe("Sort the results by the given field."),
sortOrder: z
.enum(["asc", "desc"])
.optional()
.describe("Sort the results by the given order."),
})
.optional()
.describe("List all replies for a specific comment thread."),
})
z
.object({
list_comment_threads: z
.object({
site_id: z
.string()
.describe(
"The site's unique ID, used to list its comment threads."
),
localeId: z
.string()
.optional()
.describe(
"Unique identifier for a specific locale. Applicable when using localization."
),
offset: z
.number()
.optional()
.describe(
"Offset used for pagination if the results have more than limit records."
),
limit: z
.number()
.max(100)
.min(1)
.optional()
.describe(
"Maximum number of records to be returned (max limit: 100)"
),
sortBy: z
.enum(["createdOn", "lastUpdated"])
.optional()
.describe("Sort the results by the given field."),
sortOrder: z
.enum(["asc", "desc"])
.optional()
.describe("Sort the results by the given order."),
})
.optional()
.describe(
"List all comment threads for a specific element or page."
),
get_comment_thread: z
.object({
site_id: z
.string()
.describe(
"The site's unique ID, used to get its comment thread."
),
comment_thread_id: z
.string()
.describe(
"The comment thread's unique ID, used to get its details."
),
localeId: z
.string()
.optional()
.describe(
"Unique identifier for a specific locale. Applicable when using localization."
),
offset: z
.number()
.optional()
.describe(
"Offset used for pagination if the results have more than limit records."
),
limit: z
.number()
.max(100)
.min(1)
.optional()
.describe(
"Maximum number of records to be returned (max limit: 100)"
),
sortBy: z
.enum(["createdOn", "lastUpdated"])
.optional()
.describe("Sort the results by the given field."),
sortOrder: z
.enum(["asc", "desc"])
.optional()
.describe("Sort the results by the given order."),
})
.optional()
.describe("Get the details of a specific comment thread."),
list_comment_replies: z
.object({
site_id: z
.string()
.describe(
"The site's unique ID, used to list its comment replies."
),
comment_thread_id: z
.string()
.describe(
"The comment thread's unique ID, used to list its replies."
),
offset: z
.number()
.optional()
.describe(
"Offset used for pagination if the results have more than limit records."
),
limit: z
.number()
.max(100)
.min(1)
.optional()
.describe(
"Maximum number of records to be returned (max limit: 100)"
),
sortBy: z
.enum(["createdOn", "lastUpdated"])
.optional()
.describe("Sort the results by the given field."),
sortOrder: z
.enum(["asc", "desc"])
.optional()
.describe("Sort the results by the given order."),
})
.optional()
.describe("List all replies for a specific comment thread."),
})
.strict()
.refine(
(d) =>
[
d.list_comment_threads,
d.get_comment_thread,
d.list_comment_replies,
].filter(Boolean).length >= 1,
{
message:
"Provide at least one of list_comment_threads, get_comment_thread, list_comment_replies.",
}
)
)
.min(1)
.describe("The actions to perform on the comments."),
Expand Down
Loading