Skip to main content
Glama

Handle Day Planner Action

handle_day_planner_action

Process user actions in the Day Planner dashboard to mark emails handled, prepare for meetings, snooze emails, or open documents.

Instructions

Processes an interactive action triggered by the user in the Day Planner UI.

Action types:

  • mark_email_handled: User marked an email thread as done

  • start_meeting_prep: User wants prep help for a meeting

  • snooze_email: Snooze an email for N hours

  • open_doc: User opened a Drive document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionTypeYesThe type of action the user triggered in the UI
payloadYesAction-specific payload (e.g. threadId, eventId, hours)
currentDataJsonYesJSON-serialized DayPlannerData from the last load_day_planner call

Implementation Reference

  • Main handler implementation for 'handle_day_planner_action' tool. Uses server.registerTool() with an async handler function (lines 109-156) that processes user actions from the Day Planner UI. Implements a switch statement handling action types: 'mark_email_handled', 'start_meeting_prep', 'snooze_email', and 'open_doc'. Returns JSON with actionType, payload, and guidance text.
      server.registerTool(
        'handle_day_planner_action',
        {
          title: 'Handle Day Planner Action',
          description: `Processes an interactive action triggered by the user in the Day Planner UI.
    
    Action types:
      - mark_email_handled: User marked an email thread as done
      - start_meeting_prep: User wants prep help for a meeting
      - snooze_email: Snooze an email for N hours
      - open_doc: User opened a Drive document`,
          inputSchema: HandleActionSchema.shape,
          annotations: {
            readOnlyHint: false,
            destructiveHint: false,
          },
        },
        async ({ actionType, payload, currentDataJson }) => {
          const data = JSON.parse(currentDataJson) as DayPlannerData;
          let guidance = '';
    
          switch (actionType) {
            case 'mark_email_handled': {
              const thread = data.emails.find(e => e.id === payload.threadId);
              guidance = thread
                ? `User marked "${thread.subject}" as handled. You can call Gmail MCP to mark thread ${payload.threadId} as read.`
                : 'Thread not found.';
              break;
            }
            case 'start_meeting_prep': {
              const event = data.events.find(e => e.id === payload.eventId);
              if (event) {
                const relatedEmails = data.eventEmailMap[event.id] ?? [];
                const relatedDocs   = data.eventDocMap[event.id]   ?? [];
                guidance = `Meeting prep for "${event.title}" at ${new Date(event.startTime).toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' })}.
    
    Attendees: ${event.attendeeNames.join(', ')}
    Related emails: ${relatedEmails.map(e => e.subject).join('; ') || 'none'}
    Related docs: ${relatedDocs.map(d => d.title).join('; ') || 'none'}
    
    Recommended: fetch full thread content from Gmail MCP and doc summaries from Drive MCP, then synthesize a meeting brief.`;
              } else {
                guidance = 'Event not found.';
              }
              break;
            }
            case 'snooze_email': {
              const thread = data.emails.find(e => e.id === payload.threadId);
              guidance = thread
                ? `User snoozed "${thread.subject}" for ${payload.hours} hours.`
                : 'Thread not found.';
              break;
            }
            case 'open_doc': {
              guidance = `User opened "${payload.title}". Fetch doc content from Drive MCP if user asks about it.`;
              break;
            }
            default:
              guidance = `Unknown action: ${actionType}`;
          }
    
          return {
            content: [{ type: 'text' as const, text: JSON.stringify({ actionType, payload, guidance }) }],
          };
        },
      );
  • Input schema definition for 'handle_day_planner_action' using Zod. Defines HandleActionSchema with three fields: actionType (enum of 4 action types), payload (record of strings), and currentDataJson (string containing serialized DayPlannerData).
    const HandleActionSchema = z.object({
      actionType: z.enum(['mark_email_handled', 'start_meeting_prep', 'snooze_email', 'open_doc'])
        .describe('The type of action the user triggered in the UI'),
      payload: z.record(z.string())
        .describe('Action-specific payload (e.g. threadId, eventId, hours)'),
      currentDataJson: z.string()
        .describe('JSON-serialized DayPlannerData from the last load_day_planner call'),
    });
  • src/index.ts:36-37 (registration)
    Tool registration point where registerDayPlannerTools(server) is called, which registers both 'load_day_planner' and 'handle_day_planner_action' tools to the MCP server instance.
    // Register day planner tools (load_day_planner + handle_day_planner_action)
    registerDayPlannerTools(server);
  • UI-side invocation of 'handle_day_planner_action' tool. The frontend calls app.callServerTool() with the tool name and arguments including actionType, payload, and currentDataJson, enabling user interactions from the Day Planner UI to trigger server-side actions.
    await app.callServerTool({
      name: 'handle_day_planner_action',
Behavior3/5

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

Annotations already declare readOnlyHint=false and destructiveHint=false, so the agent knows this is a non-destructive mutation tool. The description adds useful context about the UI interaction context and specific action types, but doesn't disclose additional behavioral traits like side effects, authentication needs, rate limits, or what happens after processing each action type.

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 perfectly structured with a clear purpose statement followed by a bulleted list of action types. Every sentence earns its place, there's zero waste, and the information is front-loaded with the most important context first.

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?

For a mutation tool with no output schema, the description provides good context about what actions it handles but lacks information about return values, error conditions, or what constitutes successful processing. The annotations cover basic safety but additional behavioral context would be helpful given this is an interactive UI action processor.

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?

With 100% schema description coverage, the schema already documents all three parameters thoroughly. The description adds value by explaining what 'actionType' values represent with concrete examples, but doesn't provide additional semantic context for 'payload' or 'currentDataJson' beyond what the schema already states.

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 tool 'processes an interactive action triggered by the user in the Day Planner UI' with specific action types listed. It distinguishes from the sibling tool 'load_day_planner' by focusing on action processing rather than data loading, providing a specific verb+resource+scope combination.

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?

The description provides clear context about when to use this tool ('interactive action triggered by the user in the Day Planner UI') and implicitly references the sibling tool 'load_day_planner' through the 'currentDataJson' parameter. However, it doesn't explicitly state when NOT to use this tool or provide alternative tools for similar actions.

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/ryaker/day-planner-mcp'

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