Skip to main content
Glama
bratland

Pipedrive MCP Server

by bratland

get_current_quarter_deals

Retrieve CRM deals for the current quarter using automatic date calculation, with options to filter by status, salesperson, and result limits.

Instructions

Get deals for the current quarter with date context (automatically uses correct quarter based on today's date)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNoFilter by deal status (default: all_not_deleted)
user_idNoFilter by specific user/salesperson
limitNoMax number of deals to return (default: 50)

Implementation Reference

  • The handler implementation for get_current_quarter_deals in PipedriveClient class. It fetches deals and performs client-side filtering by date to ensure they belong to the current quarter.
    async getCurrentQuarterDeals(params?: {
      status?: 'all_not_deleted' | 'open' | 'won' | 'lost';
      user_id?: number;
      limit?: number;
    }): Promise<PipedriveResponse<any[]>> {
      const now = new Date();
      const year = now.getFullYear();
      const month = now.getMonth() + 1;
      
      // Determine current quarter dates
      let startDate: string, endDate: string;
      if (month >= 1 && month <= 3) {
        startDate = `${year}-01-01`;
        endDate = `${year}-03-31`;
      } else if (month >= 4 && month <= 6) {
        startDate = `${year}-04-01`;
        endDate = `${year}-06-30`;
      } else if (month >= 7 && month <= 9) {
        startDate = `${year}-07-01`;
        endDate = `${year}-09-30`;
      } else {
        startDate = `${year}-10-01`;
        endDate = `${year}-12-31`;
      }
    
      // Get deals within current quarter date range
      const response = await this.handleRequest<Deal[]>(
        this.client.get('/deals', {
          params: {
            ...params,
            start: 0,
            limit: Math.min(params?.limit || 50, 100),
            // Note: Pipedrive API filtering by date might need to be done client-side
          }
        })
      );
    
      // Filter deals by current quarter (client-side filtering since Pipedrive API date filtering is limited)
      if (response.success && response.data) {
        const quarterDeals = response.data.filter(deal => {
          if (!deal.add_time) return false;
          const dealDate = new Date(deal.add_time).toISOString().split('T')[0];
          return dealDate >= startDate && dealDate <= endDate;
        });
    
        return {
          ...response,
          data: quarterDeals,
          additional_data: {
            ...response.additional_data,
            quarter_filter: {
              start_date: startDate,
              end_date: endDate,
              quarter: `Q${Math.ceil(month / 3)} ${year}`,
              total_filtered: quarterDeals.length,
              original_count: response.data.length
            }
          } as any
        };
      }
    
      return response;
    }
  • The schema and definition for the get_current_quarter_deals tool.
    {
      name: 'get_current_quarter_deals',
      description: 'Get deals for the current quarter with date context (automatically uses correct quarter based on today\'s date)',
      inputSchema: {
        type: 'object',
        properties: {
          status: {
            type: 'string',
            enum: ['all_not_deleted', 'open', 'won', 'lost'],
            description: 'Filter by deal status (default: all_not_deleted)',
          },
          user_id: {
            type: 'number',
            description: 'Filter by specific user/salesperson',
          },
          limit: {
            type: 'number',
            description: 'Max number of deals to return (default: 50)',
          },
        },
      },
    },
Behavior3/5

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

With no annotations provided, the description must carry the full disclosure burden. It successfully explains the key behavioral trait of automatic quarter determination based on the current date, which is crucial for agent expectations. However, it omits safety characteristics (read-only vs. destructive), return value structure, and error handling patterns that annotations would typically cover.

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 single sentence is appropriately front-loaded with the core action and resource. The parenthetical clarification '(automatically uses correct quarter based on today's date)' efficiently conveys the key value proposition without redundancy. No extraneous information dilutes the directive.

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 absence of an output schema, the description lacks information about return values (e.g., whether it returns a list, count, or summary object). While the tool name suggests the return type, explicit confirmation would strengthen completeness. The parameter schema is fully documented, making the definition minimally viable but not comprehensive.

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?

Input schema has 100% description coverage, establishing a baseline of 3. The description mentions 'date context' which aligns with the implicit quarter filtering, but does not add semantic clarification beyond the schema for specific parameters (e.g., explaining 'user_id' refers to deal owners, or detailing the status filter 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?

The description uses a specific verb ('Get') with clear resource ('deals') and scope ('current quarter'). It effectively distinguishes from sibling tool 'get_deals' by specifying the time-bounded scope and automatic date handling, and differs from 'get_quarter_summary' by targeting individual deals rather than aggregated data.

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

Usage Guidelines3/5

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

The description implies usage scenarios through 'automatically uses correct quarter based on today's date', suggesting when to use this tool (when manual date calculation should be avoided). However, it lacks explicit guidance on when to choose this over 'get_deals' or 'search_deals' for date-filtered queries, and states no prerequisites or exclusions.

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

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