get_current_user
Retrieve the user identity associated with the current API token to verify ownership and audit connector activity.
Instructions
Show the user owning the API token this connector is using. Useful for audit ('under whose Capsule identity is the connector running?') and for confirming a token rotation moved ownership to the expected account. Wraps Capsule's GET /users/current — note the endpoint is /users/current, not /users/me.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/users.ts:33-36 (handler)The handler function for get_current_user. It calls capsuleGet("/users/current") to fetch the user owning the PAT, returning the data (with { user: ... }) from Capsule's API.
export async function getCurrentUser(_input: z.infer<typeof getCurrentUserSchema>) { const { data } = await capsuleGet<{ user: unknown }>("/users/current"); return data; } - src/tools/users.ts:31-31 (schema)Input schema for get_current_user — an empty object (no parameters needed).
export const getCurrentUserSchema = z.object({}); - src/server.ts:1007-1013 (registration)Registration of the get_current_user tool on the MCP server. Wraps the handler with registerTool helper, providing name, description, schema, and handler function.
registerTool( server, "get_current_user", "Show the user owning the API token this connector is using. Useful for audit ('under whose Capsule identity is the connector running?') and for confirming a token rotation moved ownership to the expected account. Wraps Capsule's GET /users/current — note the endpoint is /users/current, not /users/me.", getCurrentUserSchema, getCurrentUser, ); - src/server/register-tool.ts:39-59 (helper)The generic registerTool helper that wraps the handler's return value into MCP's standard text content response format.
export function registerTool<Schema extends z.ZodObject<ZodRawShape>>( server: McpServer, name: string, description: string, schema: Schema, handler: (input: z.infer<Schema>) => Promise<unknown>, ): void { // Use the SDK config-form registerTool with the full Zod schema. The // deprecated shape overload rebuilds z.object(schema.shape), which drops // object-level refinements such as superRefine. const registerWithSchema = server.registerTool.bind(server) as ( toolName: string, config: { description: string; inputSchema: Schema }, callback: (input: z.infer<Schema>) => Promise<CallToolResult>, ) => void; registerWithSchema(name, { description, inputSchema: schema }, async (input) => { const result = await handler(input); return wrapAsText(result); }); } - src/capsule/client.ts:344-355 (helper)capsuleGet — the HTTP client helper used by getCurrentUser to make GET requests to the Capsule API with authentication, retry, and pagination support.
export async function capsuleGet<T>(path: string, params?: QueryParams): Promise<PagedResult<T>> { const token = getToken(); const url = buildUrl(path, params); const { res, cleanup } = await doFetch(url, { headers: baseHeaders(token) }); try { const data = await handleResponse<T>(res); const nextPage = parseNextPage(res.headers.get("Link")); return { data, nextPage }; } finally { cleanup(); } }