Skip to main content
Glama
0xteamhq

Grafana MCP Server

by 0xteamhq

list_users_by_org

Retrieve a list of organization users with details including user ID, email, and role for user management and access control in Grafana.

Instructions

List users by organization. Returns a list of users with details like userid, email, role etc

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The ToolDefinition export including the handler function that executes the tool logic by fetching users via GrafanaClient and formatting the response.
    export const listUsersByOrg: ToolDefinition = { name: 'list_users_by_org', description: 'List users by organization. Returns a list of users with details like userid, email, role etc', inputSchema: ListUsersByOrgSchema, handler: async (_params, context: ToolContext) => { try { const client = new GrafanaClient(context.config.grafanaConfig); const users = await client.listUsers(); // Format the response const formatted = users.map(user => ({ id: user.id, email: user.email, name: user.name, login: user.login, role: user.role, lastSeenAt: user.lastSeenAt, isDisabled: user.isDisabled, })); return createToolResult(formatted); } catch (error: any) { return createErrorResult(error.message); } }, };
  • Zod input schema for the list_users_by_org tool (accepts no parameters).
    const ListUsersByOrgSchema = z.object({});
  • Registration of the list_users_by_org tool via server.registerTool call within registerAdminTools function.
    server.registerTool(listUsersByOrg);
  • src/cli.ts:123-123 (registration)
    Invocation of registerAdminTools which registers the admin tools including list_users_by_org.
    registerAdminTools(server);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/0xteamhq/mcp-grafana'

If you have feedback or need assistance with the MCP directory API, please join our Discord server