Skip to main content
Glama
njlnaet
by njlnaet

Get CoderSwap Project Stats

coderswap_get_project_stats

Retrieve statistics and detailed information about a specific project to track progress and analyze project data.

Instructions

Get statistics and information about a specific project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo
doc_countNo
created_atNo
project_idYes

Implementation Reference

  • The handler function that executes the 'coderswap_get_project_stats' tool logic. It fetches stats using the CoderSwapClient, formats a textual summary and structured output.
    async ({ project_id }) => {
      try {
        log('debug', 'Getting project stats', { project_id })
        const stats = await client.getProjectStats(project_id)
    
        const output = {
          project_id: stats.project_id,
          name: stats.name,
          doc_count: stats.doc_count,
          created_at: stats.created_at
        }
    
        log('info', `Retrieved stats for project: ${project_id}`)
    
        return {
          content: [{
            type: 'text',
            text: `Project: ${stats.name || project_id}\nDocuments: ${stats.doc_count || 0}\nCreated: ${stats.created_at || 'Unknown'}`
          }],
          structuredContent: output
        }
      } catch (error) {
        log('error', 'Failed to get project stats', { project_id, error: error instanceof Error ? error.message : error })
        return {
          content: [{
            type: 'text',
            text: `✗ Failed to get project stats: ${error instanceof Error ? error.message : 'Unknown error'}`
          }],
          isError: true
        }
      }
    }
  • Input and output schema definitions (Zod) for the 'coderswap_get_project_stats' tool, defining validation for project_id input and expected stats output.
    {
      title: 'Get CoderSwap Project Stats',
      description: 'Get statistics and information about a specific project',
      inputSchema: {
        project_id: z.string().min(1, 'project_id is required')
      },
      outputSchema: {
        project_id: z.string(),
        name: z.string().optional(),
        doc_count: z.number().optional(),
        created_at: z.string().optional()
      }
    },
  • src/index.ts:316-362 (registration)
    The server.registerTool call that registers the 'coderswap_get_project_stats' tool with the MCP server, including schema and handler.
      'coderswap_get_project_stats',
      {
        title: 'Get CoderSwap Project Stats',
        description: 'Get statistics and information about a specific project',
        inputSchema: {
          project_id: z.string().min(1, 'project_id is required')
        },
        outputSchema: {
          project_id: z.string(),
          name: z.string().optional(),
          doc_count: z.number().optional(),
          created_at: z.string().optional()
        }
      },
      async ({ project_id }) => {
        try {
          log('debug', 'Getting project stats', { project_id })
          const stats = await client.getProjectStats(project_id)
    
          const output = {
            project_id: stats.project_id,
            name: stats.name,
            doc_count: stats.doc_count,
            created_at: stats.created_at
          }
    
          log('info', `Retrieved stats for project: ${project_id}`)
    
          return {
            content: [{
              type: 'text',
              text: `Project: ${stats.name || project_id}\nDocuments: ${stats.doc_count || 0}\nCreated: ${stats.created_at || 'Unknown'}`
            }],
            structuredContent: output
          }
        } catch (error) {
          log('error', 'Failed to get project stats', { project_id, error: error instanceof Error ? error.message : error })
          return {
            content: [{
              type: 'text',
              text: `✗ Failed to get project stats: ${error instanceof Error ? error.message : 'Unknown error'}`
            }],
            isError: true
          }
        }
      }
    )
  • Supporting method in CoderSwapClient that implements the core logic for retrieving project stats by filtering from the list of projects.
    async getProjectStats(projectId: string) {
      const projects = await this.listProjects()
      const project = projects.find((item) => item.project_id === projectId)
      if (!project) {
        throw new Error(`Project ${projectId} not found`)
      }
      return project
    }
  • Zod schema for project stats input (project_id), defined in types file (though inline schema used in tool).
    export const projectStatsSchema = z.object({
      project_id: z.string().min(1)
    })
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves statistics and information, implying a read-only operation, but doesn't clarify aspects like authentication requirements, rate limits, error handling, or what happens if the project doesn't exist. This leaves significant gaps for safe and effective use.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action, though it could be slightly more structured (e.g., by listing key statistics) to enhance clarity without sacrificing brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no nested objects) and the presence of an output schema (which handles return values), the description is minimally adequate. However, with no annotations and incomplete parameter guidance, it lacks details on behavioral traits and usage context, leaving room for improvement in supporting the agent.

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

Parameters3/5

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

The input schema has 1 parameter with 0% description coverage, so the description must compensate. It implies the parameter is for identifying a project but doesn't specify format (e.g., numeric ID, string), constraints, or examples. This adds minimal meaning beyond the schema's basic type and requirement, meeting the baseline for low coverage without fully addressing gaps.

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?

The description clearly states the verb ('Get') and resource ('statistics and information about a specific project'), making the purpose understandable. It distinguishes from siblings like 'coderswap_list_projects' by focusing on a single project rather than listing multiple. However, it doesn't specify what types of statistics or information are included, keeping it from being fully specific.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a valid project ID), exclusions, or comparisons to siblings like 'coderswap_get_job_status' or 'coderswap_search'. The agent must infer usage from the tool name and context alone.

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/njlnaet/mcp-server'

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