Skip to main content
Glama
gyuco
by gyuco

configure_rest_client

Set base URL, authentication, and optional Swagger documentation for REST API calls. Supports token or login-based authentication with configurable timeout and retries.

Instructions

Configure the REST client with base URL, authentication, and optional Swagger documentation URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseUrlYesBase URL for the REST API
swaggerUrlNoURL to Swagger/OpenAPI documentation (optional)
authYes
timeoutNoRequest timeout in milliseconds (default: 30000)
retriesNoNumber of retries for failed requests (default: 3)

Implementation Reference

  • The configureRestClient private method that executes the tool logic. It validates args with ConfigSchema, creates a new RestClient instance, and initializes it (including authentication and optional Swagger parsing). Returns a success message or throws on failure.
    private async configureRestClient(args: any) {
      try {
        const config = ConfigSchema.parse(args);
        this.restClient = new RestClient(config);
        await this.restClient.initialize();
    
        return {
          content: [
            {
              type: "text",
              text: `REST client configured successfully for ${config.baseUrl}${
                config.swaggerUrl
                  ? ` with Swagger documentation from ${config.swaggerUrl}`
                  : ""
              }`,
            },
          ],
        };
      } catch (error) {
        throw new Error(
          `Configuration failed: ${
            error instanceof Error ? error.message : "Unknown error"
          }`
        );
      }
    }
  • The ConfigSchema Zod schema used to validate the input arguments passed to configure_rest_client. Defines baseUrl (url), swaggerUrl (optional url), auth (AuthConfigSchema), timeout (default 30000), and retries (default 3).
    export const ConfigSchema = z.object({
      baseUrl: z.string().url(),
      swaggerUrl: z.string().url().optional(),
      auth: AuthConfigSchema,
      timeout: z.number().default(30000),
      retries: z.number().default(3),
    });
  • The AuthConfigSchema Zod discriminated union used within ConfigSchema. Supports two auth types: 'token' (with token field) and 'login' (with username, password, loginEndpoint, and optional tokenField defaulting to 'access_token').
    export const AuthConfigSchema = z.discriminatedUnion("type", [
      z.object({
        type: z.literal("token"),
        token: z.string(),
      }),
      z.object({
        type: z.literal("login"),
        username: z.string(),
        password: z.string(),
        loginEndpoint: z.string(),
        tokenField: z.string().default("access_token"),
      }),
    ]);
  • src/index.ts:52-126 (registration)
    Registration of the configure_rest_client tool in the ListToolsRequestSchema handler. Defines name, description, and inputSchema (with baseUrl required, swaggerUrl optional, auth required as oneOf token/login, timeout, retries).
    {
      name: "configure_rest_client",
      description:
        "Configure the REST client with base URL, authentication, and optional Swagger documentation URL",
      inputSchema: {
        type: "object",
        properties: {
          baseUrl: {
            type: "string",
            description: "Base URL for the REST API",
          },
          swaggerUrl: {
            type: "string",
            description:
              "URL to Swagger/OpenAPI documentation (optional)",
          },
          auth: {
            type: "object",
            oneOf: [
              {
                type: "object",
                properties: {
                  type: { type: "string", enum: ["token"] },
                  token: {
                    type: "string",
                    description: "Authentication token",
                  },
                },
                required: ["type", "token"],
              },
              {
                type: "object",
                properties: {
                  type: { type: "string", enum: ["login"] },
                  username: {
                    type: "string",
                    description: "Username for login",
                  },
                  password: {
                    type: "string",
                    description: "Password for login",
                  },
                  loginEndpoint: {
                    type: "string",
                    description: "Login endpoint path",
                  },
                  tokenField: {
                    type: "string",
                    description:
                      "Field name for access token in response (default: access_token)",
                  },
                },
                required: [
                  "type",
                  "username",
                  "password",
                  "loginEndpoint",
                ],
              },
            ],
          },
          timeout: {
            type: "number",
            description:
              "Request timeout in milliseconds (default: 30000)",
          },
          retries: {
            type: "number",
            description:
              "Number of retries for failed requests (default: 3)",
          },
        },
        required: ["baseUrl", "auth"],
      },
    },
  • src/index.ts:225-226 (registration)
    Dispatch in the CallToolRequestSchema handler that routes the 'configure_rest_client' tool name to the configureRestClient method.
    case "configure_rest_client":
      return await this.configureRestClient(args);
Behavior2/5

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

No annotations provided, so description must disclose side effects. It mentions authentication but does not state that login auth may trigger network calls or that configuration persists globally. The description is insufficient for an agent to understand behavioral implications.

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, well-structured sentence that front-loads the key purpose. No unnecessary words.

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?

As a configuration tool with complex auth options and no output schema, the description is too brief. It does not explain return value, persistence of settings, or prerequisites. An agent would benefit from more detail on how configuration affects subsequent requests.

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 80%, so description adds some value by summarizing parameters into groups (base URL, auth, Swagger URL). However, it does not elaborate on the auth object's two distinct modes, leaving the agent to infer from schema.

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 tool configures a REST client with base URL, authentication, and optional Swagger URL. It distinguishes from siblings like http_request which use the client, but could be more specific about the configuration scope.

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?

No explicit guidance on when to use this tool versus alternatives. It should indicate that this setup is required before making HTTP requests, but the description is silent on usage context.

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/gyuco/mcp-http-client'

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