Skip to main content
Glama

setup

Configure OSS Autopilot preferences for languages, interests, and contribution goals to personalize open source contribution management.

Instructions

Run OSS Autopilot setup to configure preferences like languages, interests, and contribution goals.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resetNoIf true, reset all preferences to defaults before running setup
setNoSet preferences non-interactively as key=value pairs (e.g. ["languages=typescript,rust"])

Implementation Reference

  • The `runSetup` function implements the logic for the 'setup' tool. It manages interactive setup prompts, handles direct settings updates, and returns the current setup status.
    export async function runSetup(options: SetupOptions): Promise<SetupOutput> {
      const stateManager = getStateManager();
      const config = stateManager.getState().config;
    
      // Handle --set mode: apply settings directly
      if (options.set && options.set.length > 0) {
        const results: Record<string, string> = {};
        const warnings: string[] = [];
    
        stateManager.batch(() => {
          for (const setting of options.set!) {
            const [key, ...valueParts] = setting.split('=');
            const value = valueParts.join('=');
    
            switch (key) {
              case 'username':
                validateGitHubUsername(value);
                stateManager.updateConfig({ githubUsername: value });
                results[key] = value;
                break;
              case 'maxActivePRs': {
                const maxPRs = parsePositiveInt(value, 'maxActivePRs');
                stateManager.updateConfig({ maxActivePRs: maxPRs });
                results[key] = String(maxPRs);
                break;
              }
              case 'dormantDays': {
                const dormant = parsePositiveInt(value, 'dormantDays');
                stateManager.updateConfig({ dormantThresholdDays: dormant });
                results[key] = String(dormant);
                break;
              }
              case 'approachingDays': {
                const approaching = parsePositiveInt(value, 'approachingDays');
                stateManager.updateConfig({ approachingDormantDays: approaching });
                results[key] = String(approaching);
                break;
              }
              case 'languages':
                stateManager.updateConfig({ languages: value.split(',').map((l) => l.trim()) });
                results[key] = value;
                break;
              case 'labels':
                stateManager.updateConfig({ labels: value.split(',').map((l) => l.trim()) });
                results[key] = value;
                break;
              case 'showHealthCheck':
                stateManager.updateConfig({ showHealthCheck: value !== 'false' });
                results[key] = value !== 'false' ? 'true' : 'false';
                break;
              case 'squashByDefault':
                if (value === 'ask') {
                  stateManager.updateConfig({ squashByDefault: 'ask' });
                  results[key] = 'ask';
                } else {
                  stateManager.updateConfig({ squashByDefault: value !== 'false' });
                  results[key] = value !== 'false' ? 'true' : 'false';
                }
                break;
              case 'scoreThreshold': {
                const threshold = parseBoundedInt(value, 'scoreThreshold', 1, 10);
                stateManager.updateConfig({ scoreThreshold: threshold });
                results[key] = String(threshold);
                break;
              }
              case 'minStars': {
                const stars = Number(value);
                if (!Number.isInteger(stars) || stars < 0) {
                  throw new ValidationError(`Invalid value for minStars: "${value}". Must be a non-negative integer.`);
                }
                stateManager.updateConfig({ minStars: stars });
                results[key] = String(stars);
                break;
              }
              case 'includeDocIssues':
                stateManager.updateConfig({ includeDocIssues: value === 'true' });
                results[key] = value === 'true' ? 'true' : 'false';
                break;
              case 'aiPolicyBlocklist': {
                const entries = value
                  .split(',')
                  .map((r) => r.trim())
                  .filter(Boolean);
                const valid: string[] = [];
                const invalid: string[] = [];
                for (const entry of entries) {
                  const normalized = entry.replace(/\s+/g, '');
                  if (/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/.test(normalized)) {
                    valid.push(normalized);
                  } else {
                    invalid.push(entry);
                  }
                }
                if (invalid.length > 0) {
                  warnings.push(`Warning: Skipping invalid entries (expected "owner/repo" format): ${invalid.join(', ')}`);
                  results['aiPolicyBlocklist_invalidEntries'] = invalid.join(', ');
                }
                if (valid.length === 0 && entries.length > 0) {
                  warnings.push('Warning: All entries were invalid. Blocklist not updated.');
                  results[key] = '(all entries invalid)';
                  break;
                }
                stateManager.updateConfig({ aiPolicyBlocklist: valid });
                results[key] = valid.length > 0 ? valid.join(', ') : '(empty)';
                break;
              }
              case 'projectCategories': {
                const categories = value
                  .split(',')
                  .map((c) => c.trim())
                  .filter(Boolean);
                const validCategories: ProjectCategory[] = [];
                const invalidCategories: string[] = [];
                for (const cat of categories) {
                  if ((PROJECT_CATEGORIES as readonly string[]).includes(cat)) {
                    validCategories.push(cat as ProjectCategory);
                  } else {
                    invalidCategories.push(cat);
                  }
                }
                if (invalidCategories.length > 0) {
                  warnings.push(
                    `Unknown project categories: ${invalidCategories.join(', ')}. Valid: ${PROJECT_CATEGORIES.join(', ')}`,
                  );
                }
                const dedupedCategories = [...new Set(validCategories)];
                stateManager.updateConfig({ projectCategories: dedupedCategories });
                results[key] = dedupedCategories.length > 0 ? dedupedCategories.join(', ') : '(empty)';
                break;
              }
              case 'preferredOrgs': {
                const orgs = value
                  .split(',')
                  .map((o) => o.trim())
                  .filter(Boolean);
                const validOrgs: string[] = [];
                for (const org of orgs) {
                  if (org.includes('/')) {
                    warnings.push(
                      `"${org}" looks like a repo path. Use org name only (e.g., "vercel" not "vercel/next.js").`,
                    );
                  } else if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(org)) {
                    warnings.push(`"${org}" is not a valid GitHub organization name. Skipping.`);
                  } else {
                    validOrgs.push(org.toLowerCase());
                  }
                }
                const dedupedOrgs = [...new Set(validOrgs)];
                stateManager.updateConfig({ preferredOrgs: dedupedOrgs });
                results[key] = dedupedOrgs.length > 0 ? dedupedOrgs.join(', ') : '(empty)';
                break;
              }
              case 'scope': {
                const scopeValues = value
                  .split(',')
                  .map((s) => s.trim())
                  .filter(Boolean);
                const validScopes: IssueScope[] = [];
                const invalidScopes: string[] = [];
                for (const s of scopeValues) {
                  if ((ISSUE_SCOPES as readonly string[]).includes(s)) {
                    validScopes.push(s as IssueScope);
                  } else {
                    invalidScopes.push(s);
                  }
                }
                if (invalidScopes.length > 0) {
                  warnings.push(`Unknown issue scopes: ${invalidScopes.join(', ')}. Valid: ${ISSUE_SCOPES.join(', ')}`);
                }
                const dedupedScopes = [...new Set(validScopes)];
                stateManager.updateConfig({ scope: dedupedScopes.length > 0 ? dedupedScopes : undefined });
                results[key] = dedupedScopes.length > 0 ? dedupedScopes.join(', ') : '(empty — using labels only)';
                break;
              }
              case 'issueListPath':
                stateManager.updateConfig({ issueListPath: value || undefined });
                results[key] = value || '(cleared)';
                break;
              case 'complete':
                if (value === 'true') {
                  stateManager.markSetupComplete();
                  results[key] = 'true';
                }
                break;
              default:
                warnings.push(`Unknown setting: ${key}`);
            }
          }
        });
    
        return { success: true, settings: results, warnings: warnings.length > 0 ? warnings : undefined };
      }
    
      // Show setup status
      if (config.setupComplete && !options.reset) {
        return {
          setupComplete: true,
          config: {
            githubUsername: config.githubUsername,
            maxActivePRs: config.maxActivePRs,
            dormantThresholdDays: config.dormantThresholdDays,
            approachingDormantDays: config.approachingDormantDays,
            languages: config.languages,
            labels: config.labels,
            projectCategories: config.projectCategories ?? [],
            preferredOrgs: config.preferredOrgs ?? [],
            scope: config.scope ?? [],
            scoreThreshold: config.scoreThreshold,
          },
        };
      }
    
      // Output setup prompts
      return {
        setupRequired: true,
        prompts: [
          {
            setting: 'username',
            prompt: 'What is your GitHub username?',
            current: config.githubUsername || null,
            required: true,
            type: 'string',
          },
          {
            setting: 'maxActivePRs',
            prompt: 'How many PRs do you want to work on at once?',
            current: config.maxActivePRs,
            default: 10,
            type: 'number',
          },
          {
            setting: 'dormantDays',
            prompt: 'After how many days of inactivity should a PR be considered dormant?',
            current: config.dormantThresholdDays,
            default: 30,
            type: 'number',
          },
          {
            setting: 'approachingDays',
            prompt: 'At how many days should we warn about approaching dormancy?',
            current: config.approachingDormantDays,
            default: 25,
            type: 'number',
          },
          {
            setting: 'languages',
            prompt: 'What programming languages do you want to contribute to?',
            current: config.languages,
            default: ['typescript', 'javascript'],
            type: 'list',
          },
          {
            setting: 'labels',
            prompt: 'What issue labels should we search for?',
            current: config.labels,
            default: ['good first issue', 'help wanted'],
            type: 'list',
          },
          {
            setting: 'scope',
            prompt:
              'What scope of issues do you want to discover? (beginner, intermediate, advanced — leave empty for default labels only)',
            current: config.scope ?? [],
            default: [],
            type: 'list',
          },
          {
            setting: 'scoreThreshold',
            prompt: 'Minimum vet score (1-10) for issues to keep after vetting? Issues below this are auto-filtered.',
            current: config.scoreThreshold,
            default: 6,
            type: 'number',
          },
          {
            setting: 'aiPolicyBlocklist',
            prompt: 'Repos with anti-AI contribution policies to block (owner/repo, comma-separated)?',
            current: config.aiPolicyBlocklist ?? DEFAULT_CONFIG.aiPolicyBlocklist ?? null,
            default: ['matplotlib/matplotlib'],
            type: 'list',
          },
          {
            setting: 'projectCategories',
            prompt:
              'What types of projects interest you? (nonprofit, devtools, infrastructure, web-frameworks, data-ml, education)',
            current: config.projectCategories ?? [],
            default: [],
            type: 'list',
          },
          {
            setting: 'preferredOrgs',
            prompt: 'Any GitHub organizations to prioritize? (org names, comma-separated)',
            current: config.preferredOrgs ?? [],
            default: [],
            type: 'list',
          },
        ],
      };
    }
  • The 'setup' tool is registered in the MCP server using `server.registerTool`, which wraps the `runSetup` command.
    // 13. setup — Interactive setup
    server.registerTool(
      'setup',
      {
        description:
          'Run OSS Autopilot setup to configure preferences like languages, interests, and contribution goals.',
        inputSchema: {
          reset: z.boolean().optional().describe('If true, reset all preferences to defaults before running setup'),
          set: z
            .array(z.string())
            .optional()
            .describe('Set preferences non-interactively as key=value pairs (e.g. ["languages=typescript,rust"])'),
        },
        annotations: { readOnlyHint: false, destructiveHint: false },
      },
      wrapTool(runSetup),
    );
  • Input schema definition for the 'setup' tool, defining expected inputs like `reset` (boolean) and `set` (array of strings).
    inputSchema: {
      reset: z.boolean().optional().describe('If true, reset all preferences to defaults before running setup'),
      set: z
        .array(z.string())
        .optional()
        .describe('Set preferences non-interactively as key=value pairs (e.g. ["languages=typescript,rust"])'),
    },
Behavior3/5

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

Annotations indicate read/write (not read-only) and non-destructive, which aligns with 'configure'. Description adds value by specifying what gets configured (preference categories), but does not disclose idempotency, side effects (file creation), or interactive vs non-interactive modes (the latter is only in schema).

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?

Single sentence positioned efficiently with action verb first, zero redundancy, and appropriate density of 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?

Appropriate for a 2-parameter configuration tool with full schema coverage. Describes the domain (preference types) sufficiently for selection and invocation, though output behavior remains undocumented.

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?

Despite 100% schema coverage (baseline 3), the description enriches the 'set' parameter by enumerating semantic categories of preferences (languages, interests, contribution goals), helping the agent understand what key=value pairs might look like.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb 'Run' and resource 'OSS Autopilot setup' with specific scope 'configure preferences like languages, interests, and contribution goals'. However, it does not explicitly differentiate from sibling tool 'check-setup' (which verifies state vs configuring it).

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?

Provides no guidance on when to invoke this tool versus alternatives, prerequisites (e.g., whether to run before other operations), or when to use the sibling 'check-setup' instead.

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/costajohnt/oss-autopilot'

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