Skip to main content
Glama
8bitgentleman

ActivityWatch MCP Server

activitywatch_get_settings

Retrieve ActivityWatch configuration settings to customize time tracking behavior. Access all settings or query specific keys to adjust monitoring preferences.

Instructions

Get ActivityWatch settings. Can retrieve all settings or a specific key if provided.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyNoOptional: Get a specific settings key instead of all settings

Implementation Reference

  • The handler function that fetches ActivityWatch settings from the API endpoint, handles optional key parameter, formats response, adds usage guidance, and manages various error cases including network and API errors.
      handler: async (args: { key?: string }) => {
        try {
          let endpoint = `${AW_API_BASE}/settings`;
          
          // If a specific key is requested, append it to the endpoint
          if (args.key && typeof args.key === 'string') {
            endpoint = `${endpoint}/${encodeURIComponent(args.key)}`;
          }
          
          const response = await axios.get(endpoint);
          const settings: SettingsResponse = response.data;
          
          // Format the settings data nicely
          const formattedSettings = JSON.stringify(settings, null, 2);
          
          let resultText = formattedSettings;
          
          // Add helpful guidance if we're not in test mode
          if (process.env.NODE_ENV !== 'test') {
            if (args.key) {
              resultText += `\n\nShowing settings for key: "${args.key}"\n`;
              resultText += `To get all settings, use activitywatch_get_settings without a key parameter.`;
            } else {
              resultText += `\n\nShowing all ActivityWatch settings.\n`;
              resultText += `To get a specific setting, use activitywatch_get_settings with a key parameter.`;
              
              // Add example of a specific key if there are any settings
              if (Object.keys(settings).length > 0) {
                const exampleKey = Object.keys(settings)[0];
                resultText += `\nFor example: activitywatch_get_settings with key = "${exampleKey}"`;
              }
            }
          }
          
          return {
            content: [
              {
                type: "text",
                text: resultText
              }
            ]
          };
        } catch (error) {
          console.error("Error in get settings tool:", error);
          
          // Handle Axios errors with response
          if (axios.isAxiosError(error)) {
            if (error.response) {
              // Error with response (e.g. 404, 500, etc)
              const statusCode = error.response.status;
              let errorMessage = `Failed to fetch settings: ${error.message} (Status code: ${statusCode})`;
              
              // Include response data if available
              if (error.response.data) {
                const errorDetails = typeof error.response.data === 'object'
                  ? JSON.stringify(error.response.data)
                  : String(error.response.data);
                errorMessage += `\nDetails: ${errorDetails}`;
              }
              
              return {
                content: [{ type: "text", text: errorMessage }],
                isError: true
              };
            } else {
              // Network error (no response)
              const errorMessage = `Failed to fetch settings: ${error.message}
    
    This appears to be a network or connection error. Please check:
    - The ActivityWatch server is running (http://localhost:5600)
    - The API base URL is correct (currently: ${AW_API_BASE})
    - No firewall or network issues are blocking the connection
    `;
              return {
                content: [{ type: "text", text: errorMessage }],
                isError: true
              };
            }
          } 
          // Handle non-axios errors
          else if (error instanceof Error) {
            return {
              content: [{ type: "text", text: `Failed to fetch settings: ${error.message}` }],
              isError: true
            };
          } 
          // Fallback for unknown errors
          else {
            return {
              content: [{ type: "text", text: `Failed to fetch settings: Unknown error` }],
              isError: true
            };
          }
        }
      }
  • Input schema defining the optional 'key' parameter for retrieving specific settings.
    const inputSchema = {
      type: "object",
      properties: {
        key: {
          type: "string",
          description: "Optional: Get a specific settings key instead of all settings"
        }
      }
    };
  • src/index.ts:64-68 (registration)
    Tool registration in the listTools response, providing name, description, and inputSchema.
    {
      name: activitywatch_get_settings_tool.name,
      description: activitywatch_get_settings_tool.description,
      inputSchema: activitywatch_get_settings_tool.inputSchema
    }
  • src/index.ts:266-270 (registration)
    Dispatch logic in callTool handler that invokes the tool's handler with parsed arguments.
    } else if (request.params.name === activitywatch_get_settings_tool.name) {
      // For the settings tool
      return makeSafeToolResponse(activitywatch_get_settings_tool.handler)({
        key: typeof args.key === 'string' ? args.key : undefined
      });
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. It states the tool retrieves settings but doesn't disclose behavioral traits such as whether it's read-only (implied by 'Get'), authentication needs, rate limits, error handling, or response format. The description is minimal and lacks necessary context for safe and effective use.

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 appropriately sized with two concise sentences that are front-loaded and waste-free. It efficiently communicates the core functionality and parameter usage without unnecessary details.

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 no annotations, no output schema, and a simple input schema, the description is incomplete. It doesn't explain what settings are returned, their structure, or any behavioral aspects like permissions or errors. For a tool with zero annotation coverage, more context is needed for adequate agent understanding.

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 the optional 'key' parameter. The description adds marginal value by mentioning 'a specific key if provided,' but doesn't provide additional semantics like key examples, format, or constraints beyond what the schema states.

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 tool's purpose with a specific verb ('Get') and resource ('ActivityWatch settings'), and distinguishes between retrieving all settings or a specific key. However, it doesn't explicitly differentiate from sibling tools like 'activitywatch_get_events' or 'activitywatch_list_buckets' beyond the resource name.

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 by mentioning 'all settings or a specific key if provided,' which suggests when to use the optional parameter. However, it lacks explicit guidance on when to choose this tool over siblings (e.g., vs. 'activitywatch_get_events') or any prerequisites or exclusions.

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/8bitgentleman/activitywatch-mcp-server'

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