Skip to main content
Glama
product.ts4.61 kB
import { z } from "zod"; /** * Product Tools - Requirements gathering, user analysis, and product definition */ // ============================================ // Define User Stories // ============================================ export const defineUserStoriesSchema = { name: "define_user_stories", description: "Generates user stories with acceptance criteria (Gherkin format)", inputSchema: z.object({ feature: z.string().describe("Feature description"), role: z.string().optional().default("user").describe("User role"), format: z .enum(["simple", "gherkin", "detailed"]) .optional() .default("simple"), }), }; export function defineUserStoriesHandler(args: { feature: string; role: string; format: string; }) { const { feature, role, format } = args; const story = `As a ${role}, I want to ${feature}, so that [value/benefit].`; let content = ""; if (format === "gherkin") { content = `Feature: ${feature}\n\n Scenario: Successful usage\n Given I am a logged in ${role}\n When I ${feature}\n Then I should see [result]`; } else if (format === "detailed") { content = `### User Story\n${story}\n\n### Acceptance Criteria\n- [ ] Verify happy path\n- [ ] Verify error states\n- [ ] Check performance`; } else { content = story; } return { content: [ { type: "text", text: `# User Story: ${feature}\n\n${content}`, }, ], }; } // ============================================ // Create Personas // ============================================ export const createPersonasSchema = { name: "create_personas", description: "Generates detailed user personas for the project", inputSchema: z.object({ appType: z .string() .describe("Type of application (e.g. 'Fitness App', 'Dev Tool')"), targetAudience: z.array(z.string()).describe("Target audience segments"), }), }; export function createPersonasHandler(args: { appType: string; targetAudience: string[]; }) { const { appType, targetAudience } = args; const demographics = [ { age: "20-30", tech: "High", income: "Entry-Medium" }, { age: "30-45", tech: "Medium-High", income: "Medium-High" }, { age: "45+", tech: "Low-Medium", income: "High" }, ]; return { content: [ { type: "text", text: `# User Personas for ${appType} ${targetAudience .map((audience, i) => { const demo = demographics[i % demographics.length]; return `## Persona ${i + 1}: ${audience} User - **Demographics**: Age ${demo.age}, Income ${demo.income} - **Tech Savviness**: ${demo.tech} - **Goals**: - Achieve efficiency in using ${appType} - Reduce manual work - **Frustrations**: - Complex interfaces - Slow performance - **Scenario**: Needs to use ${appType} to solve a critical business problem quickly.`; }) .join("\n\n")}`, }, ], }; } // ============================================ // Market Analysis (SWOT) // ============================================ export const marketAnalysisSchema = { name: "perform_market_analysis", description: "Generates a SWOT analysis template for a product idea", inputSchema: z.object({ idea: z.string().describe("Product idea or feature"), competitors: z.array(z.string()).optional(), }), }; export function marketAnalysisHandler(args: { idea: string; competitors?: string[]; }) { const comps = args.competitors ? args.competitors.join(", ") : "None specified"; return { content: [ { type: "text", text: `# Market Analysis (SWOT): ${args.idea} **Competitors**: ${comps} | | Positive | Negative | |---|---|---| | **Internal** | **Strengths** (S)<br>- Unique tech<br>- Team expertise | **Weaknesses** (W)<br>- Limited budget<br>- Brand awareness | | **External** | **Opportunities** (O)<br>- Growing market<br>- Competitor gaps | **Threats** (T)<br>- Regulatory changes<br>- ${comps.length > 0 ? "Aggressive competitors (" + comps + ")" : "New entrants"} | ## Strategic Cross-Reference ### S-O Strategies (Growth) - Leverage unique tech to capture growing market. ### W-O Strategies (Improvement) - Use market growth to attract budget/investment. ### S-T Strategies (Defense) - Use team expertise to navigate regulations. ### W-T Strategies (Survival) - Focus on niche to avoid direct competitor threats. `, }, ], }; } // Export all export const productTools = { defineUserStoriesSchema, defineUserStoriesHandler, createPersonasSchema, createPersonasHandler, marketAnalysisSchema, marketAnalysisHandler, };

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/millsydotdev/Code-MCP'

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