Skip to main content
Glama

listProjects

Retrieve all projects associated with the authenticated user on DeepWriter MCP Server using a valid API key. Simplify project management and access content generation tools efficiently.

Instructions

List all projects for the authenticated user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyYesThe DeepWriter API key for authentication.

Implementation Reference

  • Core handler function that executes the listProjects tool: fetches projects via API using env API key, transforms to MCP content format.
    export const listProjectsTool = {
      name: "listProjects",
      description: "List all projects for the authenticated user",
      // TODO: Add input/output schema validation if needed
      async execute(args: ListProjectsInput): Promise<ListProjectsOutput> {
        console.error(`Executing listProjects tool...`);
    
        // Get API key from environment
        const apiKey = process.env.DEEPWRITER_API_KEY;
        if (!apiKey) {
          throw new Error("DEEPWRITER_API_KEY environment variable is required");
        }
    
        try {
          // Call the actual API client function
          const apiResponse = await apiClient.listProjects(apiKey);
          console.error(`API call successful. Received ${apiResponse.projects.length} projects.`);
    
          // Transform the API response into MCP format
          const mcpResponse: ListProjectsOutput = {
            content: apiResponse.projects.map(project => ({
              type: 'text',
              text: `Project ID: ${project.id}, Title: ${project.title}, Created: ${project.created_at}`
            }))
          };
    
          if (mcpResponse.content.length === 0) {
            mcpResponse.content.push({ type: 'text', text: 'No projects found.' });
          }
    
          return mcpResponse; // Return the MCP-compliant structure
        } catch (error) {
          console.error(`Error executing listProjects tool: ${error}`);
          // Format error for MCP response
          // Ensure error is an instance of Error before accessing message
          const errorMessage = error instanceof Error ? error.message : String(error);
          throw new Error(`Failed to list projects: ${errorMessage}`);
        }
      }
    };
  • src/index.ts:189-209 (registration)
    Registers the listProjectsTool with the MCP server using server.tool(), providing empty input schema and wrapper around execute.
    server.tool(
      listProjectsTool.name,
      listProjectsTool.description,
      {
        // No parameters - API key from environment
      },
      async (params: ListProjectsParams) => {
        console.error(`SDK invoking ${listProjectsTool.name}...`);
        const result = await listProjectsTool.execute({});
        return {
          content: result.content,
          annotations: {
            title: "List Projects",
            readOnlyHint: true, // This tool only reads data
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: false // Only accesses DeepWriter API
          }
        };
      }
    );
  • Type definitions for tool input (empty), intermediate Project, and MCP output structure.
    interface ListProjectsInput {
      // No parameters needed - API key from environment
    }
    
    interface Project {
      id: string;
      title: string;
      created_at: string;
      // Add other relevant fields if needed
    }
    
    // Define the MCP-compliant output structure
    interface ListProjectsOutput {
      content: { type: 'text'; text: string }[];
    }
  • Zod input schema for listProjects tool registration (empty object).
    const listProjectsInputSchema = z.object({}); // No parameters needed
  • API client helper: makes GET request to DeepWriter /api/listProjects endpoint and returns typed response.
    interface ListProjectsResponse {
      projects: ProjectListItem[];
      // Add other potential fields like pagination info if applicable
    }
    
    export async function listProjects(apiKey: string): Promise<ListProjectsResponse> {
      console.error("Calling actual listProjects API");
      if (!apiKey) {
        throw new Error("API key is required for listProjects");
      }
      // Actual implementation:
      return makeApiRequest<ListProjectsResponse>('/api/listProjects', apiKey, 'GET');
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states it's a list operation (implied read-only) but doesn't mention pagination, sorting, filtering, rate limits, or what the output looks like. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 states the core purpose without unnecessary words. It's appropriately sized and front-loaded with the essential information.

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

Completeness2/5

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

Given no annotations, no output schema, and a simple input schema, the description is incomplete. It doesn't explain what the output contains (project list format), whether there are limitations (like max results), or authentication requirements beyond the implied 'authenticated user'. For a tool that likely returns multiple items, more context is needed.

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 description coverage is 100% (the single parameter 'api_key' is fully described in the schema). The description doesn't add any parameter information beyond what the schema provides. According to guidelines, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 ('projects') with scope ('all projects for the authenticated user'). It distinguishes from siblings like 'getProjectDetails' (which retrieves a specific project) by indicating it returns all projects. However, it doesn't explicitly differentiate from other list-like operations that might exist in the sibling set.

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 like authentication (though implied by 'authenticated user'), nor does it compare with siblings like 'getProjectDetails' for retrieving specific projects. There's no explicit when/when-not usage context.

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

Related 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/deepwriter-ai/Deepwriter-MCP'

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