Skip to main content
Glama

init_portfolio

Initialize a GitHub repository for organizing and storing DollhouseMCP AI persona elements with proper directory structure and documentation.

Instructions

Initialize a new GitHub portfolio repository for storing your DollhouseMCP elements. Creates the repository structure with proper directories and README.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repository_nameNoName for the portfolio repository. Defaults to 'dollhouse-portfolio' if not specified.
privateNoWhether to create a private repository. Defaults to false (public).
descriptionNoRepository description. Defaults to 'My DollhouseMCP element portfolio'.

Implementation Reference

  • MCP tool registration for 'init_portfolio' including name, description, input schema, and handler function that maps args to server.initPortfolio call.
      tool: {
        name: "init_portfolio",
        description: "Initialize a new GitHub portfolio repository for storing your DollhouseMCP elements. Creates the repository structure with proper directories and README.",
        inputSchema: {
          type: "object",
          properties: {
            repository_name: {
              type: "string",
              description: "Name for the portfolio repository. Defaults to 'dollhouse-portfolio' if not specified.",
            },
            private: {
              type: "boolean",
              description: "Whether to create a private repository. Defaults to false (public).",
            },
            description: {
              type: "string",
              description: "Repository description. Defaults to 'My DollhouseMCP element portfolio'.",
            },
          },
        },
      },
      handler: (args: InitPortfolioArgs) => server.initPortfolio({
        repositoryName: args?.repository_name,
        private: args?.private,
        description: args?.description
      })
    },
  • TypeScript interface defining input arguments for the init_portfolio tool.
    interface InitPortfolioArgs {
      repository_name?: string;
      private?: boolean;
      description?: string;
    }
  • Core implementation logic for creating the GitHub portfolio repository, called by server.initPortfolio. Handles consent, repo creation via GitHub API, and structure initialization.
    async createPortfolio(username: string, consent: boolean | undefined): Promise<string> {
      // MEDIUM FIX: Normalize username to prevent Unicode attacks (DMCP-SEC-004)
      const normalizedUsername = UnicodeValidator.normalize(username).normalizedContent;
      
      // CRITICAL: Validate consent is explicitly provided
      if (consent === undefined) {
        throw new Error('Consent is required for portfolio creation');
      }
    
      if (!consent) {
        logger.info(`User declined portfolio creation for ${username}`);
        throw new Error('User declined portfolio creation');
      }
    
      // Log consent for audit trail
      logger.info(`User consented to portfolio creation for ${normalizedUsername}`);
      
      // LOW FIX: Add security audit logging (DMCP-SEC-006)
      SecurityMonitor.logSecurityEvent({
        type: 'PORTFOLIO_INITIALIZATION',
        severity: 'LOW',
        source: 'PortfolioRepoManager.createPortfolio',
        details: `User ${normalizedUsername} consented to portfolio creation`,
        metadata: { username: normalizedUsername }
      });
    
      // Check if portfolio already exists
      const existingRepo = await this.githubRequest(
        `/repos/${normalizedUsername}/${this.repositoryName}`
      );
      
      if (existingRepo && existingRepo.html_url) {
        logger.info(`Portfolio already exists for ${normalizedUsername}`);
        return existingRepo.html_url;
      }
    
      // Create the portfolio repository
      try {
        const repo = await this.githubRequest(
          '/user/repos',
          'POST',
          {
            name: this.repositoryName,
            description: PortfolioRepoManager.DEFAULT_DESCRIPTION,
            private: false,
            auto_init: true
          }
        );
    
        // Initialize portfolio structure
        await this.generatePortfolioStructure(normalizedUsername);
    
        return repo.html_url;
      } catch (error: any) {
        // Handle race condition: if repository was created between our check and creation attempt
        if (error.message && error.message.includes('name already exists')) {
          logger.info(`Portfolio repository already exists for ${normalizedUsername} (race condition handled)`);
          
          // Re-check for the existing repository and return its URL
          try {
            const existingRepo = await this.githubRequest(
              `/repos/${normalizedUsername}/${this.repositoryName}`
            );
            if (existingRepo && existingRepo.html_url) {
              return existingRepo.html_url;
            }
          } catch (recheckError) {
            ErrorHandler.logError('PortfolioRepoManager.recheckExistingRepo', recheckError, { username: normalizedUsername });
          }
          
          // If we can't get the existing repo, throw a more specific error
          throw new Error(`Portfolio repository already exists for ${normalizedUsername}. Please check your GitHub account.`);
        }
        
        ErrorHandler.logError('PortfolioRepoManager.createPortfolioRepo', error, { username: normalizedUsername });
        throw ErrorHandler.wrapError(error, `Failed to create portfolio repository for ${normalizedUsername}. ${error.message || 'Unknown error occurred.'}`, ErrorCategory.NETWORK_ERROR);
      }
    }
  • Registration of all portfolio tools (including init_portfolio) into the ToolRegistry during server setup.
    // Portfolio tools (including sync_portfolio with new safety features)
    this.toolRegistry.registerMany(getPortfolioTools(instance));
  • IToolHandler interface defining the server.initPortfolio method signature used by the tool handler.
    initPortfolio(options: {repositoryName?: string; private?: boolean; description?: string}): Promise<any>;
    portfolioConfig(options: {autoSync?: boolean; defaultVisibility?: string; autoSubmit?: boolean; repositoryName?: string}): Promise<any>;
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states 'Creates the repository structure' which implies a write operation, but doesn't disclose behavioral traits like whether this requires GitHub authentication, what happens if the repository already exists, or if it modifies existing files. For a creation tool with zero annotation coverage, this is insufficient.

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 with zero waste: the first states the core purpose, the second adds implementation detail about structure creation. It's front-loaded with the main action and appropriately sized for the tool's complexity.

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?

For a creation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., repository URL, success status), error conditions, or dependencies like GitHub authentication. Given the complexity of creating a GitHub repository, more context is needed.

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 description coverage is 100%, so the schema already documents all three parameters with their types and defaults. The description adds no additional meaning about parameters beyond implying they configure the repository creation. Baseline 3 is appropriate when the schema does the heavy lifting.

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 specific action ('Initialize'), resource ('GitHub portfolio repository'), and purpose ('for storing your DollhouseMCP elements'). It distinguishes from siblings like 'portfolio_status' or 'portfolio_config' by focusing on creation rather than management or configuration.

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?

The description provides no guidance on when to use this tool versus alternatives like 'portfolio_config' or 'setup_github_auth'. It mentions creating a repository structure but doesn't specify prerequisites (e.g., GitHub authentication) or when this should be called relative to other portfolio tools.

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/DollhouseMCP/DollhouseMCP'

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