Skip to main content
Glama

portfolio_element_manager

Manage individual portfolio elements like personas and skills between local storage and GitHub repository. Download, upload, list, or compare elements with fuzzy matching support for easy element identification.

Instructions

Manage individual elements between your local portfolio and GitHub repository. USE THIS TO DOWNLOAD/UPLOAD INDIVIDUAL PERSONAS, SKILLS, OR OTHER ELEMENTS! When a user asks to 'download X persona from my GitHub' or 'upload Y skill to GitHub', use this tool. Operations: 'download' (GitHub→local), 'upload' (local→GitHub), 'list-remote' (see what's on GitHub), 'compare' (diff local vs GitHub). FUZZY MATCHING enabled - 'verbose victorian scholar' will find 'Verbose-Victorian-Scholar'. After downloading, use reload_elements then activate_element.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYesThe operation to perform. 'download' = get from GitHub to local, 'upload' = send from local to GitHub, 'list-remote' = see what's on GitHub, 'compare' = see differences
element_nameNoName of the element (required for download, upload, compare). FUZZY MATCHING ENABLED: Just type the name naturally - 'verbose victorian scholar', 'Victorian Scholar', 'verbose-victorian', etc. will all work
element_typeNoType of element (required for download, upload, compare). For personas use 'personas'
filterNoFilters for bulk operations
optionsNoAdditional options. For downloads, use options:{force:true} to skip confirmations

Implementation Reference

  • Main handler function executing the portfolio_element_manager tool logic. Maps tool arguments to sync operation, checks permissions, delegates to PortfolioSyncManager, and formats the MCP-compatible response.
    async handleSyncOperation(options: SyncOperationOptions, indicator: string = '') {
      try {
        await this.configManager.initialize();
        
        // Check if sync is enabled (allow list-remote and compare even when disabled)
        const syncEnabled = this.configManager.getSetting('sync.enabled');
        const readOnlyOperations = ['list-remote', 'compare'];
        if (!syncEnabled && !readOnlyOperations.includes(options.operation)) {
          return {
            content: [{
              type: "text",
              text: `${indicator}⚠️ **Sync is Disabled**\n\n` +
                    `Portfolio sync is currently disabled for privacy.\n\n` +
                    `To enable sync:\n` +
                    `\`dollhouse_config action: "set", setting: "sync.enabled", value: true\`\n\n` +
                    `You can still use \`list-remote\` and \`compare\` to view differences.`
            }]
          };
        }
        
        // Map our operation to PortfolioSyncManager's SyncOperation format
        const syncOp: SyncOperation = {
          operation: this.mapOperation(options.operation),
          element_name: options.element_name,
          element_type: options.element_type || options.filter?.type, // Use filter.type if element_type not provided
          bulk: options.operation.includes('bulk'),
          show_diff: options.operation === 'compare',
          force: options.options?.force,
          confirm: options.options?.force || options.options?.dry_run === false // force implies confirm, dry_run=false means confirm
        };
        
        // Call the unified handleSyncOperation method
        const result = await this.syncManager.handleSyncOperation(syncOp);
        
        // Format the result based on the operation type
        return this.formatResult(result, options, indicator);
        
      } catch (error) {
        const sanitizedError = SecureErrorHandler.sanitizeError(error);
        return {
          content: [{
            type: "text",
            text: `${indicator}❌ Sync operation failed: ${sanitizedError.message}`
          }]
        };
      }
    }
  • Tool registration including name, description, input/output schema, and handler wrapper that forwards to server.handleSyncOperation.
      tool: {
        name: "portfolio_element_manager",
        description: "Manage individual elements between your local portfolio and GitHub repository. USE THIS TO DOWNLOAD/UPLOAD INDIVIDUAL PERSONAS, SKILLS, OR OTHER ELEMENTS! When a user asks to 'download X persona from my GitHub' or 'upload Y skill to GitHub', use this tool. Operations: 'download' (GitHub→local), 'upload' (local→GitHub), 'list-remote' (see what's on GitHub), 'compare' (diff local vs GitHub). FUZZY MATCHING enabled - 'verbose victorian scholar' will find 'Verbose-Victorian-Scholar'. After downloading, use reload_elements then activate_element.",
        inputSchema: {
          type: "object",
          properties: {
            operation: {
              type: "string",
              enum: ["list-remote", "download", "upload", "compare"],
              description: "The operation to perform. 'download' = get from GitHub to local, 'upload' = send from local to GitHub, 'list-remote' = see what's on GitHub, 'compare' = see differences"
            },
            element_name: {
              type: "string",
              description: "Name of the element (required for download, upload, compare). FUZZY MATCHING ENABLED: Just type the name naturally - 'verbose victorian scholar', 'Victorian Scholar', 'verbose-victorian', etc. will all work"
            },
            element_type: {
              type: "string",
              enum: ["personas", "skills", "templates", "agents", "memories", "ensembles"],
              description: "Type of element (required for download, upload, compare). For personas use 'personas'"
            },
            filter: {
              type: "object",
              properties: {
                type: {
                  type: "string",
                  enum: ["personas", "skills", "templates", "agents", "memories", "ensembles"],
                  description: "Filter by element type"
                },
                author: {
                  type: "string",
                  description: "Filter by author username"
                },
                updated_after: {
                  type: "string",
                  description: "Filter by update date (ISO 8601 format)"
                }
              },
              description: "Filters for bulk operations"
            },
            options: {
              type: "object",
              properties: {
                force: {
                  type: "boolean",
                  description: "Force overwrite existing elements. Use force:true when downloading to skip confirmation prompts"
                },
                dry_run: {
                  type: "boolean",
                  description: "Preview changes without applying them"
                },
                include_private: {
                  type: "boolean",
                  description: "Include elements marked as private/local-only"
                }
              },
              description: "Additional options. For downloads, use options:{force:true} to skip confirmations"
            }
          },
          required: ["operation"]
        }
      },
      handler: (args: any) => server.handleSyncOperation(args)
    }
  • Core handler in PortfolioSyncManager that dispatches to specific sync operations (list-remote, download, upload, compare) with permission checks and error handling.
    public async handleSyncOperation(params: SyncOperation): Promise<SyncResult> {
      try {
        // Check if sync is enabled in config
        const config = this.configManager.getConfig();
        if (!config.sync.enabled && params.operation !== 'list-remote') {
          return {
            success: false,
            message: 'Sync is disabled. Enable it with: dollhouse_config --action update --setting sync.enabled --value true'
          };
        }
        
        // Check bulk permissions
        if (params.bulk) {
          const bulkAllowed = this.isBulkOperationAllowed(params.operation, config);
          if (!bulkAllowed.allowed) {
            return {
              success: false,
              message: bulkAllowed.message
            };
          }
        }
        
        // Handle operations
        switch (params.operation) {
          case 'list-remote':
            return await this.listRemoteElements(params.element_type);
            
          case 'download':
            if (params.bulk) {
              return await this.bulkDownload(params.element_type, params.confirm);
            } else if (params.element_name) {
              return await this.downloadElement(
                params.element_name,
                params.element_type!,
                params.version,
                params.force
              );
            } else {
              return {
                success: false,
                message: 'Element name required for individual download'
              };
            }
            
          case 'upload':
            if (params.bulk) {
              return await this.bulkUpload(params.element_type, params.confirm);
            } else if (params.element_name) {
              return await this.uploadElement(
                params.element_name,
                params.element_type!,
                params.confirm
              );
            } else {
              return {
                success: false,
                message: 'Element name required for individual upload'
              };
            }
            
          case 'compare':
            if (params.element_name && params.element_type) {
              return await this.compareVersions(
                params.element_name,
                params.element_type,
                params.show_diff
              );
            } else {
              return {
                success: false,
                message: 'Element name and type required for comparison'
              };
            }
            
          default:
            return {
              success: false,
              message: `Unknown operation: ${params.operation}`
            };
        }
      } catch (error) {
        logger.error('Sync operation failed', {
          operation: params.operation,
          error: error instanceof Error ? error.message : String(error)
        });
        
        return {
          success: false,
          message: `Sync operation failed: ${error instanceof Error ? error.message : String(error)}`
        };
      }
    }
  • Final registration of ConfigToolsV2 (containing portfolio_element_manager) into the main tool registry during server setup.
    // Register new unified config and sync tools
    this.toolRegistry.registerMany(getConfigToolsV2(instance));
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: the four specific operations with their directions (GitHub→local, local→GitHub), fuzzy matching behavior, and post-download workflow requirements. However, it doesn't mention authentication needs, rate limits, or error handling, which would be helpful for a GitHub integration tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose and key usage instructions. Every sentence adds value: the first states the purpose, the second provides usage examples, the third lists operations, the fourth explains fuzzy matching, and the fifth specifies post-download workflow. Minor redundancy with the schema (operation descriptions) keeps it from a perfect score.

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?

Given the tool's moderate complexity (5 parameters, no output schema, no annotations), the description does an excellent job of covering purpose, usage, operations, and key behaviors like fuzzy matching. It mentions follow-up tools but doesn't explain return values or error cases. For a tool with this parameter count and no output schema, slightly more detail on expected outputs would make it complete.

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?

With 100% schema description coverage, the baseline is 3. The description adds significant value by explaining fuzzy matching for 'element_name' ('verbose victorian scholar' will find 'Verbose-Victorian-Scholar'), clarifying when parameters are required ('required for download, upload, compare'), and providing context about the 'options' parameter's 'force' setting for skipping confirmations. This goes well beyond what the schema provides.

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 tool's purpose with specific verbs ('manage individual elements', 'download', 'upload', 'list-remote', 'compare') and resources ('local portfolio', 'GitHub repository'). It explicitly distinguishes this tool from siblings by specifying it's for individual elements (not bulk operations) and provides concrete examples of when to use it versus other tools like 'reload_elements' and 'activate_element'.

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

Usage Guidelines5/5

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

The description provides explicit usage guidelines with clear 'when-to-use' examples ('download X persona from my GitHub', 'upload Y skill to GitHub'), distinguishes it from sibling tools by mentioning follow-up actions ('use reload_elements then activate_element'), and specifies the scope of operations (individual elements only). It also mentions fuzzy matching as a key feature for usage.

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