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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@missionsquad/mcp-wordpress",
"version": "0.2.2",
"version": "0.2.3",
"description": "A Model Context Protocol server for interacting with WordPress.",
"type": "module",
"main": "./build/server.js",
Expand Down
18 changes: 4 additions & 14 deletions src/tools/acf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ export const getAcfSchemaSchema = z
.enum(['content', 'term', 'user'])
.describe('Schema target. Use content for posts/pages/CPTs, term for taxonomy terms, and user for users.'),
content_type: z
.preprocess((value) => (typeof value === 'string' && value.trim() === '' ? undefined : value), z.string().optional())
.optional()
.describe('Required only when target is content. WordPress post type slug, such as post, page, book, or product.'),
.preprocess((value) => (typeof value === 'string' && value.trim() === '' ? undefined : value), z.string().default('post'))
.describe('Used only when target is content. WordPress post type slug, such as post, page, book, or product. Defaults to post.'),
taxonomy: z
.preprocess((value) => (typeof value === 'string' && value.trim() === '' ? undefined : value), z.string().optional())
.optional()
.describe('Required only when target is term. WordPress taxonomy slug, such as category, post_tag, or genre.'),
.preprocess((value) => (typeof value === 'string' && value.trim() === '' ? undefined : value), z.string().default('category'))
.describe('Used only when target is term. WordPress taxonomy slug, such as category, post_tag, or genre. Defaults to category.'),
id: z
.preprocess((value) => {
if (typeof value === 'string') {
Expand Down Expand Up @@ -142,10 +140,6 @@ async function requestOptionsForResolvedRoute(route: RestRoute, id?: number): Pr

function validateGetAcfSchemaParams(params: z.infer<typeof getAcfSchemaSchema>): GetAcfSchemaParams {
if (params.target === 'content') {
if (!params.content_type) {
throw new Error('content_type is required when target is "content".')
}

if (params.id === 'me') {
throw new Error('id must be numeric when target is "content".')
}
Expand All @@ -158,10 +152,6 @@ function validateGetAcfSchemaParams(params: z.infer<typeof getAcfSchemaSchema>):
}

if (params.target === 'term') {
if (!params.taxonomy) {
throw new Error('taxonomy is required when target is "term".')
}

if (params.id === 'me') {
throw new Error('id must be numeric when target is "term".')
}
Expand Down
Loading