lb_account_update_profile
Update your Listing Bureau account profile by changing first name, last name, or company name. Provide at least one field to modify.
Instructions
Update Listing Bureau account profile fields (first_name, last_name, company). At least one field required.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| first_name | No | New first name | |
| last_name | No | New last name | |
| company | No | New company name |
Implementation Reference
- src/tools/account.tools.ts:62-86 (handler)The actual handler function for lb_account_update_profile. It accepts optional first_name, last_name, and company params, builds a request body with only the provided fields, validates at least one field is provided, then sends a PATCH request to /api/v1/account/profile and returns the result.
async (params) => { try { const body: Record<string, unknown> = {}; if (params.first_name !== undefined) body.first_name = params.first_name; if (params.last_name !== undefined) body.last_name = params.last_name; if (params.company !== undefined) body.company = params.company; if (Object.keys(body).length === 0) { return formatErrorResult( new Error("At least one field (first_name, last_name, company) must be provided"), ); } const res = await client.request<Account>( "PATCH", "/api/v1/account/profile", body, undefined, "lb_account_update_profile", ); return formatResult(res.data); } catch (e) { return formatErrorResult(e); } }, - src/tools/account.tools.ts:56-61 (schema)The Zod schema defining input parameters for lb_account_update_profile: first_name (optional string), last_name (optional string), and company (optional string).
{ first_name: z.string().optional().describe("New first name"), last_name: z.string().optional().describe("New last name"), company: z.string().optional().describe("New company name"), }, { idempotentHint: true }, - src/tools/account.tools.ts:53-87 (registration)The tool is registered on the MCP server via server.tool() inside registerAccountTools(), with the name 'lb_account_update_profile', a description, the zod schema, idempotentHint, and the async handler.
server.tool( "lb_account_update_profile", "Update Listing Bureau account profile fields (first_name, last_name, company). At least one field required.", { first_name: z.string().optional().describe("New first name"), last_name: z.string().optional().describe("New last name"), company: z.string().optional().describe("New company name"), }, { idempotentHint: true }, async (params) => { try { const body: Record<string, unknown> = {}; if (params.first_name !== undefined) body.first_name = params.first_name; if (params.last_name !== undefined) body.last_name = params.last_name; if (params.company !== undefined) body.company = params.company; if (Object.keys(body).length === 0) { return formatErrorResult( new Error("At least one field (first_name, last_name, company) must be provided"), ); } const res = await client.request<Account>( "PATCH", "/api/v1/account/profile", body, undefined, "lb_account_update_profile", ); return formatResult(res.data); } catch (e) { return formatErrorResult(e); } }, ); - src/index.ts:56-56 (registration)registerAccountTools is called in the main server setup (index.ts line 56), which registers the tool on the McpServer.
registerAccountTools(server, client); - src/utils/response.ts:10-54 (helper)formatResult helper used by the handler to format the API response data into a CallToolResult.
export function formatResult(data: unknown): CallToolResult { const warnings: string[] = []; let cleaned: Record<string, unknown> | unknown = data; if (data && typeof data === "object") { const obj = { ...(data as Record<string, unknown>) }; // Top-level warning string if ("warning" in obj && typeof obj.warning === "string") { warnings.push(obj.warning); delete obj.warning; } // balance_warning object (independent of warning) if ("balance_warning" in obj && obj.balance_warning && typeof obj.balance_warning === "object") { const bw = obj.balance_warning as Record<string, unknown>; const parts: string[] = []; if (typeof bw.warning === "string" && bw.warning.trim()) parts.push(bw.warning); if (typeof bw.daily_cost_estimate === "number") parts.push(`Daily cost estimate: $${bw.daily_cost_estimate.toFixed(2)}`); if (typeof bw.balance === "number") parts.push(`Balance: $${bw.balance.toFixed(2)}`); if (typeof bw.days_remaining === "number") parts.push(`Days remaining: ${bw.days_remaining.toFixed(1)}`); if (parts.length > 0) warnings.push(parts.join(" | ")); delete obj.balance_warning; } cleaned = obj; } let text = JSON.stringify(cleaned, null, 2); for (const w of warnings) { text += `\n\n⚠️ Warning: ${w}`; } const notice = getUpdateNotice(); if (notice) { text += `\n\n${notice}`; } return { content: [{ type: "text", text }], }; }