Skip to main content
Glama

Verify a US address

lob_us_verifications_create
Read-onlyIdempotent

Verify, correct, and standardize a US address. Returns deliverability status, USPS components, geolocation, and county info.

Instructions

Verify, correct, and standardize a single US address. Returns deliverability status, USPS-formatted components, geolocation (lat/lng), and county info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
primary_lineYesPrimary street address line.
secondary_lineNoApartment/suite/unit line.
urbanizationNoPuerto Rico urbanization, if applicable.
cityNo
stateNoTwo-letter US state code.
zip_codeNo5- or 9-digit ZIP.
addressNoFull single-line address, used instead of separated fields.
recipientNoRecipient name.
caseNoCasing to apply to returned components. Defaults to 'upper'.
extraNoAdditional Lob API parameters not enumerated above. Merged into the request body verbatim. See https://docs.lob.com for the full parameter list per resource.

Implementation Reference

  • The handler function that executes the tool logic: destructures extra params, then sends a POST request to Lob's /us_verifications endpoint with the address fields merged with extras.
    handler: async (args) => {
      const { extra, ...rest } = args;
      return lob.request({
        method: "POST",
        path: "/us_verifications",
        body: withExtra(rest, extra),
      });
    },
  • Input schema for the tool: extends usAddressInputSchema (primary_line, secondary_line, urbanization, city, state, zip_code, address, recipient) with optional 'case' (upper/proper) and 'extra' escape hatch.
    inputSchema: {
      ...usAddressInputSchema,
      case: z
        .enum(["upper", "proper"])
        .optional()
        .describe("Casing to apply to returned components. Defaults to 'upper'."),
      extra: extraParamsSchema,
    },
  • Shared US address input schema used by the tool, defining fields: primary_line, secondary_line, urbanization, city, state, zip_code, address (single-line alternative), and recipient.
    const usAddressInputSchema = {
      primary_line: z.string().describe("Primary street address line."),
      secondary_line: z.string().optional().describe("Apartment/suite/unit line."),
      urbanization: z.string().optional().describe("Puerto Rico urbanization, if applicable."),
      city: z.string().optional(),
      state: z.string().optional().describe("Two-letter US state code."),
      zip_code: z.string().optional().describe("5- or 9-digit ZIP."),
      /** Lob will accept either separated fields above OR a single `address` field. */
      address: z
        .string()
        .optional()
        .describe("Full single-line address, used instead of separated fields."),
      recipient: z.string().optional().describe("Recipient name."),
    };
  • Registration: the tool is registered via registerTool() inside registerVerificationTools() called from src/tools/register.ts line 35. The registration ties the name 'lob_us_verifications_create' to its input schema, annotations, description, and handler.
    export function registerVerificationTools(server: McpServer, lob: LobClient): void {
      registerTool(server, {
        name: "lob_us_verifications_create",
        annotations: { title: "Verify a US address", ...ToolAnnotationPresets.read },
        description:
          "Verify, correct, and standardize a single US address. Returns deliverability status, " +
          "USPS-formatted components, geolocation (lat/lng), and county info.",
        inputSchema: {
          ...usAddressInputSchema,
          case: z
            .enum(["upper", "proper"])
            .optional()
            .describe("Casing to apply to returned components. Defaults to 'upper'."),
          extra: extraParamsSchema,
        },
        handler: async (args) => {
          const { extra, ...rest } = args;
          return lob.request({
            method: "POST",
            path: "/us_verifications",
            body: withExtra(rest, extra),
          });
        },
      });
  • The registerTool helper function that wraps the tool definition with error handling/formatting and delegates to server.registerTool().
    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,
      );
    }
    
    function stringifyResult(value: unknown): string {
      if (value === undefined || value === null) return "(no content)";
      if (typeof value === "string") return value;
      try {
        return JSON.stringify(value, null, 2);
      } catch {
        // JSON.stringify throws on circular refs; safeStringify handles them via fallback.
        return safeStringify(value);
      }
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate read-only, non-destructive, and idempotent behavior. The description adds specific return value details (deliverability status, USPS-formatted components, geolocation, county info), which enhances transparency beyond annotations. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is concise and informative. It front-loads the key action and output, with no unnecessary words. Every piece of information earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the 10 parameters and high schema coverage, the description adequately covers the purpose and outputs. It does not discuss error cases or prerequisites, but for a verification tool with read-only semantics and idempotency, the description is sufficiently complete for an agent to understand the tool's functionality.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 90%, so the schema already explains most parameters. The description does not add new semantics beyond what is in the schema. It reinforces that the tool handles a single US address, but that is already implied by the tool name. Baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Verify, correct, and standardize'), the resource ('a single US address'), and the outputs (deliverability status, USPS components, geolocation, county info). It differentiates from sibling tools like 'lob_bulk_us_verifications_create' by specifying 'single', and from 'lob_us_verifications_get' by being a creation/verification action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use for single-address verification, contrasting with bulk operations available in siblings. However, it lacks explicit guidance on when to use this tool vs others like 'lob_us_verifications_get' or 'lob_intl_verifications_create'. The context is clear but not exhaustive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/optimize-overseas/lob-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server