sam_lookup_organization
Resolve a SAM.gov federal organization ID to its full hierarchy path name, providing complete organizational context when only an ID is available.
Instructions
Resolve a SAM.gov federal-organization id to its canonical fullParentPathName (e.g. 'VETERANS AFFAIRS, DEPARTMENT OF.VETERANS AFFAIRS, DEPARTMENT OF.245-NETWORK CONTRACT OFFICE 5'). Use when sam_get_opportunity returned only an organizationId.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | SAM.gov federal-organization id (numeric) |
Implementation Reference
- src/server.ts:652-689 (handler)The actual handler logic for the sam_lookup_organization tool. It parses the organizationId from the input, makes a direct fetch to sam.gov's public federal organizations API endpoint, and returns the organization's fullParentPathName, agencyName, name, type, and level.
case "sam_lookup_organization": { const { organizationId } = SamLookupOrgInput.parse(args); // SamGovClient internal method — exposed via direct fetch since // it's not on the public surface. Use the public sam.gov endpoint // directly (already keyless). const r = await fetch( `https://sam.gov/api/prod/federalorganizations/v1/organizations/${encodeURIComponent(organizationId)}`, { headers: { Accept: "application/hal+json" }, signal: AbortSignal.timeout(10_000), }, ); if (!r.ok) { return { found: false, organizationId, status: r.status }; } type Resp = { _embedded?: { org?: { fullParentPathName?: string; agencyName?: string; name?: string; type?: string; level?: number; }; }[]; }; const json = (await r.json()) as Resp; const org = json._embedded?.[0]?.org; return { found: !!org, organizationId, fullParentPathName: org?.fullParentPathName ?? "", agencyName: org?.agencyName ?? "", name: org?.name ?? "", type: org?.type, level: org?.level, }; } - src/server.ts:274-276 (schema)The Zod input schema (SamLookupOrgInput) for the sam_lookup_organization tool, requiring a single string field 'organizationId' described as 'SAM.gov federal-organization id (numeric)'.
const SamLookupOrgInput = z.object({ organizationId: z.string().describe("SAM.gov federal-organization id (numeric)"), }); - src/server.ts:313-317 (registration)The tool registration entry in the TOOLS array, defining the name 'sam_lookup_organization', its description, and linking to SamLookupOrgInput as the inputSchema.
name: "sam_lookup_organization", description: "Resolve a SAM.gov federal-organization id to its canonical fullParentPathName (e.g. 'VETERANS AFFAIRS, DEPARTMENT OF.VETERANS AFFAIRS, DEPARTMENT OF.245-NETWORK CONTRACT OFFICE 5'). Use when sam_get_opportunity returned only an organizationId.", inputSchema: SamLookupOrgInput, },