Skip to main content
Glama

get_devin_session

Retrieve details of a Devin session, including optional Slack messages, to maintain context between AI tasks and Slack threads using the MCP-Devin server.

Instructions

Get information about an existing Devin session and optionally fetch associated Slack messages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fetch_slack_infoNoWhether to fetch associated Slack messages (if available)
session_idYesThe ID of the Devin session

Implementation Reference

  • Handler for the 'get_devin_session' tool. Fetches session information from the Devin API using the provided session_id, optionally retrieves associated messages if fetch_slack_info is true, normalizes the session ID by removing 'devin-' prefix, and returns the data as a JSON string.
    case "get_devin_session": {
      const session_id = String(request.params.arguments?.session_id);
      const fetch_slack_info = Boolean(request.params.arguments?.fetch_slack_info);
    
      if (!session_id) {
        return {
          content: [{
            type: "text",
            text: "Error: session_id is required"
          }],
          isError: true
        };
      }
    
      try {
        // Get session info from Devin API
        const response = await axios.get(
          `${BASE_URL}/session/${normalizeSessionId(session_id)}`,
          { headers: getHeaders() }
        );
        
        // If requested, try to fetch additional Slack info about this session
        let data = response.data;
        
        if (fetch_slack_info) {
          try {
            // This is a simplified approach - in a real implementation you would need
            // to store the slack_channel and slack_message_ts in a database associated with the session_id
            const sessionResponse = await axios.get(
              `${BASE_URL}/session/${normalizeSessionId(session_id)}/message`,
              { headers: getHeaders() }
            );
            
            data = {
              ...data,
              messages: sessionResponse.data.messages
            };
          } catch (slackError) {
            console.error('Error fetching Slack info:', slackError);
          }
        }
    
        // セッションIDを正規化して返す
        if (data && data.session_id) {
          data = {
            ...data,
            original_session_id: data.session_id,
            session_id: normalizeSessionId(data.session_id)
          };
        }
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify(data, null, 2)
          }]
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          return {
            content: [{
              type: "text",
              text: `Error getting session: ${error.response?.status} - ${JSON.stringify(error.response?.data)}`
            }],
            isError: true
          };
        }
        
        return {
          content: [{
            type: "text",
            text: `Unexpected error: ${error}`
          }],
          isError: true
        };
      }
    }
  • Input schema definition for the 'get_devin_session' tool, specifying required 'session_id' parameter and optional 'fetch_slack_info' boolean.
    {
      name: "get_devin_session",
      description: "Get information about an existing Devin session and optionally fetch associated Slack messages",
      inputSchema: {
        type: "object",
        properties: {
          session_id: {
            type: "string",
            description: "The ID of the Devin session"
          },
          fetch_slack_info: {
            type: "boolean",
            description: "Whether to fetch associated Slack messages (if available)"
          }
        },
        required: ["session_id"]
      }
    },
  • Helper function used in get_devin_session handler to remove 'devin-' prefix from session IDs for API calls and normalization.
    function normalizeSessionId(sessionId: string): string {
      return sessionId.replace(/^devin-/, '');
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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/kazuph/mcp-devin'

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