Retrieve a saved address
lob_addresses_getRetrieve a saved address by its unique ID to access its full details for use in mailing operations.
Instructions
Retrieve a single saved address by ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Lob address ID (`adr_…`). |
Implementation Reference
- src/tools/address-book.ts:61-61 (handler)The handler function for lob_addresses_get — makes a GET request to /addresses/{id} via the LobClient, returning the saved address data.
handler: async ({ id }) => lob.request({ method: "GET", path: `/addresses/${id}` }), - src/tools/address-book.ts:60-60 (schema)The input schema for lob_addresses_get — accepts a single 'id' parameter validated to match the pattern /^adr_/ (Lob address ID format).
inputSchema: { id: z.string().regex(/^adr_/).describe("Lob address ID (`adr_…`).") }, - src/tools/address-book.ts:56-62 (registration)The registration of lob_addresses_get via the registerTool helper within registerAddressBookTools. Uses ToolAnnotationPresets.read (readOnlyHint, idempotent, non-destructive).
registerTool(server, { name: "lob_addresses_get", annotations: { title: "Retrieve a saved address", ...ToolAnnotationPresets.read }, description: "Retrieve a single saved address by ID.", inputSchema: { id: z.string().regex(/^adr_/).describe("Lob address ID (`adr_…`).") }, handler: async ({ id }) => lob.request({ method: "GET", path: `/addresses/${id}` }), }); - src/tools/helpers.ts:85-117 (helper)The registerTool helper function that wraps the SDK's server.registerTool with consistent error handling and JSON content formatting. Used by all tool registrations including lob_addresses_get.
export function registerTool<TShape extends ZodRawShape>( server: McpServer, def: ToolDefinition<TShape>, ): void { const a = def.annotations ?? {}; server.registerTool( def.name, { title: a.title ?? def.name, description: def.description, inputSchema: def.inputSchema, annotations: { ...a, // Lob is always external; default the hint accordingly. openWorldHint: a.openWorldHint ?? true, }, }, // The SDK's ToolCallback type is parameterised over the exact ZodRawShape and // resists the generic erasure here. The runtime contract (validated args in, // CallToolResult out) is correct, so we bridge the type boundary with `as never`. (async (args: unknown, serverCtx: unknown): Promise<CallToolResult> => { try { const result = await def.handler(args as never, serverCtx); return { content: [{ type: "text", text: stringifyResult(result) }] }; } catch (err) { return { isError: true, content: [{ type: "text", text: formatErrorForTool(err) }], }; } }) as never, ); }