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
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | The project ID |
Implementation Reference
- src/tools/list-subdomains.ts:10-55 (handler)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") }] }; } - src/tools/list-subdomains.ts:6-8 (schema)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), );