Skip to main content
Glama
wspotter

MCP Art Supply Store

by wspotter

get_new_comments

Retrieve recent Facebook and Instagram comments to monitor social media engagement and respond to customers promptly.

Instructions

Retrieve new comments from Facebook and Instagram posts for timely responses.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
platformNoOptional: filter by facebook or instagram
sinceHoursNoGet comments from last X hours (default: 24)

Implementation Reference

  • Handler for the 'get_new_comments' tool. Checks configuration, fetches recent Facebook comments using the socialMediaManager, and formats the response with comment details.
    case 'get_new_comments': {
      if (!socialMediaManager.isConfigured()) {
        return {
          content: [{
            type: 'text',
            text: `āš ļø Social media not configured. See FACEBOOK_INSTAGRAM_SETUP.md for setup instructions.`
          }]
        };
      }
    
      const sinceHours = Number(args?.sinceHours || 24);
      
      try {
        const comments = await socialMediaManager.getFacebookComments(sinceHours);
        
        if (comments.length === 0) {
          return {
            content: [{
              type: 'text',
              text: `āœ… No new comments in the last ${sinceHours} hours. All caught up!`
            }]
          };
        }
    
        return {
          content: [{
            type: 'text',
            text: `šŸ’¬ New Comments (Last ${sinceHours} hours)\n\n${comments.map((comment, i) =>
              `${i + 1}. From ${comment.from} on ${comment.platform}\n   "${comment.text}"\n   šŸ• ${new Date(comment.timestamp).toLocaleString()}`
            ).join('\n\n')}\n\nšŸ’” Use 'suggest_comment_reply' to get AI-powered reply suggestions!`
          }]
        };
      } catch (error: any) {
        return {
          content: [{
            type: 'text',
            text: `āŒ Failed to fetch comments: ${error.message}`
          }]
        };
      }
  • Input schema definition for the 'get_new_comments' tool, specifying parameters like sinceHours and platform.
      name: 'get_new_comments',
      description: 'Retrieve new comments from Facebook and Instagram posts for timely responses.',
      inputSchema: {
        type: 'object',
        properties: {
          sinceHours: { type: 'number', description: 'Get comments from last X hours (default: 24)' },
          platform: { type: 'string', description: 'Optional: filter by facebook or instagram' },
        },
      },
    },
  • src/index.ts:516-518 (registration)
    Registration of the ListToolsRequestHandler which exposes all tools including 'get_new_comments' via the tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • Helper function getFacebookComments in SocialMediaManager class that implements the core logic to fetch recent comments from Facebook Graph API, filtering by time.
    async getFacebookComments(sinceHours: number = 24): Promise<Comment[]> {
      if (!this.isConfigured()) {
        throw new Error('Facebook API not configured');
      }
    
      try {
        const url = `https://graph.facebook.com/${this.apiVersion}/${this.fbPageId}/feed`;
        const params = new URLSearchParams({
          fields: 'id,message,comments{message,from,created_time}',
          access_token: this.fbPageToken,
          limit: '25'
        });
    
        const response = await fetch(`${url}?${params}`);
        const result = await response.json() as any;
    
        const comments: Comment[] = [];
        
        if (result.data) {
          const cutoffTime = Date.now() - (sinceHours * 60 * 60 * 1000);
          
          for (const post of result.data) {
            if (post.comments && post.comments.data) {
              for (const comment of post.comments.data) {
                const commentTime = new Date(comment.created_time).getTime();
                if (commentTime > cutoffTime) {
                  comments.push({
                    id: comment.id,
                    text: comment.message,
                    from: comment.from.name,
                    timestamp: comment.created_time,
                    platform: 'facebook'
                  });
                }
              }
            }
          }
        }
    
        return comments;
      } catch (error: any) {
        throw new Error(`Failed to fetch comments: ${error.message}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions retrieving comments for 'timely responses', hinting at a read-only operation, but lacks details on permissions, rate limits, data format, pagination, or error handling, which are critical for a social media tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action and purpose without any wasted words, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of social media data retrieval, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like authentication needs, response format, or error cases, leaving gaps for an AI agent to operate effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting both parameters. The description adds no additional semantic details beyond what the schema provides, such as examples or constraints, so it meets the baseline for high schema coverage without compensating value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'retrieve' and the resource 'new comments from Facebook and Instagram posts', making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'suggest_comment_reply' or 'get_social_analytics', which might involve similar data, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for 'timely responses', suggesting a context of customer engagement or monitoring, but it doesn't provide explicit guidance on when to use this tool versus alternatives like 'suggest_comment_reply' or 'get_social_analytics', nor does it specify exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/wspotter/mcpart'

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