Skip to main content
Glama
fav-devs

Sociona MCP Server

by fav-devs

cancel_scheduled_post

Cancel a scheduled social media post before it publishes by providing the post ID. Use this tool to prevent unwanted content from going live on X, Instagram, or Threads.

Instructions

Cancel a scheduled post before it publishes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
postIdYesThe ID of the scheduled post to cancel

Implementation Reference

  • The core handler function that executes the tool by making a DELETE API request to cancel the scheduled post using the provided postId and returns a success message or throws an error.
    private async cancelScheduledPost(args: any) {
      const result = await this.apiRequest('DELETE', `/schedule/${args.postId}`);
    
      if (result.success) {
        return {
          content: [
            {
              type: 'text',
              text: `✅ Scheduled post ${args.postId} has been canceled.`,
            },
          ],
        };
      } else {
        throw new Error(result.message || 'Failed to cancel scheduled post');
      }
    }
  • src/index.ts:107-120 (registration)
    Registers the 'cancel_scheduled_post' tool in the ListTools response, including its name, description, and input schema requiring a 'postId'.
    {
      name: 'cancel_scheduled_post',
      description: 'Cancel a scheduled post before it publishes',
      inputSchema: {
        type: 'object',
        properties: {
          postId: {
            type: 'string',
            description: 'The ID of the scheduled post to cancel',
          },
        },
        required: ['postId'],
      },
    },
  • src/index.ts:148-149 (registration)
    Dispatches tool calls to the cancelScheduledPost handler in the CallToolRequestSchema handler switch statement.
    case 'cancel_scheduled_post':
      return await this.cancelScheduledPost(args);
  • Defines the input schema for the tool, specifying 'postId' as a required string.
    inputSchema: {
      type: 'object',
      properties: {
        postId: {
          type: 'string',
          description: 'The ID of the scheduled post to cancel',
        },
      },
      required: ['postId'],
    },
  • Shared helper method used by the handler to make authenticated API requests to the Sociona backend.
    private async apiRequest(method: string, endpoint: string, body?: any) {
      const url = `${API_BASE}${endpoint}`;
      console.error(`Making ${method} request to ${url}`);
    
      const response = await fetch(url, {
        method,
        headers: {
          'Authorization': `Bearer ${SOCIONA_API_KEY}`,
          'Content-Type': 'application/json',
        },
        body: body ? JSON.stringify(body) : undefined,
      });
    
      if (!response.ok) {
        let errorMessage = `API request failed with status ${response.status}`;
        try {
          const errorData = await response.json();
          errorMessage = errorData.message || errorMessage;
        } catch (e) {
          // Ignore JSON parse errors
        }
        throw new Error(errorMessage);
      }
    
      return response.json();
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fav-devs/sociona-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server