Skip to main content
Glama

Retrieve a letter

lob_letters_get
Read-onlyIdempotent

Retrieve a specific letter by its unique ID (ltr_…). Provide the letter identifier to get its details.

Instructions

Retrieve a single letter by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesLetter ID (`ltr_…`).

Implementation Reference

  • The handler for lob_letters_get. It is an inline async function that calls lob.request() with method GET and path `/letters/${id}`, retrieving a single letter by its ID.
    registerTool(server, {
      name: "lob_letters_get",
      annotations: { title: "Retrieve a letter", ...ToolAnnotationPresets.read },
      description: "Retrieve a single letter by ID.",
      inputSchema: { id: LETTER_ID },
      handler: async ({ id }) =>
        lob.request({ method: "GET", path: `/letters/${id}` }),
    });
  • The LETTER_ID schema used as the input schema for lob_letters_get. Validates that the ID matches the pattern `ltr_`.
    const LETTER_ID = z.string().regex(/^ltr_/).describe("Letter ID (`ltr_…`).");
  • Registration of lob_letters_get via registerTool() with name, annotations (title 'Retrieve a letter', read preset), description, inputSchema, and handler.
    registerTool(server, {
      name: "lob_letters_get",
      annotations: { title: "Retrieve a letter", ...ToolAnnotationPresets.read },
      description: "Retrieve a single letter by ID.",
      inputSchema: { id: LETTER_ID },
      handler: async ({ id }) =>
        lob.request({ method: "GET", path: `/letters/${id}` }),
    });
  • Top-level registration entry point: registerLetterTools is called, which wires up all letter tools including lob_letters_get.
    registerLetterTools(server, lob, tokenStore, pieceCounter);
  • The registerTool helper function that wraps the MCP server's registerTool with consistent error handling, annotation support, and JSON content formatting.
    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,
Behavior3/5

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

The description is consistent with annotations (readOnlyHint, etc.) but adds no extra behavioral context (e.g., error behavior, rate limits). Annotations already provide a clear safety profile.

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?

One sentence with no filler. Directly states the action and resource. Every word earns its place.

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

Completeness3/5

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

Adequate for a simple retrieval tool, but lacks mention of return value or error cases. With many siblings and no output schema, the description could hint at the response structure. Still minimally viable.

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?

The single parameter 'id' is fully covered by the schema (including pattern and description). The description adds no additional meaning beyond the schema, so baseline 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 uses 'Retrieve' (specific verb) and 'letter by ID' (resource and method), clearly distinguishing from sibling tools like lob_letters_list or lob_letters_create.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives (e.g., lob_letters_list, lob_letters_preview). The description does not specify context or exclusions.

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