Skip to main content
Glama
paladini

devutils-mcp-server

case_convert

Convert strings between casing styles like camelCase, snake_case, kebab-case, and others to standardize text formatting in code and documents.

Instructions

Convert a string between different casing styles: camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case, and more.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesThe string to convert
toYesTarget case style

Implementation Reference

  • Registration and implementation of the 'case_convert' MCP tool.
    server.tool(
      "case_convert",
      "Convert a string between different casing styles: camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case, and more.",
      {
        input: z.string().describe("The string to convert"),
        to: z
          .enum([
            "camelCase",
            "PascalCase",
            "snake_case",
            "kebab-case",
            "CONSTANT_CASE",
            "Title Case",
            "lowercase",
            "UPPERCASE",
          ])
          .describe("Target case style"),
      },
      async ({ input, to }) => {
        // Tokenize: split on spaces, hyphens, underscores, and camelCase boundaries
        const words = input
          .replace(/([a-z])([A-Z])/g, "$1 $2")
          .replace(/[_\-]+/g, " ")
          .split(/\s+/)
          .filter((w) => w.length > 0)
          .map((w) => w.toLowerCase());
    
        let result: string;
        switch (to) {
          case "camelCase":
            result = words
              .map((w, i) =>
                i === 0 ? w : w.charAt(0).toUpperCase() + w.slice(1)
              )
              .join("");
            break;
          case "PascalCase":
            result = words
              .map((w) => w.charAt(0).toUpperCase() + w.slice(1))
              .join("");
            break;
          case "snake_case":
            result = words.join("_");
            break;
          case "kebab-case":
            result = words.join("-");
            break;
          case "CONSTANT_CASE":
            result = words.join("_").toUpperCase();
            break;
          case "Title Case":
            result = words
              .map((w) => w.charAt(0).toUpperCase() + w.slice(1))
              .join(" ");
            break;
          case "lowercase":
            result = words.join(" ");
            break;
          case "UPPERCASE":
            result = words.join(" ").toUpperCase();
            break;
          default:
            result = input;
        }
    
        return { content: [{ type: "text" as const, text: result }] };
      }
    );

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/paladini/devutils-mcp-server'

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