Skip to main content
Glama

list_subdomains

Retrieve all subdomains associated with a specific project ID to manage web infrastructure and domain organization.

Instructions

List all subdomains claimed by a project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe project ID

Implementation Reference

  • The handleListSubdomains function implements the tool logic. It retrieves the project from keystore, makes an authenticated API request to /v1/subdomains, and returns a formatted markdown table of subdomains or a message indicating none are claimed.
    export async function handleListSubdomains(args: {
      project_id: string;
    }): Promise<{ content: Array<{ type: "text"; text: string }>; isError?: boolean }> {
      const project = getProject(args.project_id);
      if (!project) return projectNotFound(args.project_id);
    
      const res = await apiRequest("/v1/subdomains", {
        method: "GET",
        headers: {
          Authorization: `Bearer ${project.service_key}`,
        },
      });
    
      if (!res.ok) return formatApiError(res, "listing subdomains");
    
      const subdomains = res.body as Array<{
        name: string;
        url: string;
        deployment_id: string;
        deployment_url: string;
      }>;
    
      if (subdomains.length === 0) {
        return {
          content: [
            {
              type: "text",
              text: `## Subdomains\n\n_No subdomains claimed. Use \`claim_subdomain\` to claim one._`,
            },
          ],
        };
      }
    
      const lines = [
        `## Subdomains (${subdomains.length})`,
        ``,
        `| Subdomain | URL | Deployment |`,
        `|-----------|-----|------------|`,
      ];
    
      for (const s of subdomains) {
        lines.push(`| ${s.name} | ${s.url} | \`${s.deployment_id}\` |`);
      }
    
      return { content: [{ type: "text", text: lines.join("\n") }] };
    }
  • The listSubdomainsSchema defines the input validation using Zod, requiring a project_id string parameter.
    export const listSubdomainsSchema = {
      project_id: z.string().describe("The project ID"),
    };
  • src/index.ts:220-225 (registration)
    Registers the 'list_subdomains' tool with the MCP server, providing the description 'List all subdomains claimed by a project', the schema, and the handler function.
    server.tool(
      "list_subdomains",
      "List all subdomains claimed by a project.",
      listSubdomainsSchema,
      async (args) => handleListSubdomains(args),
    );

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/kychee-com/run402'

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