Skip to main content
Glama

set-organization

Assigns an organization ID to scope all subsequent API requests to a specific organization.

Instructions

Set the organization ID for subsequent requests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orgIdYesOrganization ID

Implementation Reference

  • The handler for the 'set-organization' tool. It accepts an orgId (number), stores it in the global 'orgId' variable, and returns a success message. The stored orgId is then automatically attached to subsequent API requests via the authenticatedRequest helper.
    // Set organization ID tool
    server.tool("set-organization", "Set the organization ID for subsequent requests", {
        orgId: z.number().describe("Organization ID")
    }, async ({ orgId: newOrgId }) => {
        try {
            orgId = newOrgId;
            return {
                content: [{
                        type: "text",
                        text: `Organization ID set to ${newOrgId}`
                    }]
            };
        }
        catch (error) {
            return {
                isError: true,
                content: [{ type: "text", text: `Error setting organization ID: ${getErrorMessage(error)}` }]
            };
        }
    });
  • Schema definition for 'set-organization' tool. Defines the input parameter: orgId as a Zod number with description 'Organization ID'.
    server.tool("set-organization", "Set the organization ID for subsequent requests", {
        orgId: z.number().describe("Organization ID")
    }, async ({ orgId: newOrgId }) => {
  • build/index.js:574-592 (registration)
    Registration of the 'set-organization' tool on the MCP server using server.tool() with name 'set-organization', description 'Set the organization ID for subsequent requests'.
    server.tool("set-organization", "Set the organization ID for subsequent requests", {
        orgId: z.number().describe("Organization ID")
    }, async ({ orgId: newOrgId }) => {
        try {
            orgId = newOrgId;
            return {
                content: [{
                        type: "text",
                        text: `Organization ID set to ${newOrgId}`
                    }]
            };
        }
        catch (error) {
            return {
                isError: true,
                content: [{ type: "text", text: `Error setting organization ID: ${getErrorMessage(error)}` }]
            };
        }
    });
  • Global variable 'orgId' that stores the organization ID set by the tool, initialized to null.
    let orgId = null;
  • The authenticatedRequest helper uses the stored orgId by appending it as a query parameter (orgId.toString()) to all API requests when orgId is not null.
    // Add orgId if available
    if (orgId !== null) {
        queryParams.orgId = orgId.toString();
    }
Behavior3/5

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

No annotations provided, and the description only states it sets the organization ID, omitting details like side effects, persistence, or scope of effect (e.g., session lifetime).

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?

A single, front-loaded sentence that efficiently communicates the tool's purpose with zero waste.

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

Completeness4/5

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

For a simple setter with one parameter and no output schema, the description is largely complete, though it could mention behavior like overwriting previous values.

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

Parameters3/5

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

Schema coverage is 100% with a clear description for orgId, but the tool description adds no additional meaning beyond what the schema already provides.

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

Purpose5/5

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

The description clearly states the verb (set) and specific resource (organization ID), distinguishing it from sibling tools like authentication or data operations.

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

Usage Guidelines3/5

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

The phrase 'for subsequent requests' implies it should be called early, but no explicit guidance on when to use versus alternatives or when not to use.

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/mingzilla/pi-api-mcp-server'

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