generate_social_content
Create customized social media content using AI by inputting user and system prompts, and selecting preferred AI models on the FetchSERP MCP Server.
Instructions
Generate social media 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:679-680 (handler)The specific case handler in the handleToolCall switch statement that proxies the tool call to the external FetchSERP API endpoint '/api/v1/generate_social_content' using the shared makeRequest method.case 'generate_social_content': return await this.makeRequest('/api/v1/generate_social_content', 'GET', args, null, token);
- index.js:488-506 (schema)Input schema for the generate_social_content tool, defining required user_prompt and system_prompt strings, and 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:485-507 (registration)Tool registration entry in the ListTools response, including name, description, and input schema.{ name: 'generate_social_content', description: 'Generate social media 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 method used by all tool handlers to make authenticated HTTP requests to the FetchSERP API backend, handling token, params, errors, and JSON parsing.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(); }