Skip to main content
Glama
ThinkFar

Clear Thought Server

designpattern

Apply design patterns to solve software architecture challenges, including modular architecture, API integration, state management, and security best practices.

Instructions

A tool for applying design patterns to software architecture and implementation. Supports various design patterns including:

  • Modular Architecture

  • API Integration Patterns

  • State Management

  • Asynchronous Processing

  • Scalability Considerations

  • Security Best Practices

  • Agentic Design Patterns

Each pattern provides a structured approach to solving common design challenges.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternNameYes
contextYes
implementationNo
benefitsNo
tradeoffsNo
codeExampleNo
languagesNo

Implementation Reference

  • The core handler function for the 'designpattern' tool. Validates input using DesignPatternData schema, formats a colored console output, logs it, and returns a structured JSON response with pattern details or error.
    public processPattern(input: unknown): { content: Array<{ type: string; text: string }>; isError?: boolean } {
      try {
        const validatedInput = this.validatePatternData(input);
        const formattedOutput = this.formatPatternOutput(validatedInput);
        console.error(formattedOutput);
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              patternName: validatedInput.patternName,
              status: 'success',
              hasImplementation: validatedInput.implementation.length > 0,
              hasCodeExample: !!validatedInput.codeExample
            }, null, 2)
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              error: error instanceof Error ? error.message : String(error),
              status: 'failed'
            }, null, 2)
          }],
          isError: true
        };
      }
    }
  • Tool definition including name, description, and inputSchema which serves as the schema for validation of 'designpattern' tool calls.
    const DESIGN_PATTERN_TOOL: Tool = {
        name: "designpattern",
        description: `A tool for applying design patterns to software architecture and implementation.
    Supports various design patterns including:
    - Modular Architecture
    - API Integration Patterns
    - State Management
    - Asynchronous Processing
    - Scalability Considerations
    - Security Best Practices
    - Agentic Design Patterns
    
    Each pattern provides a structured approach to solving common design challenges.`,
        inputSchema: {
            type: "object",
            properties: {
                patternName: {
                    type: "string",
                    enum: [
                        "modular_architecture",
                        "api_integration",
                        "state_management",
                        "async_processing",
                        "scalability",
                        "security",
                        "agentic_design",
                    ],
                },
                context: { type: "string" },
                implementation: {
                    type: "array",
                    items: { type: "string" },
                },
                benefits: {
                    type: "array",
                    items: { type: "string" },
                },
                tradeoffs: {
                    type: "array",
                    items: { type: "string" },
                },
                codeExample: { type: "string" },
                languages: {
                    type: "array",
                    items: { type: "string" },
                },
            },
            required: ["patternName", "context"],
        },
    };
  • src/index.ts:1057-1069 (registration)
    Registration of the tool handler in the main CallToolRequestHandler switch statement, dispatching calls to designPatternServer.processPattern.
    case "designpattern": {
        const result = designPatternServer.processPattern(
            request.params.arguments
        );
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(result, null, 2),
                },
            ],
        };
    }
  • src/index.ts:1000-1000 (registration)
    Registers the DESIGN_PATTERN_TOOL schema in the MCP server capabilities.tools object.
    designpattern: DESIGN_PATTERN_TOOL,
  • Helper function that validates and casts input to DesignPatternData interface, enforcing the tool schema.
    private validatePatternData(input: unknown): DesignPatternData {
      const data = input as Record<string, unknown>;
    
      if (!data.patternName || typeof data.patternName !== 'string') {
        throw new Error('Invalid patternName: must be a string');
      }
      if (!data.context || typeof data.context !== 'string') {
        throw new Error('Invalid context: must be a string');
      }
    
      return {
        patternName: data.patternName as string,
        context: data.context as string,
        implementation: Array.isArray(data.implementation) ? data.implementation.map(String) : [],
        benefits: Array.isArray(data.benefits) ? data.benefits.map(String) : [],
        tradeoffs: Array.isArray(data.tradeoffs) ? data.tradeoffs.map(String) : [],
        codeExample: typeof data.codeExample === 'string' ? data.codeExample as string : undefined,
        languages: Array.isArray(data.languages) ? data.languages.map(String) : undefined
      };
    }
Behavior2/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 mentions 'applying design patterns' and lists pattern types but doesn't describe what the tool actually does (e.g., generates output, modifies code, provides advice), its limitations, or any behavioral traits like side effects or performance. This leaves significant gaps in understanding the tool's operation.

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 with two paragraphs: the first states the purpose and lists patterns, and the second explains the value. It's front-loaded with key information, and while the bulleted list is detailed, it serves to clarify scope without unnecessary verbosity.

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?

Given the complexity (7 parameters, no annotations, no output schema), the description is incomplete. It lacks details on what the tool outputs, how it behaves, and full parameter explanations. For a tool with this many inputs and no structured support, more comprehensive guidance is needed to ensure effective use by an agent.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for 7 undocumented parameters. It lists pattern categories that correspond to the 'patternName' enum values, adding some meaning, but doesn't explain other parameters like 'context', 'implementation', 'benefits', 'tradeoffs', 'codeExample', or 'languages'. This partial coverage is insufficient given the low schema coverage.

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

Purpose3/5

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

The description states the tool is for 'applying design patterns to software architecture and implementation' and lists specific pattern categories, which provides a general purpose. However, it doesn't specify what 'applying' means operationally (e.g., generates documentation, suggests implementations, analyzes code) or how it differs from sibling tools like 'programmingparadigm' or 'structuredargumentation', making it somewhat vague.

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?

No explicit guidance on when to use this tool versus alternatives is provided. The description mentions 'solving common design challenges' but doesn't specify contexts, prerequisites, or exclusions. Given sibling tools like 'debuggingapproach' and 'decisionframework', there's no differentiation, leaving the agent with minimal usage direction.

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/ThinkFar/clear-thought-mcp'

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