remove_party_address_by_id
Remove an address from a party using its row id. Atomic and idempotent—re-adds easily if needed. Returns party details.
Instructions
Remove one address entry from a party by its row id. Atomic and reversible — no confirm: true gate (re-add with add_party_address). Discover the id via get_party. Idempotent on retry: response is {removed: true, alreadyRemoved: false, partyId, addressId, party} on a fresh remove or {removed: true, alreadyRemoved: true, partyId, addressId} if the row was already gone.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| partyId | Yes | ||
| addressId | Yes | Capsule's id for the address row. Read it from get_party (each entry in addresses carries an id). |
Implementation Reference
- src/tools/parties.ts:505-521 (handler)The main handler function that removes a party address by its Capsule row ID. Uses idempotentWithResult to call capsulePut with _delete:true on the address entry.
export async function removePartyAddressById(input: z.infer<typeof removePartyAddressByIdSchema>) { const { partyId, addressId } = input; return idempotentWithResult( () => capsulePut<{ party: unknown }>(`/parties/${partyId}`, { party: { addresses: [{ id: addressId, _delete: true }] }, }), (result) => ({ removed: true, alreadyRemoved: false, partyId, addressId, ...result, }), () => ({ removed: true, alreadyRemoved: true, partyId, addressId }), ); } - src/tools/parties.ts:494-503 (schema)Zod schema for removePartyAddressById — accepts partyId (positive int) and addressId (positive int, Capsule's row id).
export const removePartyAddressByIdSchema = z.object({ partyId: z.number().int().positive(), addressId: z .number() .int() .positive() .describe( "Capsule's id for the address row. Read it from get_party (each entry in addresses carries an id).", ), }); - src/server.ts:375-381 (registration)Registration of the remove_party_address_by_id tool on the MCP server via registerTool helper.
registerTool( server, "remove_party_address_by_id", "Remove one address entry from a party by its row id. Atomic and reversible — no `confirm: true` gate (re-add with add_party_address). Discover the id via get_party. Idempotent on retry: response is `{removed: true, alreadyRemoved: false, partyId, addressId, party}` on a fresh remove or `{removed: true, alreadyRemoved: true, partyId, addressId}` if the row was already gone.", removePartyAddressByIdSchema, removePartyAddressById, ); - src/server/register-tool.ts:39-59 (helper)The registerTool helper function that wraps handler results in MCP text-content responses and registers them on the server.
export function registerTool<Schema extends z.ZodObject<ZodRawShape>>( server: McpServer, name: string, description: string, schema: Schema, handler: (input: z.infer<Schema>) => Promise<unknown>, ): void { // Use the SDK config-form registerTool with the full Zod schema. The // deprecated shape overload rebuilds z.object(schema.shape), which drops // object-level refinements such as superRefine. const registerWithSchema = server.registerTool.bind(server) as ( toolName: string, config: { description: string; inputSchema: Schema }, callback: (input: z.infer<Schema>) => Promise<CallToolResult>, ) => void; registerWithSchema(name, { description, inputSchema: schema }, async (input) => { const result = await handler(input); return wrapAsText(result); }); }