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.1",
"version": "0.2.2",
"description": "A Model Context Protocol server for interacting with WordPress.",
"type": "module",
"main": "./build/server.js",
Expand Down
21 changes: 17 additions & 4 deletions src/tools/acf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,34 @@ type ToolWithZodSchema = Tool & {
zodSchema?: z.ZodTypeAny
}

const getAcfSchemaSchema = z
export const getAcfSchemaSchema = z
.object({
target: 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
.string()
.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.'),
taxonomy: z
.string()
.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.'),
id: z
.union([z.number(), z.literal('me')])
.preprocess((value) => {
if (typeof value === 'string') {
const trimmed = value.trim()
if (trimmed === '') {
return undefined
}
if (/^\d+$/.test(trimmed)) {
return Number(trimmed)
}
return trimmed
}

return value
}, z.union([z.number(), z.literal('me')]).optional())
.optional()
.describe('Optional target ID. For users, this may also be "me". Omit to inspect the collection schema.'),
})
Expand Down
Loading