get-role
Retrieve role details by name in OpenMetadata. Filter by fields or include status to get exactly the information you need.
Instructions
Get role details by name
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Role name | |
| fields | No | Comma-separated fields to include | |
| include | No |
Implementation Reference
- src/tools/access.ts:26-29 (handler)The getRole handler function that executes the tool logic. It extracts the 'name' param for the URL path and passes remaining query params (fields, include) as query string to the OpenMetadata API endpoint /roles/name/{name}.
export async function getRole(params: z.infer<typeof getRoleSchema>) { const { name, ...query } = params; return omClient.get(`/roles/name/${encodeURIComponent(name)}`, query); } - src/tools/access.ts:20-24 (schema)The getRoleSchema defines the input validation schema for the get-role tool. It requires a 'name' (string) parameter, with optional 'fields' (comma-separated list) and 'include' (enum: non-deleted, deleted, all).
export const getRoleSchema = z.object({ name: z.string().describe("Role name"), fields: z.string().optional().describe("Comma-separated fields to include"), include: z.enum(["non-deleted", "deleted", "all"]).optional(), }); - src/index.ts:371-371 (registration)Registration of the get-role tool in the MCP server. It registers the tool under the 'Roles' category with description 'Get role details by name', using getRoleSchema for input validation and wrapToolHandler(getRole) as the handler.
tool("get-role", "Get role details by name", getRoleSchema.shape, wrapToolHandler(getRole)); - src/index.ts:106-106 (registration)Import statement where getRoleSchema and getRole are imported from src/tools/access.ts into the registration file.
import { listRolesSchema, listRoles, getRoleSchema, getRole, listPoliciesSchema, listPolicies, getPolicySchema, getPolicy } from "./tools/access.js";