generate_wordpress_content
Create AI-driven WordPress content with customizable prompts and models. Input user and system prompts to generate tailored posts using the FetchSERP MCP Server.
Instructions
Generate WordPress content using AI with customizable prompts and models
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ai_model | No | The AI model (default: gpt-4.1-nano) | gpt-4.1-nano |
| system_prompt | Yes | The system prompt | |
| user_prompt | Yes | The user prompt |
Input Schema (JSON Schema)
{
"properties": {
"ai_model": {
"default": "gpt-4.1-nano",
"description": "The AI model (default: gpt-4.1-nano)",
"type": "string"
},
"system_prompt": {
"description": "The system prompt",
"type": "string"
},
"user_prompt": {
"description": "The user prompt",
"type": "string"
}
},
"required": [
"user_prompt",
"system_prompt"
],
"type": "object"
}
Implementation Reference
- index.js:676-677 (handler)Handler implementation for the 'generate_wordpress_content' tool. It calls the shared makeRequest method to proxy the tool arguments to the external FetchSERP API endpoint '/api/v1/generate_wordpress_content'.case 'generate_wordpress_content': return await this.makeRequest('/api/v1/generate_wordpress_content', 'GET', args, null, token);
- index.js:465-483 (schema)Input schema for the generate_wordpress_content tool, defining required user_prompt and system_prompt, optional ai_model.inputSchema: { type: 'object', properties: { user_prompt: { type: 'string', description: 'The user prompt', }, system_prompt: { type: 'string', description: 'The system prompt', }, ai_model: { type: 'string', description: 'The AI model (default: gpt-4.1-nano)', default: 'gpt-4.1-nano', }, }, required: ['user_prompt', 'system_prompt'], },
- index.js:462-484 (registration)Registration of the generate_wordpress_content tool in the MCP server's listTools response, including name, description, and schema.{ name: 'generate_wordpress_content', description: 'Generate WordPress content using AI with customizable prompts and models', inputSchema: { type: 'object', properties: { user_prompt: { type: 'string', description: 'The user prompt', }, system_prompt: { type: 'string', description: 'The system prompt', }, ai_model: { type: 'string', description: 'The AI model (default: gpt-4.1-nano)', default: 'gpt-4.1-nano', }, }, required: ['user_prompt', 'system_prompt'], }, },
- index.js:565-613 (helper)Shared helper function makeRequest that performs authenticated HTTP requests to the FetchSERP API base URL, used by the generate_wordpress_content handler and other tools.async makeRequest(endpoint, method = 'GET', params = {}, body = null, token = null) { const fetchserpToken = token || process.env.FETCHSERP_API_TOKEN; if (!fetchserpToken) { throw new McpError( ErrorCode.InvalidRequest, 'FETCHSERP_API_TOKEN is required' ); } const url = new URL(`${API_BASE_URL}${endpoint}`); // Add query parameters for GET requests if (method === 'GET' && Object.keys(params).length > 0) { Object.entries(params).forEach(([key, value]) => { if (value !== undefined && value !== null) { if (Array.isArray(value)) { value.forEach(v => url.searchParams.append(`${key}[]`, v)); } else { url.searchParams.append(key, value.toString()); } } }); } const fetchOptions = { method, headers: { 'Authorization': `Bearer ${fetchserpToken}`, 'Content-Type': 'application/json', }, }; if (body && method !== 'GET') { fetchOptions.body = JSON.stringify(body); } const response = await fetch(url.toString(), fetchOptions); if (!response.ok) { const errorText = await response.text(); throw new McpError( ErrorCode.InternalError, `API request failed: ${response.status} ${response.statusText} - ${errorText}` ); } return await response.json(); }