Skip to main content
Glama

list_custom_perspectives

Retrieve all custom perspectives in OmniFocus with options for simple or detailed output, enabling efficient task management and workflow organization through the Model Context Protocol server.

Instructions

List all custom perspectives defined in OmniFocus

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoOutput format: simple (names only) or detailed (with identifiers) - default: simple

Implementation Reference

  • src/server.ts:136-141 (registration)
    Registration of the 'list_custom_perspectives' tool in the MCP server, linking to schema and handler from definitions.
    server.tool(
      "list_custom_perspectives",
      "List all custom perspectives defined in OmniFocus",
      listCustomPerspectivesTool.schema.shape,
      listCustomPerspectivesTool.handler
    );
  • Zod schema defining the input parameters for the list_custom_perspectives tool.
    export const schema = z.object({
      format: z.enum(['simple', 'detailed']).optional().describe("Output format: simple (names only) or detailed (with identifiers) - default: simple")
    });
  • MCP tool handler for list_custom_perspectives, which calls the primitive function and formats the response.
    export async function handler(args: z.infer<typeof schema>, extra: RequestHandlerExtra) {
      try {
        const result = await listCustomPerspectives({
          format: args.format || 'simple'
        });
        
        return {
          content: [{
            type: "text" as const,
            text: result
          }]
        };
      } catch (err: unknown) {
        const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred';
        return {
          content: [{
            type: "text" as const,
            text: `Error listing custom perspectives: ${errorMessage}`
          }],
          isError: true
        };
      }
    }
  • Helper function that executes the OmniFocus script, processes the JSON result, and formats the output based on format option.
    export async function listCustomPerspectives(options: ListCustomPerspectivesOptions = {}): Promise<string> {
      const { format = 'simple' } = options;
      
      try {
        console.log('🚀 匀始执行 listCustomPerspectives 脚本...');
        
        // Execute the list custom perspectives script
        const result = await executeOmniFocusScript('@listCustomPerspectives.js', {});
        
        console.log('📋 脚本执行完成结果类型:', typeof result);
        console.log('📋 脚本执行结果:', result);
        
        // 倄理各种可胜的返回类型
        let data: any;
        
        if (typeof result === 'string') {
          console.log('📝 结果是字笊䞲尝试解析 JSON...');
          try {
            data = JSON.parse(result);
            console.log('✅ JSON 解析成功:', data);
          } catch (parseError) {
            console.error('❌ JSON 解析倱莥:', parseError);
            throw new Error(`解析字笊䞲结果倱莥: ${result}`);
          }
        } else if (typeof result === 'object' && result !== null) {
          console.log('🔄 结果是对象盎接䜿甚...');
          data = result;
        } else {
          console.error('❌ 无效的结果类型:', typeof result, result);
          throw new Error(`脚本执行返回了无效的结果类型: ${typeof result}, 倌: ${result}`);
        }
        
        // 检查是吊有错误
        if (!data.success) {
          throw new Error(data.error || 'Unknown error occurred');
        }
        
        // 栌匏化蟓出
        if (data.count === 0) {
          return "📋 **自定义透视列衚**\n\n暂无自定义透视。";
        }
        
        if (format === 'simple') {
          // 简单栌匏只星瀺名称列衚
          const perspectiveNames = data.perspectives.map((p: any) => p.name);
          return `📋 **自定义透视列衚** (${data.count}䞪)\n\n${perspectiveNames.map((name: string, index: number) => `${index + 1}. ${name}`).join('\n')}`;
        } else {
          // 诊细栌匏星瀺名称和标识笊
          const perspectiveDetails = data.perspectives.map((p: any, index: number) => 
            `${index + 1}. **${p.name}**\n   🆔 ${p.identifier}`
          );
          return `📋 **自定义透视列衚** (${data.count}䞪)\n\n${perspectiveDetails.join('\n\n')}`;
        }
        
      } catch (error) {
        console.error('Error in listCustomPerspectives:', error);
        return `❌ **错误**: ${error instanceof Error ? error.message : String(error)}`;
      }
    }
  • Core OmniFocus AppleScript/JXA script that fetches all custom perspectives using Perspective.Custom.all and returns JSON.
    // 获取所有自定义透视列衚
    // 基于 OmniJS API: Perspective.Custom.all
    
    (() => {
      try {
        // 获取所有自定义透视
        const customPerspectives = Perspective.Custom.all;
        
        // 栌匏化结果
        const perspectives = customPerspectives.map(p => ({
          name: p.name,
          identifier: p.identifier
        }));
        
        // 返回结果
        const result = {
          success: true,
          count: perspectives.length,
          perspectives: perspectives
        };
        
        return JSON.stringify(result);
        
      } catch (error) {
        // 错误倄理
        const errorResult = {
          success: false,
          error: error.message || String(error),
          count: 0,
          perspectives: []
        };
        
        return JSON.stringify(errorResult);
      }
    })();
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it's a list operation, implying it's read-only and non-destructive, but doesn't cover aspects like rate limits, authentication needs, or what happens if no perspectives exist. This is a significant gap for a tool with zero annotation coverage.

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 directly states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 tool's low complexity (one optional parameter, no output schema, no annotations), the description is minimally adequate. It explains what the tool does but lacks details on behavior, usage context, or output format, which could be important for an agent to use it effectively.

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?

The input schema has 100% description coverage, with the 'format' parameter fully documented in the schema itself. The description adds no additional parameter information beyond what the schema provides, so it meets the baseline of 3 without compensating or adding extra value.

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 the resource 'all custom perspectives defined in OmniFocus', making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_custom_perspective_tasks', which might retrieve tasks from perspectives rather than listing the perspectives themselves.

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 sibling tools like 'get_custom_perspective_tasks' or explain use cases, leaving the agent to infer usage from the tool name alone.

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/jqlts1/omnifocus-mcp-enhanced'

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