cancel_listing
Cancel an open listing to reject all pending applications. Only the listing creator can perform this action.
Instructions
Cancel an open listing. All pending applications will be rejected. Only the agent who created the listing can cancel it.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listing_id | Yes | The listing ID | |
| agent_key | Yes | Your agent API key (starts with hp_) |
Implementation Reference
- src/tools.ts:2241-2263 (handler)Handler for cancel_listing tool - makes a DELETE request to /api/listings/{listing_id} with the agent_key header to cancel an open listing. All pending applications are rejected. Only the agent who created the listing can cancel it.
if (name === 'cancel_listing') { const agentKey = args?.agent_key as string; if (!agentKey) throw new Error('agent_key is required.'); const res = await fetch(`${API_BASE}/api/listings/${args?.listing_id}`, { method: 'DELETE', headers: { 'X-Agent-Key': agentKey }, }); if (!res.ok) { const error = await res.json() as ApiError & { message?: string }; throw new Error(error.message || error.error || `API error: ${res.status}`); } const result = await res.json() as { id: string; status: string; message: string }; return { content: [{ type: 'text', text: `**Listing Cancelled**\n\n**Listing ID:** ${result.id}\n**Status:** ${result.status}\n\n${result.message}`, }], }; } - src/tools.ts:943-960 (registration)Tool registration for cancel_listing - defines the tool name, description ('Cancel an open listing. All pending applications will be rejected. Only the agent who created the listing can cancel it.'), and inputSchema with required listing_id and agent_key parameters.
name: 'cancel_listing', description: 'Cancel an open listing. All pending applications will be rejected. Only the agent who created the listing can cancel it.', inputSchema: { type: 'object', properties: { listing_id: { type: 'string', description: 'The listing ID', }, agent_key: { type: 'string', description: 'Your agent API key (starts with hp_)', }, }, required: ['listing_id', 'agent_key'], }, },