get_organization
Retrieve complete nonprofit details by EIN, including metadata and latest IRS Form 990 summary. Optionally receive the raw ProPublica payload by setting verbose=true.
Instructions
Get full details for a single nonprofit by EIN, including organization metadata and a summary of the most recent IRS Form 990 filings. Pass verbose=true for the raw upstream payload.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ein | Yes | The nonprofit EIN, with or without punctuation. | |
| verbose | No | Return the full raw ProPublica payload when true. |
Implementation Reference
- src/tools/get-organization.ts:22-32 (handler)The main handler function that executes the 'get_organization' tool logic. Calls client.getOrganization() and returns either verbose raw data or a summarized result.
export async function handler( client: ProPublicaClient, args: z.infer<z.ZodObject<typeof inputSchema>>, ) { try { const result = await client.getOrganization(args.ein); return jsonResult(args.verbose ? result : summarizeOrganization(result)); } catch (error) { return errorResult(error); } } - src/tools/get-organization.ts:11-20 (schema)Input schema defining the 'ein' (required string) and 'verbose' (optional boolean) parameters for the tool.
export const inputSchema = { ein: z .string() .min(1) .describe("The nonprofit EIN, with or without punctuation."), verbose: z .boolean() .optional() .describe("Return the full raw ProPublica payload when true."), }; - src/index.ts:35-42 (registration)Registration of the 'get_organization' tool with the MCP server, binding name, description, inputSchema, and handler.
server.registerTool( getOrganization.name, { description: getOrganization.description, inputSchema: getOrganization.inputSchema, }, (args) => getOrganization.handler(client, args), ); - src/client.ts:103-113 (helper)Helper method on ProPublicaClient that normalizes the EIN and fetches organization data via the ProPublica API with caching.
async getOrganization(ein: string): Promise<OrganizationResponse> { const normalizedEin = normalizeEin(ein); const cacheKey = `org:${normalizedEin}`; return this.getOrSet<OrganizationResponse>(cacheKey, async () => this.fetchJson<OrganizationResponse>(`organizations/${normalizedEin}.json`, { normalizedEin, logContext: `getOrganization ${normalizedEin}`, }), ); }