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
| Name | Required | Description | Default |
|---|---|---|---|
| linkId | Yes | The ID of the link to delete |
Implementation Reference
- src/index.ts:514-553 (handler)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; } }
- src/index.ts:185-194 (schema)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);