Skip to main content
Glama
by cristip73

asana_create_section_for_project

Create a new section in an Asana project to organize tasks and improve workflow management. Specify the project ID and section name to add structured categories.

Instructions

Create a new section in a project

Input Schema

NameRequiredDescriptionDefault
project_idYesThe project ID to create the section in
nameYesName of the section to create
opt_fieldsNoComma-separated list of optional fields to include

Input Schema (JSON Schema)

{ "properties": { "name": { "description": "Name of the section to create", "type": "string" }, "opt_fields": { "description": "Comma-separated list of optional fields to include", "type": "string" }, "project_id": { "description": "The project ID to create the section in", "type": "string" } }, "required": [ "project_id", "name" ], "type": "object" }

Implementation Reference

  • MCP tool handler case that executes the tool logic by calling AsanaClientWrapper.createSectionForProject with project_id, name, and opts.
    case "asana_create_section_for_project": { const { project_id, name, ...opts } = args; const response = await asanaClient.createSectionForProject(project_id, name, opts); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
  • Core implementation that calls the Asana SectionsApi to create a section in the specified project.
    async createSectionForProject(projectId: string, name: string, opts: any = {}) { try { const body = { data: { name } }; // Schimbăm ordinea parametrilor conform documentației Asana const response = await this.sections.createSectionForProject(projectId, body, opts); return response.data; } catch (error) { console.error(`Error creating section for project: ${error}`); // Dacă obținem eroare, încercăm metoda alternativă folosind callApi direct try { const client = Asana.ApiClient.instance; const response = await client.callApi( `/projects/${projectId}/sections`, 'POST', { project_gid: projectId }, {}, {}, {}, { data: { name } }, ['token'], ['application/json'], ['application/json'], 'Blob' ); return response.data; } catch (fallbackError) { console.error("Error in fallback method:", fallbackError); throw fallbackError; } } }
  • Tool definition including input schema for validation (required: project_id, name).
    export const createSectionForProjectTool: Tool = { name: "asana_create_section_for_project", description: "Create a new section in a project", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "The project ID to create the section in" }, name: { type: "string", description: "Name of the section to create" }, opt_fields: { type: "string", description: "Comma-separated list of optional fields to include" } }, required: ["project_id", "name"] } };
  • Tool registered in the main tools array used by MCP server.
    createSectionForProjectTool,
  • Validates project_id as Asana GID and name as required string before execution.
    case 'asana_create_section_for_project': result = validateGid(params.project_id, 'project_id'); if (!result.valid) errors.push(...result.errors); result = validateString(params.name, 'name', false); if (!result.valid) errors.push(...result.errors); break;

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

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