Skip to main content
Glama

delete_link

Remove a short link from your Dub.co account by specifying its unique identifier to manage your URL shortening inventory.

Instructions

Delete a short link on dub.co

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
linkIdYesThe ID of the link to delete

Implementation Reference

  • The primary handler function for the 'delete_link' tool. It validates the linkId parameter, makes a DELETE request to the Dub.co API endpoint `/links/{linkId}`, and returns a success message or formatted error response.
    private async deleteLink(args: any): Promise<any> {
      if (!args.linkId) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Link ID is required'
        );
      }
      
      try {
        const response = await this.axiosInstance.delete(`/links/${args.linkId}`);
        
        return {
          content: [
            {
              type: 'text',
              text: `Link with ID ${args.linkId} has been deleted.`,
            },
          ],
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          const axiosError = error as AxiosError<ApiErrorResponse>;
          const statusCode = axiosError.response?.status;
          const errorData = axiosError.response?.data;
          const errorMessage = errorData?.error || errorData?.message || axiosError.message;
          
          return {
            content: [
              {
                type: 'text',
                text: `Error deleting link: ${statusCode} - ${errorMessage}`,
              },
            ],
            isError: true,
          };
        }
        
        throw error;
      }
    }
  • The input schema for the 'delete_link' tool, defining the required 'linkId' parameter as a string.
    inputSchema: {
      type: 'object',
      properties: {
        linkId: {
          type: 'string',
          description: 'The ID of the link to delete',
        },
      },
      required: ['linkId'],
    },
  • src/index.ts:182-195 (registration)
    Registration of the 'delete_link' tool in the ListTools response, including name, description, and input schema.
    {
      name: 'delete_link',
      description: 'Delete a short link on dub.co',
      inputSchema: {
        type: 'object',
        properties: {
          linkId: {
            type: 'string',
            description: 'The ID of the link to delete',
          },
        },
        required: ['linkId'],
      },
    },
  • src/index.ts:208-209 (registration)
    Dispatcher case in the CallToolRequest handler that routes 'delete_link' calls to the deleteLink method.
    case 'delete_link':
      return await this.deleteLink(request.params.arguments);
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/Gitmaxd/dubco-mcp-server'

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