Skip to main content
Glama

update_url

Modify an existing short URL to redirect to a new destination. Use this tool to update the target URL and optionally change the title for your shortened link, ensuring accurate redirection.

Instructions

Update an existing short URL to point to a different destination URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
shorturlYesThe short URL or keyword to update
titleNoOptional new title for the URL
urlYesThe new destination URL

Implementation Reference

  • The execute function implementing the core logic of the 'update_url' MCP tool. It calls yourlsClient.updateUrl with fallback, handles success/fallback responses, and formats MCP responses.
    execute: async ({ shorturl, url, title }) => { try { // Use the updateUrl method with fallback enabled const result = await yourlsClient.updateUrl(shorturl, url, title, true); // Check for both plugin success message and fallback success messages if (result.status === 'success' || result.message === 'success: updated') { const responseData = { shorturl: result.shorturl || shorturl, url: url, message: result.message || 'Short URL updated successfully' }; // Add fallback information if applicable if (result.fallback_used) { responseData.fallback_used = true; if (result.fallback_limited) { responseData.fallback_limited = true; } if (result.fallback_limitations) { responseData.fallback_limitations = result.fallback_limitations; } } return createMcpResponse(true, responseData); } else { throw new Error(result.message || 'Unknown error'); } } catch (error) { return createMcpResponse(false, { message: error.message, shorturl: shorturl, url: url }); } }
  • JSON Schema definition for the input parameters of the 'update_url' tool.
    inputSchema: { type: 'object', properties: { shorturl: { type: 'string', description: 'The short URL or keyword to update' }, url: { type: 'string', description: 'The new destination URL' }, title: { type: 'string', description: 'Optional new title ("keep" to keep existing, "auto" to fetch from URL)' } }, required: ['shorturl', 'url'] },
  • src/index.js:188-197 (registration)
    Primary registration of the 'update_url' tool with the MCP server in the main entry point, using Zod schema derived from the tool definition.
    server.tool( updateUrlTool.name, updateUrlTool.description, { shorturl: z.string().describe('The short URL or keyword to update'), url: z.string().describe('The new destination URL'), title: z.string().optional().describe('Optional new title for the URL') }, updateUrlTool.execute );
  • Alternative registration of the 'update_url' tool in the tools aggregation module.
    server.tool( updateUrlTool.name, updateUrlTool.description, { shorturl: z.string().describe('The short URL or keyword to update'), url: z.string().describe('The new destination URL'), title: z.string().optional().describe('Optional new title for the URL') }, updateUrlTool.execute );

Other Tools

Related 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/kesslerio/yourls-mcp'

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