Skip to main content
Glama

get_open_tickets

Retrieve maintenance tickets from property management systems, filtering by status, priority, category, or property to monitor and manage unresolved issues.

Instructions

Retrieves maintenance tickets from the property management system. Filters by status (default: all non-resolved), priority, category, and property. Returns tickets sorted by priority (emergency first) then recency.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNoFilter by ticket status. Omit to return all non-resolved/non-closed tickets.
priorityNoFilter to a specific priority level.
categoryNoFilter by maintenance category / trade.
propertyIdNoFilter to tickets for a specific property (use property ID).
limitNoMaximum number of tickets to return (default: all matching).

Implementation Reference

  • The handleGetOpenTickets function is the main handler that executes the tool logic. It queries the ticket store with input filters and returns filtered tickets along with total and filtered counts.
    export function handleGetOpenTickets(
      input: GetOpenTicketsInput
    ): GetOpenTicketsOutput {
      const allNonClosed = ticketStore.query({ status: "all" }).filter(
        (t) => t.status !== "closed"
      );
      const filtered = ticketStore.query(input);
    
      return {
        tickets: filtered,
        total: allNonClosed.length,
        filtered: filtered.length,
      };
    }
  • The GetOpenTicketsSchema is a Zod schema defining input validation for the tool. It specifies optional filters: status (enum), priority (enum), category (enum), propertyId (string), and limit (number 1-100).
    export const GetOpenTicketsSchema = z.object({
      status: z
        .enum(["open", "in_progress", "awaiting_tenant", "escalated", "resolved", "closed", "all"])
        .optional()
        .describe(
          "Filter by ticket status. Omit to return all non-resolved/non-closed tickets."
        ),
      priority: z
        .enum(["low", "medium", "high", "emergency"])
        .optional()
        .describe("Filter to a specific priority level."),
      category: z
        .enum(["plumbing", "electrical", "hvac", "appliance", "structural", "pest", "general"])
        .optional()
        .describe("Filter by maintenance category / trade."),
      propertyId: z
        .string()
        .optional()
        .describe("Filter to tickets for a specific property (use property ID)."),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .optional()
        .describe("Maximum number of tickets to return (default: all matching)."),
    });
    
    export type GetOpenTicketsInput = z.infer<typeof GetOpenTicketsSchema>;
  • Tool registration using server.tool() that registers 'get_open_tickets' with the MCP server. Includes description, schema binding, and async handler wrapper that returns JSON-formatted results.
    // ── Tool: get_open_tickets ────────────────────────────────────────────────────
    
    server.tool(
      "get_open_tickets",
      "Retrieves maintenance tickets from the property management system. " +
      "Filters by status (default: all non-resolved), priority, category, and property. " +
      "Returns tickets sorted by priority (emergency first) then recency.",
      GetOpenTicketsSchema.shape,
      async (input) => {
        const result = handleGetOpenTickets(input);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      }
    );
  • The TicketStore.query method is a supporting utility that filters tickets by status, priority, category, and propertyId. It sorts results by priority (emergency first) then by recency, and applies optional limit.
    query(filters: GetOpenTicketsInput): MaintenanceTicket[] {
      let results = Array.from(this.tickets.values());
    
      if (filters.status && filters.status !== "all") {
        results = results.filter((t) => t.status === filters.status);
      } else if (!filters.status) {
        // default: exclude resolved/closed
        results = results.filter(
          (t) => t.status !== "resolved" && t.status !== "closed"
        );
      }
    
      if (filters.priority) {
        results = results.filter((t) => t.priority === filters.priority);
      }
    
      if (filters.category) {
        results = results.filter((t) => t.category === filters.category);
      }
    
      if (filters.propertyId) {
        results = results.filter(
          (t) => t.property.id === filters.propertyId
        );
      }
    
      // sort: emergency → high → medium → low, then newest first
      const priorityOrder: Record<TicketPriority, number> = {
        emergency: 0,
        high: 1,
        medium: 2,
        low: 3,
      };
      results.sort((a, b) => {
        const pd = priorityOrder[a.priority] - priorityOrder[b.priority];
        if (pd !== 0) return pd;
        return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
      });
    
      if (filters.limit) {
        results = results.slice(0, filters.limit);
      }
    
      return results;
    }
  • TypeScript interfaces GetOpenTicketsInput and GetOpenTicketsOutput define the type shapes for the tool's input parameters and output structure (tickets array, total count, filtered count).
    export interface GetOpenTicketsInput {
      status?: TicketStatus | "all";
      priority?: TicketPriority;
      category?: MaintenanceCategory;
      propertyId?: string;
      limit?: number;
    }
    
    export interface GetOpenTicketsOutput {
      tickets: MaintenanceTicket[];
      total: number;
      filtered: number;
    }
Behavior4/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 effectively describes key behaviors: default filtering (non-resolved tickets), sorting logic (priority then recency), and that it's a retrieval operation. However, it doesn't mention potential limitations like pagination, rate limits, or authentication requirements.

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?

Two sentences that efficiently cover purpose, filtering parameters, defaults, and sorting logic with zero wasted words. The description is appropriately sized and front-loaded with the core functionality.

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

Completeness4/5

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

For a read-only query tool with comprehensive schema documentation but no output schema, the description provides good context about filtering defaults and sorting behavior. It could be more complete by describing the return format or result structure, but given the tool's relative simplicity and good parameter documentation, it's mostly adequate.

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%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema - it mentions filtering by the same parameters but doesn't provide additional semantic context. Baseline 3 is appropriate when schema does the heavy lifting.

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 clearly states the specific action ('Retrieves maintenance tickets'), resource ('from the property management system'), and scope ('Filters by status, priority, category, and property'). It distinguishes from siblings like 'escalate_to_vendor' or 'update_maintenance_status' by being a read-only query tool rather than a mutation tool.

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 context through filtering parameters and default behavior, but doesn't explicitly state when to use this tool versus alternatives like 'update_maintenance_status' for modifying tickets or 'notify_tenant' for communication. No explicit when-not-to-use guidance or prerequisite information is provided.

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/utkarsh-portfolio/MCPPropTech'

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