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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions the return format ('list of users with details like userid, email, role etc'), which adds some behavioral context, but lacks critical information such as pagination, permissions required, rate limits, or whether it's read-only.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the purpose and includes return details. It avoids unnecessary words, though it could be slightly more structured by separating purpose from output details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate. It covers the purpose and return format, but as a list tool with no behavioral annotations, it should ideally include more context like pagination or filtering options.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, earning a baseline score of 4 for not introducing confusion.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('users by organization'), specifying what the tool does. It distinguishes itself from other list tools by focusing on users organized by organization, though it doesn't explicitly differentiate from sibling tools like 'list_oncall_users' or 'list_teams'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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