Skip to main content
Glama
njlnaet
by njlnaet

List CoderSwap Projects

coderswap_list_projects

Retrieve all available CoderSwap projects accessible with your API key to manage and work with existing knowledge bases.

Instructions

List all CoderSwap projects available to your API key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
countYes
projectsYes

Implementation Reference

  • Executes the tool logic: fetches projects via client.listProjects(), formats output and response with structured content.
    async () => {
      try {
        log('debug', 'Listing projects')
        const projects = await client.listProjects()
    
        const output = {
          count: projects.length,
          projects: projects.map(p => ({
            project_id: p.project_id,
            name: p.name,
            doc_count: p.doc_count,
            search_mode: (p as any).search_mode
          }))
        }
    
        if (projects.length === 0) {
          return {
            content: [{
              type: 'text',
              text: 'No projects found'
            }],
            structuredContent: output
          }
        }
    
        const projectList = projects
          .map(p => {
            const lines = [
              `• ${p.name || 'Untitled Project'}`,
              `  ID: ${p.project_id}`,
              `  Docs: ${p.doc_count ?? 0}`
            ]
            if ((p as any).search_mode) {
              lines.push(`  Search Mode: ${(p as any).search_mode}`)
            }
            return lines.join('\n')
          })
          .join('\n\n')
    
        log('info', `Found ${projects.length} projects`)
    
        return {
          content: [{
            type: 'text',
            text: `Found ${projects.length} project(s):\n\n${projectList}`
          }],
          structuredContent: output
        }
      } catch (error) {
        log('error', 'Failed to list projects', { error: error instanceof Error ? error.message : error })
        return {
          content: [{
            type: 'text',
            text: `✗ Failed to list projects: ${error instanceof Error ? error.message : 'Unknown error'}`
          }],
          isError: true
        }
      }
    }
  • Zod schemas for input (empty) and output of the tool.
    {
      title: 'List CoderSwap Projects',
      description: 'List all CoderSwap projects available to your API key',
      inputSchema: {},
      outputSchema: {
        count: z.number(),
        projects: z.array(z.object({
          project_id: z.string(),
          name: z.string().optional(),
          doc_count: z.number().optional()
        }))
      }
    },
  • src/index.ts:238-312 (registration)
    Registers the 'coderswap_list_projects' tool on the MCP server with schema and handler function.
    server.registerTool(
      'coderswap_list_projects',
      {
        title: 'List CoderSwap Projects',
        description: 'List all CoderSwap projects available to your API key',
        inputSchema: {},
        outputSchema: {
          count: z.number(),
          projects: z.array(z.object({
            project_id: z.string(),
            name: z.string().optional(),
            doc_count: z.number().optional()
          }))
        }
      },
      async () => {
        try {
          log('debug', 'Listing projects')
          const projects = await client.listProjects()
    
          const output = {
            count: projects.length,
            projects: projects.map(p => ({
              project_id: p.project_id,
              name: p.name,
              doc_count: p.doc_count,
              search_mode: (p as any).search_mode
            }))
          }
    
          if (projects.length === 0) {
            return {
              content: [{
                type: 'text',
                text: 'No projects found'
              }],
              structuredContent: output
            }
          }
    
          const projectList = projects
            .map(p => {
              const lines = [
                `• ${p.name || 'Untitled Project'}`,
                `  ID: ${p.project_id}`,
                `  Docs: ${p.doc_count ?? 0}`
              ]
              if ((p as any).search_mode) {
                lines.push(`  Search Mode: ${(p as any).search_mode}`)
              }
              return lines.join('\n')
            })
            .join('\n\n')
    
          log('info', `Found ${projects.length} projects`)
    
          return {
            content: [{
              type: 'text',
              text: `Found ${projects.length} project(s):\n\n${projectList}`
            }],
            structuredContent: output
          }
        } catch (error) {
          log('error', 'Failed to list projects', { error: error instanceof Error ? error.message : error })
          return {
            content: [{
              type: 'text',
              text: `✗ Failed to list projects: ${error instanceof Error ? error.message : 'Unknown error'}`
            }],
            isError: true
          }
        }
      }
    )
  • API client method that fetches the list of projects from the CoderSwap backend.
    async listProjects(): Promise<ProjectSummary[]> {
      const res = await fetch(`${this.baseUrl}/v1/projects`, {
        headers: this.headers
      })
      const data = await this.handleResponse<{ projects: ProjectSummary } | { projects: ProjectSummary[] }>(res)
      return Array.isArray((data as any).projects) ? (data as any).projects : []
    }
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 lists projects 'available to your API key,' hinting at authentication and scope, but lacks details on pagination, rate limits, error handling, or output format. For a list operation with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/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 ('List all CoderSwap projects') and includes essential context ('available to your API key'). Every part of the sentence earns its place, making it highly concise and well-structured.

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 simplicity (0 parameters, output schema exists), the description is minimally adequate. It covers the basic purpose but lacks behavioral details (e.g., pagination, error handling) that aren't provided by annotations. The output schema should handle return values, so the description doesn't need to explain those. However, for a list tool with no annotations, more context on behavior would improve completeness.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter information, which is appropriate here. A baseline of 4 is applied for tools with zero parameters, as there's nothing to compensate for, and the description doesn't introduce confusion.

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 ('List') and resource ('CoderSwap projects'), making the purpose unambiguous. However, it doesn't differentiate from sibling tools like 'coderswap_search' or 'coderswap_get_project_stats', which might also retrieve project information in different ways. The description is specific about scope ('all...available to your API key') but lacks sibling distinction.

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 sibling tools like 'coderswap_search' (which might filter projects) or 'coderswap_get_project_stats' (which might provide detailed metrics), leaving the agent without context for tool selection. The only implied usage is for listing all accessible projects, but no exclusions or alternatives are specified.

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