Skip to main content
Glama

workflow

Provides context-based workflow guidance and actionable suggestions to optimize tasks in the Obsidian Semantic MCP Server environment.

Instructions

Workflow guidance and suggestions based on current context

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe specific action to perform
typeNoType of analysis or workflow

Implementation Reference

  • Primary MCP tool handler for the 'workflow' tool (shared with other semantic tools). Instantiates SemanticRouter and calls route() with operation='workflow', then formats response for MCP protocol including workflow hints.
    handler: async (api: ObsidianAPI, args: any) => {
      const router = new SemanticRouter(api);
      
      const request: SemanticRequest = {
        operation,
        action: args.action,
        params: args
      };
      
      const response = await router.route(request);
      
      // Format for MCP
      if (response.error) {
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              error: response.error,
              workflow: response.workflow,
              context: response.context
            }, null, 2)
          }],
          isError: true
        };
      }
      
      // Check if the result is an image file for vault read operations
      if (operation === 'vault' && args.action === 'read' && response.result && isImageFile(response.result)) {
        // Return image content for MCP
        return {
          content: [{
            type: 'image',
            data: response.result.base64Data,
            mimeType: response.result.mimeType
          }]
        };
      }
      
      return {
        content: [{
          type: 'text',
          text: JSON.stringify({
            result: response.result,
            workflow: response.workflow,
            context: response.context,
            efficiency_hints: response.efficiency_hints
          }, null, 2)
        }]
      };
    }
  • Schema definitions for 'workflow' tool: description, actions=['suggest'], parameters={type?: string}, integrated into inputSchema with required 'action'.
    function getOperationDescription(operation: string): string {
      const descriptions: Record<string, string> = {
        vault: 'File and folder operations - list, read, create, update, delete, search',
        edit: 'Smart editing operations - window (auto-buffers content), append, patch, at_line, from_buffer',
        view: 'Content viewing and navigation - file, window, active, open_in_obsidian',
        workflow: 'Workflow guidance and suggestions based on current context',
        system: 'System operations - info, commands, fetch_web'
      };
      return descriptions[operation] || 'Unknown operation';
    }
    
    function getActionsForOperation(operation: string): string[] {
      const actions: Record<string, string[]> = {
        vault: ['list', 'read', 'create', 'update', 'delete', 'search', 'fragments'],
        edit: ['window', 'append', 'patch', 'at_line', 'from_buffer'],
        view: ['file', 'window', 'active', 'open_in_obsidian'],
        workflow: ['suggest'],
        system: ['info', 'commands', 'fetch_web']
      };
      return actions[operation] || [];
    }
    
    function getParametersForOperation(operation: string): Record<string, any> {
      // Common parameters across operations
      const pathParam = {
        path: {
          type: 'string',
          description: 'Path to the file or directory'
        }
      };
      
      const contentParam = {
        content: {
          type: 'string',
          description: 'Content to write or append'
        }
      };
      
      // Operation-specific parameters
      const operationParams: Record<string, Record<string, any>> = {
        vault: {
          ...pathParam,
          directory: {
            type: 'string',
            description: 'Directory path for list operations'
          },
          query: {
            type: 'string',
            description: 'Search query'
          },
          page: {
            type: 'number',
            description: 'Page number for paginated results'
          },
          pageSize: {
            type: 'number',
            description: 'Number of results per page'
          },
          strategy: {
            type: 'string',
            enum: ['auto', 'adaptive', 'proximity', 'semantic'],
            description: 'Fragment retrieval strategy (default: auto)'
          },
          maxFragments: {
            type: 'number',
            description: 'Maximum number of fragments to return (default: 5)'
          },
          returnFullFile: {
            type: 'boolean',
            description: 'Return full file instead of fragments (WARNING: large files can consume significant context)'
          },
          includeContent: {
            type: 'boolean',
            description: 'Include file content in search results (slower but more thorough)'
          },
          ...contentParam
        },
        edit: {
          ...pathParam,
          ...contentParam,
          oldText: {
            type: 'string',
            description: 'Text to search for (supports fuzzy matching)'
          },
          newText: {
            type: 'string',
            description: 'Text to replace with'
          },
          fuzzyThreshold: {
            type: 'number',
            description: 'Similarity threshold for fuzzy matching (0-1)',
            default: 0.7
          },
          lineNumber: {
            type: 'number',
            description: 'Line number for at_line action'
          },
          mode: {
            type: 'string',
            enum: ['before', 'after', 'replace'],
            description: 'Insert mode for at_line action'
          },
          operation: {
            type: 'string',
            enum: ['append', 'prepend', 'replace'],
            description: 'Patch operation: append (add after), prepend (add before), or replace'
          },
          targetType: {
            type: 'string',
            enum: ['heading', 'block', 'frontmatter'],
            description: 'What to target: heading (by path like "H1::H2"), block (by ID), or frontmatter (field)'
          },
          target: {
            type: 'string',
            description: 'Target identifier - e.g., "Daily Notes::Today" for heading, block ID, or frontmatter field name'
          }
        },
        view: {
          ...pathParam,
          searchText: {
            type: 'string',
            description: 'Text to search for and highlight'
          },
          lineNumber: {
            type: 'number',
            description: 'Line number to center view around'
          },
          windowSize: {
            type: 'number',
            description: 'Number of lines to show',
            default: 20
          }
        },
        workflow: {
          type: {
            type: 'string',
            description: 'Type of analysis or workflow'
          }
        },
        system: {
          url: {
            type: 'string',
            description: 'URL to fetch and convert to markdown'
          }
        }
      };
      
      return operationParams[operation] || {};
    }
  • src/index.ts:80-100 (registration)
    MCP server registration: sets handlers for ListToolsRequestSchema and CallToolRequestSchema using semanticTools array (includes 'workflow' tool).
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: semanticTools.map(tool => ({
          name: tool.name,
          description: tool.description,
          inputSchema: tool.inputSchema
        }))
      };
    });
    
    // Handle tool execution
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
      
      const tool = semanticTools.find(t => t.name === name);
      if (!tool) {
        throw new Error(`Tool not found: ${name}`);
      }
      
      return await tool.handler(obsidianAPI, args);
    });
  • SemanticRouter.executeWorkflowOperation: routes 'suggest' action (only action) to generateWorkflowSuggestions().
    private async executeWorkflowOperation(action: string, params: any): Promise<any> {
      switch (action) {
        case 'suggest':
          return this.generateWorkflowSuggestions();
        default:
          throw new Error(`Unknown workflow action: ${action}`);
      }
    }
  • Core implementation: generateWorkflowSuggestions provides context-aware suggestions (e.g., continue with last file, refine search) based on SemanticRouter state and context.
    private generateWorkflowSuggestions(): any {
      // Generate contextual workflow suggestions based on current state
      const suggestions: SuggestedAction[] = [];
      
      if (this.context.last_file) {
        suggestions.push({
          description: 'Continue working with last file',
          command: `vault(action='read', path='${this.context.last_file}')`,
          reason: 'Return to previous work'
        });
      }
      
      if (this.context.search_history?.length) {
        const lastSearch = this.context.search_history[this.context.search_history.length - 1];
        suggestions.push({
          description: 'Refine last search',
          command: `vault(action='search', query='${lastSearch} AND ...')`,
          reason: 'Narrow down results'
        });
      }
      
      // Always include a default suggestion if no context-specific ones
      if (suggestions.length === 0) {
        suggestions.push({
          description: 'Use workflow hints from other operations',
          command: 'vault(action="list") or vault(action="read", path="...") etc.',
          reason: 'Each operation provides contextual workflow suggestions'
        });
      }
      
      return {
        current_context: this.getCurrentContext(),
        suggestions
      };
    }
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. While it mentions providing 'guidance and suggestions,' it doesn't describe what form these take, whether they're actionable recommendations, informational tips, or something else. There's no information about permissions needed, rate limits, side effects, or what constitutes 'current context' that triggers the suggestions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise at just 6 words. It's front-loaded with the core purpose ('Workflow guidance and suggestions') and adds qualifying context ('based on current context'). There's no wasted language, though the brevity contributes to the vagueness noted in other dimensions.

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?

For a tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what kind of output to expect (structured data, natural language, actionable steps), what domains it covers, or how the 'current context' is determined. The combination of vague purpose, missing behavioral details, and unspecified output format leaves significant gaps for an AI agent.

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 both parameters thoroughly. The description adds no additional meaning about parameters beyond what's in the schema. It doesn't explain how 'type' relates to 'workflow guidance' or what values might be appropriate for 'type' beyond the schema's basic type declaration.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Workflow guidance and suggestions based on current context' states a general purpose (providing guidance/suggestions) but lacks specificity about what resources or domains it operates on. It doesn't distinguish itself from sibling tools like 'edit', 'system', 'vault', or 'view' - all of which could potentially provide guidance in different contexts. The description is vague about what exactly 'workflow' refers to.

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 about when to use this tool versus the sibling tools. There's no mention of prerequisites, appropriate contexts, or alternatives. The phrase 'based on current context' implies some situational awareness but doesn't specify what constitutes appropriate context or when other tools might be better choices.

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/aaronsb/obsidian-semantic-mcp'

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