Skip to main content
Glama

list-projects

Retrieve a list of all qTest projects, or fetch a single project by providing its ID.

Instructions

Projects — list all qTest projects, or fetch a single project by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoProject ID; omit to list all projects

Implementation Reference

  • The core handler that executes the list-projects tool logic. If projectId is provided, fetches a single project by ID; otherwise fetches all projects.
    export async function listProjects(args: ListProjectsArgs): Promise<QTestProject | QTestProject[]> {
      const { projectId } = args
    
      if (projectId !== undefined) {
        const raw = await qtestFetchGlobal(config, `/projects/${projectId}`, 'GET')
        return raw as QTestProject
      }
    
      const raw = await qtestFetchGlobal(config, '/projects', 'GET')
      return extractArray<QTestProject>(raw)
    }
  • Input argument interface for listProjects, accepting an optional projectId number.
    export interface ListProjectsArgs {
      projectId?: number
    }
  • src/server.ts:120-133 (registration)
    Tool registration on the MCP server: registers 'list-projects' with description and Zod schema, linking to the handler via the imported listProjects function.
    server.registerTool(
      'list-projects',
      {
        description:
          'Projects — list all qTest projects, or fetch a single project by ID',
        inputSchema: {
          projectId: z.number().int().optional().describe('Project ID; omit to list all projects'),
        },
      },
      async ({ projectId }) => {
        const result = await listProjects({ projectId })
        return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] }
      }
    )
  • Helper function used by the handler to extract an array from API responses that may wrap data in 'items', 'data', or 'object' keys.
    export function extractArray<T>(raw: unknown): T[] {
      if (Array.isArray(raw)) return raw as T[]
      if (raw && typeof raw === 'object') {
        for (const key of ['items', 'data', 'object'] as const) {
          const val = (raw as Record<string, unknown>)[key]
          if (Array.isArray(val)) return val as T[]
        }
      }
      return []
    }
  • Helper function that performs the actual HTTP GET request to the qTest API (global endpoint). Used by the handler to call /projects and /projects/{id}.
    export async function qtestFetchGlobal(
      config: QTestConfig,
      endpoint: string,
      method: 'GET' | 'POST' | 'DELETE',
      body?: unknown
    ): Promise<unknown> {
      const url = `${config.baseUrl}/api/v3${endpoint}`
      const response = await fetch(url, {
        method,
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${config.token}`,
        },
        body: body !== undefined ? JSON.stringify(body) : undefined,
      })
      if (!response.ok) {
        const text = await response.text()
        throw new Error(`HTTP ${response.status}: ${text}`)
      }
      if (response.status === 204 || response.headers.get('content-length') === '0') {
        return null
      }
      const text = await response.text()
      return text ? JSON.parse(text) : null
    }
Behavior3/5

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

No annotations are provided, so the description must bear full burden. It discloses the two modes but omits details like pagination, sorting, or error handling, which are typical for a list operation.

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?

One sentence efficiently communicates the tool's purpose and dual functionality, with no unnecessary words.

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?

No output schema is provided, and the description does not explain the return format or structure. For a listing tool, this leaves agents uncertain about what data they will receive.

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?

Schema coverage is 100%, with parameter 'projectId' already well-described. The tool description adds no extra meaning beyond restating the schema behavior.

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

Purpose5/5

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

Description uses specific verb 'list' and resource 'qTest projects', clearly distinguishing between listing all and fetching by ID. This differentiates it from siblings like list-modules, list-test-cases, etc.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Describes two clear use cases (list all, fetch by ID) but does not explicitly state when not to use or provide alternatives among sibling tools.

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/Usman-Ghani123/qtest-mcp-server'

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