Skip to main content
Glama

Get User

discourse_get_user

Retrieve basic user information from Discourse forums by providing a username. This tool enables AI agents to access user profiles for forum interaction and data retrieval.

Instructions

Get basic user info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYes

Implementation Reference

  • The tool handler that executes the logic to fetch user data from Discourse API, process it, and return formatted text or error.
    async ({ username }, _extra: any) => {
      try {
        const { base, client } = ctx.siteState.ensureSelectedSite();
        const data = (await client.get(`/u/${encodeURIComponent(username)}.json`)) as any;
        const user = data?.user || data?.user_badges || data;
        const name = user?.name || username;
        const trust = user?.trust_level;
        const created = user?.created_at || user?.user?.created_at || "";
        const bio = user?.bio_raw || "";
        const lines = [
          `@${username} (${name})`,
          trust != null ? `Trust level: ${trust}` : undefined,
          created ? `Joined: ${created}` : undefined,
          bio ? "" : undefined,
          bio ? bio.slice(0, 1000) : undefined,
          `Profile: ${base}/u/${encodeURIComponent(username)}`,
        ].filter(Boolean) as string[];
        return { content: [{ type: "text", text: lines.join("\n") }] };
      } catch (e: any) {
        return { content: [{ type: "text", text: `Failed to get user ${username}: ${e?.message || String(e)}` }], isError: true };
      }
    }
  • Input schema using Zod for validating the 'username' parameter.
    const schema = z.object({
      username: z.string().min(1),
    });
  • Registers the 'discourse_get_user' tool on the MCP server with title, description, input schema, and handler function.
    server.registerTool(
      "discourse_get_user",
      {
        title: "Get User",
        description: "Get basic user info.",
        inputSchema: schema.shape,
      },
      async ({ username }, _extra: any) => {
        try {
          const { base, client } = ctx.siteState.ensureSelectedSite();
          const data = (await client.get(`/u/${encodeURIComponent(username)}.json`)) as any;
          const user = data?.user || data?.user_badges || data;
          const name = user?.name || username;
          const trust = user?.trust_level;
          const created = user?.created_at || user?.user?.created_at || "";
          const bio = user?.bio_raw || "";
          const lines = [
            `@${username} (${name})`,
            trust != null ? `Trust level: ${trust}` : undefined,
            created ? `Joined: ${created}` : undefined,
            bio ? "" : undefined,
            bio ? bio.slice(0, 1000) : undefined,
            `Profile: ${base}/u/${encodeURIComponent(username)}`,
          ].filter(Boolean) as string[];
          return { content: [{ type: "text", text: lines.join("\n") }] };
        } catch (e: any) {
          return { content: [{ type: "text", text: `Failed to get user ${username}: ${e?.message || String(e)}` }], isError: true };
        }
      }
    );
  • Top-level call to the registerGetUser function within the registerAllTools to include the tool.
    registerGetUser(server, ctx, { allowWrites: false });
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 of behavioral disclosure. 'Get basic user info' implies a read-only operation, but it doesn't specify authentication requirements, rate limits, error conditions, or what constitutes 'basic info' (e.g., public vs. private data). For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It's appropriately sized for a simple tool and front-loaded with the core action. Every word earns its place, making it easy to parse quickly.

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

Completeness2/5

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

Given the tool's simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It doesn't explain what 'basic user info' includes, how to interpret the 'username' parameter, or what the return value looks like. For a tool with no structured output documentation, the description should provide more context about the expected results.

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

Parameters2/5

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

The input schema has one parameter ('username') with 0% schema description coverage, meaning the schema provides no semantic context. The description 'Get basic user info' doesn't mention the 'username' parameter at all, failing to compensate for the schema's lack of documentation. It adds no meaning beyond what the bare schema indicates.

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

Purpose3/5

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

The description 'Get basic user info' clearly indicates a retrieval operation on a user resource, but it's vague about what 'basic info' includes and doesn't differentiate from sibling tools like 'discourse_list_user_posts' or 'discourse_list_user_chat_channels'. It states what the tool does but lacks specificity about scope or content.

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. There are multiple sibling tools that involve users (e.g., 'discourse_list_user_posts', 'discourse_list_user_chat_channels'), but the description doesn't specify that this is for profile information rather than user-generated content or activity. No explicit or implied context for usage is provided.

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/SamSaffron/discourse-mcp'

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