get_entity
Retrieve canonical AnchorIDs by UUID to resolve companies or people. Optionally fetch linked source records and relationships for complete entity context across systems.
Instructions
Fetch an AnchorID (canonical entity) by UUID. Optionally include linked source records via the include parameter (links, source_records, or both).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entity_id | Yes | UUID of the AnchorID to retrieve | |
| include | No | Comma-separated relations to include: "links", "source_records", or both |
Implementation Reference
- src/tools.ts:228-236 (handler)Handler function for get_entity tool - executes the API call to fetch an entity by UUID with optional includes
async ({ entity_id, include }) => { try { const params: Record<string, string | undefined> = { include }; const data = await api.get(`/entities/${entity_id}`, params); return jsonContent(data); } catch (e) { return errorContent(e); } }, - src/tools.ts:214-237 (registration)Registration of the get_entity tool with name, description, schema, and handler
// ─── 5. get_entity ─────────────────────────────────────────────── server.tool( "get_entity", "Fetch an AnchorID (canonical entity) by UUID. Optionally include linked " + "source records via the include parameter (links, source_records, or both).", { entity_id: z.string().describe("UUID of the AnchorID to retrieve"), include: z .string() .optional() .describe( 'Comma-separated relations to include: "links", "source_records", or both', ), }, async ({ entity_id, include }) => { try { const params: Record<string, string | undefined> = { include }; const data = await api.get(`/entities/${entity_id}`, params); return jsonContent(data); } catch (e) { return errorContent(e); } }, ); - src/tools.ts:219-227 (schema)Zod schema definition for get_entity tool parameters (entity_id and include)
{ entity_id: z.string().describe("UUID of the AnchorID to retrieve"), include: z .string() .optional() .describe( 'Comma-separated relations to include: "links", "source_records", or both', ), }, - src/tools.ts:18-42 (helper)Helper functions jsonContent and errorContent for formatting tool responses
function jsonContent(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], }; } /** Format an error as MCP tool content (isError flag). */ function errorContent(err: unknown) { if (err instanceof ApiError) { const payload = { error: err.message, status_code: err.status_code, request_id: err.request_id, details: err.details, }; return { content: [{ type: "text" as const, text: JSON.stringify(payload, null, 2) }], isError: true, }; } return { content: [{ type: "text" as const, text: (err as Error).message ?? String(err) }], isError: true, }; } - src/api-client.ts:73-90 (helper)ApiClient.get method used by get_entity handler to make HTTP GET requests
async get<T = unknown>( path: string, params?: Record<string, string | undefined>, ): Promise<T> { const requestId = this.generateRequestId(); const url = new URL(`${this.baseUrl}/api/v1${path}`); if (params) { for (const [k, v] of Object.entries(params)) { if (v !== undefined && v !== "") { url.searchParams.set(k, v); } } } const res = await fetch(url.toString(), { method: "GET", headers: this.headers(requestId), }); return this.parse<T>(res, requestId);