Skip to main content
Glama

system

Access and manage system operations within Obsidian by performing actions like retrieving info, executing commands, or fetching web content and converting it to markdown.

Instructions

System operations - info, commands, fetch_web

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe specific action to perform
urlNoURL to fetch and convert to markdown

Implementation Reference

  • src/index.ts:80-100 (registration)
    Registers the 'system' tool by setting up MCP server request handlers for listing and calling tools from the semanticTools array, which includes the 'system' 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);
    });
  • Defines the handler function for the 'system' tool (shared across semantic tools), which routes the request to SemanticRouter and formats the MCP response.
    const createSemanticTool = (operation: string) => ({
      name: operation,
      description: getOperationDescription(operation),
      inputSchema: {
        type: 'object',
        properties: {
          action: {
            type: 'string',
            description: 'The specific action to perform',
            enum: getActionsForOperation(operation)
          },
          ...getParametersForOperation(operation)
        },
        required: ['action']
      },
      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)
          }]
        };
      }
    });
  • Defines the input schema, description, actions enum, and parameters for the 'system' tool.
    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] || {};
    }
  • Creates and exports the 'system' tool instance.
    export const semanticTools = [
      createSemanticTool('vault'),
      createSemanticTool('edit'),
      createSemanticTool('view'),
      createSemanticTool('workflow'),
      createSemanticTool('system')
    ];
  • Implements the core logic for 'system' tool actions: info (server info), commands (list commands), fetch_web (delegates to fetch tool). Called by the semantic tool handler.
    private async executeSystemOperation(action: string, params: any): Promise<any> {
      switch (action) {
        case 'info':
          return await this.api.getServerInfo();
        case 'commands':
          return await this.api.getCommands();
        case 'fetch_web':
          // Import fetch tool dynamically
          const { fetchTool } = await import('../tools/fetch.js');
          return await fetchTool.handler(this.api, params);
        default:
          throw new Error(`Unknown system action: ${action}`);
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It lists actions but doesn't describe what each does (e.g., 'info' might return system status, 'commands' could list available commands, 'fetch_web' likely retrieves web content). It omits critical details like permissions needed, rate limits, side effects, or response format, leaving significant gaps for a tool with multiple operations.

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

Conciseness3/5

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

The description is brief but under-specified—it's a single phrase listing actions without elaboration. While concise, it lacks structure and front-loading of key information. Every word earns its place, but the content is insufficient, making it more of a placeholder than a helpful description.

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?

Given the complexity (multiple actions under one tool), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns or how actions differ, leaving the agent to guess. For a tool with 2 parameters and varied operations, this minimal description is inadequate to ensure correct usage.

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 documents both parameters: 'action' with enum values and 'url' for fetch_web. The description adds no meaning beyond this—it doesn't explain what each action entails or when 'url' is required. Baseline 3 is appropriate since the schema does the heavy lifting, but the description fails to compensate with additional context.

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

Purpose2/5

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

The description 'System operations - info, commands, fetch_web' lists three operations but doesn't specify what each does or what 'system operations' means. It's vague and doesn't clearly distinguish this tool from siblings like 'edit', 'vault', 'view', or 'workflow'. The description essentially restates the tool name 'system' with appended action names, making it tautological.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't explain the context for 'info', 'commands', or 'fetch_web', nor does it mention prerequisites or exclusions. Without any usage instructions, an agent must infer from the action names 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/aaronsb/obsidian-semantic-mcp'

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