Skip to main content
Glama

rustypaste_shorten_url

Shorten long URLs into compact redirect links using the rustypaste service. Convert lengthy web addresses into manageable short URLs for sharing and tracking.

Instructions

Shorten a long URL using rustypaste.

Creates a short redirect URL that points to the original long URL.

Args:

  • url (string): The URL to shorten (must be a valid URL)

Returns: The shortened URL.

Examples:

  • Shorten a link: url="https://example.com/very/long/path/to/resource?with=params"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe long URL to shorten

Implementation Reference

  • The tool handler function for rustypaste_shorten_url, which uses RustypasteClient to shorten the provided URL.
    async (params: Input) => {
        try {
            const client = new RustypasteClient();
            const result = await client.shortenUrl(params.url);
            return {
                content: [
                    {
                        type: "text" as const,
                        text: `✅ URL shortened!\n\nShort URL: ${result.url}\nOriginal:  ${params.url}`,
                    },
                ],
            };
        } catch (error) {
            return {
                isError: true,
                content: [
                    {
                        type: "text" as const,
                        text: `Error: ${error instanceof Error ? error.message : String(error)}`,
                    },
                ],
            };
        }
    }
  • The InputSchema for the tool, validating that the input 'url' is a valid URL string.
    const InputSchema = z.object({
        url: z
            .string()
            .url("Must be a valid URL")
            .describe("The long URL to shorten"),
    });
  • The registration function that defines the 'rustypaste_shorten_url' tool to the MCP server.
    export function registerShortenUrl(server: McpServer): void {
        server.registerTool(
            "rustypaste_shorten_url",
            {
                title: "Shorten URL",
                description: `Shorten a long URL using rustypaste.
    
    Creates a short redirect URL that points to the original long URL.
    
    Args:
      - url (string): The URL to shorten (must be a valid URL)
    
    Returns:
      The shortened URL.
    
    Examples:
      - Shorten a link: url="https://example.com/very/long/path/to/resource?with=params"`,
                inputSchema: InputSchema,
                annotations: {
                    readOnlyHint: false,
                    destructiveHint: false,
                    idempotentHint: false,
                    openWorldHint: true,
                },
            },
            async (params: Input) => {
                try {
                    const client = new RustypasteClient();
                    const result = await client.shortenUrl(params.url);
                    return {
                        content: [
                            {
                                type: "text" as const,
                                text: `✅ URL shortened!\n\nShort URL: ${result.url}\nOriginal:  ${params.url}`,
                            },
                        ],
                    };
                } catch (error) {
                    return {
                        isError: true,
                        content: [
                            {
                                type: "text" as const,
                                text: `Error: ${error instanceof Error ? error.message : String(error)}`,
                            },
                        ],
                    };
                }
            }
        );
    }

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/rukh-debug/rustypaste-mcp'

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