Add fetch Gitlab code tool to Gitlab connector.

Hi there

Patrick Codrington says:Request to Runbear Support: GitLab Repository Files API Integration Issue​: Ask_Sam is currently unable to retrieve file contents from GitLab repositories due to SAML SSO authentication blocking direct URL fetches. This prevents the agent from accessing authoritative production code, which is critical for accurate analytics responses. Current Limitation​: • Direct URL fetches to https://gitlab.com/minted/analytics/* return SAML authentication pages • Example blocked URL: https://gitlab.com/minted/analytics/managed-airflow/-/raw/main/dags/bi/snowflake/workflows/update_orders_pipeline_daily/AN__bi_order_po/build.sql Required GitLab API Methods​: Based on GitLab's Repository Files API documentation, we need the following endpoints: 1. ​Get File from Repository​ (Primary Need) • ​Endpoint​: GET /projects/:id/repository/files/:file_path • ​Purpose​: Retrieve file metadata and Base64-encoded content • ​Example​: GET https://gitlab.com/api/v4/projects/47981211/repository/files/dags%2Fbi%2Fsnowflake%2Fworkflows%2Fupdate_orders_pipeline_daily%2FAN__bi_order_po%2Fbuild.sql?ref=main • ​Authentication​: Requires PRIVATE-TOKEN header 2. ​Get Raw File from Repository​ (Alternative - Preferred) • ​Endpoint​: GET /projects/:id/repository/files/:file_path/raw • ​Purpose​: Retrieve raw file contents directly (not Base64-encoded) • ​Example​: GET https://gitlab.com/api/v4/projects/47981211/repository/files/dags%2Fbi%2Fsnowflake%2Fworkflows%2Fupdate_orders_pipeline_daily%2FAN__bi_order_po%2Fbuild.sql/raw?ref=main • ​Authentication​: Requires PRIVATE-TOKEN header Parameters Needed​: • project_id (e.g., 47981211 for managed-airflow) • file_path (URL-encoded file path) • ref (branch name, default: main) Authentication Requirements​: • GitLab Personal Access Token or Project Access Token • Token scopes needed: api or read_api • Token should be configured at the assistant/workspace level for persistent access Use Case​: Analytics team members frequently request code lineage, table definitions, and ETL logic. Currently, Ask_Sam must rely on potentially outdated Confluence/Slack references. With GitLab API access, Ask_Sam can provide authoritative, production-accurate code directly from the source repository. Expected Behavior After Implementation​: When a user provides a GitLab file URL or requests code from a specific file, Ask_Sam should: 1. Extract the project ID and file path 2. Call the GitLab API endpoint with proper authentication 3. Return the actual file contents to the user Priority​: High - This is blocking accurate responses for code-related analytics questions, which are a primary use case for Ask_Sam.

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board

💡 Feature Request

Date

3 months ago

Author

Patrick Codrington

Subscribe to post

Get notified by email when there are changes.