Skip to main content
Glama

tasks_setup

Initialize task management by creating or loading a source file from a specified path to enable task tracking and organization capabilities.

Instructions

Initializes an source file from a path

  • Always call once per conversation when asked to use these tools

  • Ask the user to clarify the file path if not given, before calling this tool

  • Creates the file if it does not exist

  • Returns the source ID for further use

  • Use mcp-tasks tools when the user mentions new or updated tasks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceNoWorkspace/project directory path (provided by the IDE or use $PWD)
source_pathYes

Implementation Reference

  • Core handler logic for the 'tasks_setup' tool (prefixed name for internal 'setup' tool). Parses the source file, registers it using sources.register, and returns a JSON summary via getSummary.
    handler: (args) => {
      storage.getParser(args.source_path)
      // Register the source and get ID
      const source = sources.register(args.source_path, args.workspace)
      return getSummary(source.id)
    },
  • Zod input schema definition for the tasks_setup tool, including workspace (optional) and source_path.
    schema: z.object({
      workspace: z.string().optional().describe('Workspace/project directory path (provided by the IDE or use $PWD)'),
      source_path: schemas.sourcePath,
    }),
  • src/server.ts:15-42 (registration)
    Registration loop in MCP server that adds all tools from tools.ts (including tasks_setup) to the FastMCP server instance.
    // Register all tools & resources
    for (const tool of Object.values(tools)) {
      if (!tool.isEnabled) {
        continue
      }
      if (tool.isResource) {
        // Register as resource
        server.addResource({
          uri: `resource://${tool.name}`,
          name: tool.description,
          mimeType: 'text/plain',
          load: () => cli.runTool(tool, []).then(text => ({ text })),
        })
      } else {
        // Register as tool with enhanced logging
        server.addTool({
          annotations: {
            openWorldHint: false, // This tool doesn't interact with external systems
            readOnlyHint: tool.isReadOnly,
            title: tool.name,
          },
          name: tool.name,
          description: tool.description,
          parameters: tool.schema,
          execute: (args) => cli.runTool(tool, args),
        })
      }
    }
  • defineTool helper that wraps the tool definition, sets the name to 'tasks_setup' based on env.PREFIX_TOOLS, and adds default properties.
    function defineTool<S extends ZodSchema>(name: string, tool: {
      schema: S
      description: string
      isResource?: boolean
      isReadOnly?: boolean
      isEnabled?: boolean
      handler: (args: z.infer<S>, context?: any) => any
      fromArgs: (args: string[]) => z.infer<S>
    }) {
      const toolName = env.PREFIX_TOOLS ? `tasks_${name}` : name
      return {
        ...tool,
        name: toolName,
        isResource: tool.isResource ?? false,
        isReadOnly: tool.isReadOnly ?? false,
        isEnabled: tool.isEnabled ?? true,
      }
    }
  • sources.register helper called by tasks_setup handler to register the source file path (making absolute if needed) and persist to SOURCES_PATH, returning the Source object with ID.
    register(sourcePath: string, workspace = CWD): Source {
      let path = sourcePath
      if (!isAbsolute(path)) {
        if (!workspace) {
          throw new Error('You must specify a workspace directory when registering a relative path.')
        }
        path = util.resolve(path, workspace)
      }
      const list = sources.raw()
      // Remove if exists and add to front (LIFO)
      const filtered = list.filter(s => s.path !== path)
      const source: SourceRaw = { path, workspace }
      util.writeFile(SOURCES_PATH, JSON.stringify([source, ...filtered]))
      return sources.fromRaw(source)
    },

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/flesler/mcp-tasks'

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