Skip to main content
Glama

init_project

Create a .ploi.json config file to connect your project to a Ploi site using the project path and domain.

Instructions

Initialize .ploi.json config for a project by searching for a domain. Use when user wants to link a project to a Ploi site.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYesThe path to the project directory
domainYesThe domain name of the Ploi site to link

Implementation Reference

  • The 'init_project' tool handler: searches for a Ploi site by domain across all servers, then writes a .ploi.json config file in the project directory linking the project to the found server/site.
      async ({ project_path, domain }) => {
        const servers = await client.listServers();
        let foundServer: { id: number; name: string } | null = null;
        let foundSite: Site | null = null;
    
        for (const server of servers) {
          const sites = await client.listSites(server.id);
          for (const site of sites) {
            if (site.domain.toLowerCase().includes(domain.toLowerCase())) {
              foundServer = { id: server.id, name: server.name };
              foundSite = site;
              break;
            }
          }
          if (foundSite) break;
        }
    
        if (!foundSite || !foundServer) {
          return {
            content: [
              {
                type: "text" as const,
                text: `No site found matching "${domain}". Use list_servers and list_sites to find your site.`,
              },
            ],
          };
        }
    
        const config = {
          server_id: foundServer.id,
          site_id: foundSite.id,
        };
    
        const configPath = join(project_path, ".ploi.json");
        await writeFile(configPath, JSON.stringify(config, null, 2) + "\n");
    
        return {
          content: [
            {
              type: "text" as const,
              text: `Created .ploi.json for ${foundSite.domain}\n\nServer: ${foundServer.name} (${foundServer.id})\nSite: ${foundSite.domain} (${foundSite.id})\n\nYou can now use "deploy" to deploy this project.`,
            },
          ],
        };
      }
    );
  • Input schema for the 'init_project' tool: requires 'project_path' (string) and 'domain' (string) as parameters.
    {
      project_path: z.string().describe("The path to the project directory"),
      domain: z.string().describe("The domain name of the Ploi site to link"),
    },
  • Registration of the 'init_project' tool via server.tool() inside the registerSiteTools function.
    server.tool(
      "init_project",
      "Initialize .ploi.json config for a project by searching for a domain. Use when user wants to link a project to a Ploi site.",
      {
        project_path: z.string().describe("The path to the project directory"),
        domain: z.string().describe("The domain name of the Ploi site to link"),
      },
      async ({ project_path, domain }) => {
        const servers = await client.listServers();
        let foundServer: { id: number; name: string } | null = null;
        let foundSite: Site | null = null;
    
        for (const server of servers) {
          const sites = await client.listSites(server.id);
          for (const site of sites) {
            if (site.domain.toLowerCase().includes(domain.toLowerCase())) {
              foundServer = { id: server.id, name: server.name };
              foundSite = site;
              break;
            }
          }
          if (foundSite) break;
        }
    
        if (!foundSite || !foundServer) {
          return {
            content: [
              {
                type: "text" as const,
                text: `No site found matching "${domain}". Use list_servers and list_sites to find your site.`,
              },
            ],
          };
        }
    
        const config = {
          server_id: foundServer.id,
          site_id: foundSite.id,
        };
    
        const configPath = join(project_path, ".ploi.json");
        await writeFile(configPath, JSON.stringify(config, null, 2) + "\n");
    
        return {
          content: [
            {
              type: "text" as const,
              text: `Created .ploi.json for ${foundSite.domain}\n\nServer: ${foundServer.name} (${foundServer.id})\nSite: ${foundSite.domain} (${foundSite.id})\n\nYou can now use "deploy" to deploy this project.`,
            },
          ],
        };
      }
    );
  • Helper function readPloiConfig for reading existing .ploi.json configs (utility in the same file).
    async function readPloiConfig(projectPath: string): Promise<PloiConfig | null> {
      try {
        const configPath = join(projectPath, ".ploi.json");
        const content = await readFile(configPath, "utf-8");
        const config = JSON.parse(content) as PloiConfig;
        if (typeof config.server_id === "number" && typeof config.site_id === "number") {
          return config;
        }
        return null;
      } catch {
        return null;
      }
    }
Behavior3/5

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

No annotations provided. Description implies a write operation (init/config creation) but does not detail side effects, permissions needed, or failure modes. Adequate for a simple tool.

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?

Two sentences, front-loaded with purpose, zero waste. Efficiently communicates key information.

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 tool with 2 required parameters and no output schema, the description covers use case and basic behavior. Lacks return value or error handling info, but remains sufficient for agent selection.

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

Parameters4/5

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

Schema has 100% description coverage. Description adds context ('by searching for a domain') that enhances understanding of the 'domain' parameter beyond the schema's description.

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 action ('Initialize .ploi.json config') and the specific use case ('link a project to a Ploi site'). It distinguishes itself from siblings like find_site_by_domain or deploy_project.

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

Usage Guidelines4/5

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

Explicitly states when to use: 'Use when user wants to link a project to a Ploi site.' No explicit alternatives or when-not-to-use, but the context is clear.

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/sudanese/ploi-mcp'

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