Skip to main content
Glama

get_writing_stats

Analyze writing projects to track progress, check quality, and maintain consistency across chapters, dates, or tags in markdown manuscripts.

Instructions

Overall project statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathNoPath to manuscript directory (defaults to current directory)
scopeNoFile scope pattern
breakdown_byNoBreakdown method

Implementation Reference

  • MCP tool handler function for 'get_writing_stats' that extracts scope from input args and delegates to WritersAid.getStats method.
    private async getWritingStats(args: Record<string, unknown>) { const scope = args.scope as string | undefined; return this.writersAid.getStats({ scope }); }
  • Core helper method in WritersAid that computes project writing statistics by querying storage for all files and aggregating word counts, file counts, averages, and per-file details.
    async getStats(_options?: { scope?: string }) { const files = await this.storage.getAllFiles(); const totalWords = files.reduce((sum, f) => sum + (f.word_count || 0), 0); const totalFiles = files.length; return { totalWords, totalFiles, averageWordsPerFile: totalFiles > 0 ? Math.round(totalWords / totalFiles) : 0, files: files.map((f) => ({ path: f.file_path, words: f.word_count || 0, lastModified: f.last_modified, })), }; }
  • JSON schema definition for the get_writing_stats tool, including input properties and descriptions.
    { name: "get_writing_stats", description: "Overall project statistics", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to manuscript directory (defaults to current directory)" }, scope: { type: "string", description: "File scope pattern" }, breakdown_by: { type: "string", enum: ["chapter", "date", "tag"], description: "Breakdown method", }, }, }, },
  • src/index.ts:73-75 (registration)
    MCP server registration for listing available tools, which includes the get_writing_stats tool schema from writerToolDefinitions.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: writerToolDefinitions, }));
  • src/index.ts:86-91 (registration)
    MCP server tool call handler registration that instantiates WritersAid and WriterToolHandlers, then dispatches to the specific tool handler via handleTool.
    const writersAid = new WritersAid({ projectPath }); const handlers = new WriterToolHandlers(writersAid); // Call the tool const result = await handlers.handleTool(name, args || {});

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/xiaolai/claude-writers-aid-mcp'

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