Skip to main content
Glama

asana_create_task_story

Add comments or stories to Asana tasks using plain text or formatted HTML with supported tags to document progress and communicate updates.

Instructions

Create a comment or story on a task. Either text or html_text is required.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesThe task ID to add the story to
textNoThe plain text content of the story/comment. Required if html_text is not provided.
html_textNoHTML-like formatted text for the comment. Required if text is not provided. Does not support ALL HTML tags. Only a subset. The only allowed TAG in the HTML are: <body> <h1> <h2> <ol> <ul> <li> <strong> <em> <u> <s> <code> <pre> <blockquote> <a data-asana-type="" data-asana-gid=""> <hr> <img> <table> <tr> <td>. No other tags are allowed. Use the \n to create a newline. Do not use \n after <body>.
opt_fieldsNoComma-separated list of optional fields to include

Implementation Reference

  • Handler implementation for the 'asana_create_task_story' tool. Validates HTML text if provided, calls the Asana client wrapper to create the story, and provides detailed error handling including XML validation feedback.
    case "asana_create_task_story": {
      const { task_id, text, html_text, ...opts } = args;
    
      try {
        // Validate if html_text is provided
        if (html_text) {
          const xmlValidationErrors = validateAsanaXml(html_text);
          if (xmlValidationErrors.length > 0) {
            return {
              content: [{
                type: "text",
                text: JSON.stringify({
                  error: "HTML validation failed",
                  validation_errors: xmlValidationErrors,
                  message: "The HTML text contains invalid XML formatting. Please check the validation errors above."
                })
              }],
            };
          }
        }
    
        const response = await asanaClient.createTaskStory(task_id, text, opts, html_text);
        return {
          content: [{ type: "text", text: JSON.stringify(response) }],
        };
      } catch (error) {
        // When error occurs and html_text was provided, help troubleshoot
        if (html_text && error instanceof Error && error.message.includes('400')) {
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                error: error instanceof Error ? error.message : String(error),
                html_text_validation: "The HTML format is valid. The error must be related to something else in the API request."
              })
            }],
          };
        }
        throw error; // re-throw to be caught by the outer try/catch
      }
    }
  • Schema definition for the 'asana_create_task_story' tool, including name, description, and detailed input schema.
    export const createTaskStoryTool: Tool = {
      name: "asana_create_task_story",
      description: "Create a comment or story on a task. Either text or html_text is required.",
      inputSchema: {
        type: "object",
        properties: {
          task_id: {
            type: "string",
            description: "The task ID to add the story to"
          },
          text: {
            type: "string",
            description: "The plain text content of the story/comment. Required if html_text is not provided."
          },
          html_text: {
            type: "string",
            description: "HTML-like formatted text for the comment. Required if text is not provided. Does not support ALL HTML tags. Only a subset. The only allowed TAG in the HTML are: <body> <h1> <h2> <ol> <ul> <li> <strong> <em> <u> <s> <code> <pre> <blockquote> <a data-asana-type=\"\" data-asana-gid=\"\"> <hr> <img> <table> <tr> <td>. No other tags are allowed. Use the \\n to create a newline. Do not use \\n after <body>."
          },
          opt_fields: {
            type: "string",
            description: "Comma-separated list of optional fields to include"
          }
        },
        required: ["task_id"]
      }
    };
  • Helper method in AsanaClientWrapper that implements the core logic for creating a task story by calling the Asana Stories API.
    async createTaskStory(taskId: string, text: string | null = null, opts: any = {}, html_text: string | null = null) {
      const options = opts.opt_fields ? opts : {};
      const data: any = {};
    
      if (text) {
        data.text = text;
      } else if (html_text) {
        data.html_text = html_text;
      } else {
        throw new Error("Either text or html_text must be provided");
      }
    
      const body = { data };
      const response = await this.stories.createStoryForTask(body, taskId, options);
      return response.data;
    }
  • Registration of the 'asana_create_task_story' tool (included as createTaskStoryTool) in the all_tools array, which is filtered based on read-only mode and exported as list_of_tools for the MCP server.
    const all_tools: Tool[] = [
      listWorkspacesTool,
      searchProjectsTool,
      searchTasksTool,
      getTaskTool,
      createTaskTool,
      getStoriesForTaskTool,
      updateTaskTool,
      getProjectTool,
      getProjectTaskCountsTool,
      getProjectSectionsTool,
      createTaskStoryTool,
      addTaskDependenciesTool,
      addTaskDependentsTool,
      createSubtaskTool,
      getMultipleTasksByGidTool,
      getProjectStatusTool,
      getProjectStatusesForProjectTool,
      createProjectStatusTool,
      deleteProjectStatusTool,
      setParentForTaskTool,
      getTasksForTagTool,
      getTagsForWorkspaceTool,
    ];
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 states the tool creates a comment/story, implying a write operation, but doesn't mention permissions needed, rate limits, whether the action is reversible, or what the response looks like. For a mutation tool with zero annotation coverage, this is a significant gap in behavioral context.

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 extremely concise—just one sentence that directly states the purpose and a key requirement. Every word earns its place with no redundancy or fluff, making it front-loaded and efficient for quick understanding.

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 this is a mutation tool (creates comments/stories) with no annotations and no output schema, the description is incomplete. It lacks information on behavioral traits like permissions, side effects, or response format. While the schema covers parameters well, the overall context for safe and effective use is insufficient, especially compared to sibling tools that might handle similar operations.

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 all four parameters thoroughly. The description adds minimal value by noting that either 'text' or 'html_text' is required, which is already implied in the schema descriptions. It doesn't provide additional semantic context beyond what's in the structured fields, meeting the baseline for high schema coverage.

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 action ('Create a comment or story on a task') and specifies the resource ('task'), which is a specific verb+resource combination. However, it doesn't distinguish this tool from potential alternatives like 'asana_create_task' or 'asana_get_task_stories' beyond the basic function, missing explicit sibling differentiation.

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 mentions that either 'text' or 'html_text' is required, but this is a parameter requirement, not usage context. There's no mention of prerequisites, when this operation is appropriate, or how it differs from sibling tools like 'asana_create_task' or 'asana_update_task'.

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/roychri/mcp-server-asana'

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