get_guidelines
Retrieve coding guidelines, security rules, and validation patterns from a configured source to maintain code quality standards in WordPress projects.
Instructions
Get development guidelines from the configured source
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Optional category of guidelines to retrieve (e.g., security-rules, validation-rules) |
Implementation Reference
- src/guidelines-manager.ts:123-138 (handler)The private async method getGuidelines() that implements the core logic for the 'get_guidelines' tool. It accepts an optional category parameter, delegates to guidelineSource.fetchGuidelines(), and returns a formatted response with the content.
private async getGuidelines(category?: string) { try { const content = await this.guidelineSource.fetchGuidelines(category); return { content: [ { type: 'text', text: content, }, ], }; } catch (error) { throw new Error(`Failed to fetch guidelines: ${error instanceof Error ? error.message : 'Unknown error'}`); } } - src/guidelines-manager.ts:8-20 (schema)The tool registration definition within getTools() that defines the 'get_guidelines' tool name, description, and inputSchema with an optional 'category' string parameter.
{ name: 'get_guidelines', description: 'Get development guidelines from the configured source', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Optional category of guidelines to retrieve (e.g., security-rules, validation-rules)', }, }, }, }, - src/guidelines-manager.ts:83-84 (registration)The case branch in handleTool() that routes the 'get_guidelines' tool name to the getGuidelines() method.
case 'get_guidelines': return await this.getGuidelines(args.category); - src/index.ts:48-52 (registration)The server-side registration binding via ListToolsRequestSchema handler that calls guidelinesManager.getTools() to expose the tool list (including 'get_guidelines') to the MCP client.
server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: guidelinesManager.getTools(), }; }); - The fetchGuidelines() method in UrlGuidelineSource that actually retrieves the guidelines content (markdown) from a URL source, constructing the URL from the base URL and optional category.
async fetchGuidelines(category?: string): Promise<string> { try { const url = category ? `${this.baseUrl}/${category}.md` : `${this.baseUrl}/guidelines.md`; // Use native fetch or http module for Node.js const response = await this.httpGet(url); return response; } catch (error) { throw new Error(`Failed to fetch guidelines from ${this.baseUrl}: ${error}`); } }