Skip to content

feat: MCP server shortens messages when necessary #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nzakas
Copy link
Contributor

@nzakas nzakas commented Jun 17, 2025

This pull request introduces significant enhancements to the src/mcp-server.js file, focusing on improving the functionality for handling social media strategies and posts. Key changes include the addition of new tools for message validation, length calculation, and resizing, as well as schema definitions for better input validation. Minor updates were also made to testing instructions in .github/copilot-instructions.md.

Enhancements to Social Media Tools:

  • New tools for managing posts and strategies:

    • Added tools for listing available services (list-services), checking message length (check-message-length), calculating message length (calculate-message-length), and resizing messages (resize-message). These tools streamline operations for social media posts and ensure messages fit platform-specific constraints. [1] [2]
    • Updated the crosspost tool to provide prompts for posting messages to all services, improving clarity and usability.
  • Message resizing prompt:

    • Introduced shortenMessagePrompt to generate detailed instructions for resizing messages while preserving meaning and tone. This ensures compliance with character limits while maximizing space usage.

Schema Definitions:

  • New schemas for validation:
    • Added socialMediaPostSchema, strategyMessageSchema, and shortenMessageSchema to validate inputs for tools like post-to-social-media and resize-message. These schemas enhance data integrity and prevent errors.

Testing Guidelines Update:

  • Improved test structure:
    • Updated .github/copilot-instructions.md to recommend organizing tests within single describe blocks, using beforeEach for setup and afterEach for cleanup, and ensuring readability with empty lines between blocks.

@nzakas nzakas requested a review from Copilot June 17, 2025 21:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request enhances the MCP server by introducing new social media tools for message validation, length checking, and message resizing while also updating schema definitions for input validation and test guidelines.

  • Adds new prompt and tool implementations for message shortening and crossposting.
  • Introduces new schemas for social media post validation.
  • Updates test instructions to enforce a more organized structure.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/mcp-server.js Adds new tools (shortenMessagePrompt, check-message-length, calculate-message-length, resize-message) and updates the crosspost behavior.
.github/copilot-instructions.md Updates testing guidelines to use single describe blocks with beforeEach/afterEach and empty lines between blocks.
Comments suppressed due to low confidence (1)

src/mcp-server.js:213

  • Ensure that the change in behavior for the 'crosspost' tool (returning a prompt rather than posting immediately) is clearly documented so that API consumers understand the intended workflow.
			"Returns a prompt to crosspost a message to all available services. Use the post-to-social-media tool to actually post the message.",

Comment on lines +38 to +39
// Use tight ranges - only 10 characters of wiggle room
const minLength = maxLength - 10;
Copy link
Preview

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting the magic number '10' into a named constant (e.g., WIGGLE_ROOM) to improve maintainability and clarity, making future adjustments easier if the wiggle room requirement changes.

Suggested change
// Use tight ranges - only 10 characters of wiggle room
const minLength = maxLength - 10;
// Use tight ranges - only WIGGLE_ROOM characters of wiggle room
const minLength = maxLength - WIGGLE_ROOM;

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant