Skip to content

[Tool] Add API tool #46

@marcusschiesser

Description

@marcusschiesser

Backend

  • set OpenAPI spec in backend

Extension

  • use tool if configured in the backend
  • when the tool is called, reload the page so the user sees the changes
  • the user's authentication must be reused (the api will be called in the same way as the FE would call it (i.e. fetch JS function) - the extension has to snoop the header and inject it in the fetch call.

Feasibility test

Run the following fetch in X - will update your profile (need to use right header)

fetch("https://api.x.com/1.1/account/update_profile.json", {
  "headers": {
    "authorization": "Bearer xxxx",
    "content-type": "application/x-www-form-urlencoded",
    "sec-ch-ua": "\"Brave\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"macOS\"",
    "x-client-transaction-id": "xxxxx",
    "x-csrf-token": "xxxx",
    "x-twitter-active-user": "yes",
    "x-twitter-auth-type": "OAuth2Session",
    "x-twitter-client-language": "en"
  },
  "referrer": "https://x.com/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "displayNameMaxLength=50&url=http%3A%2F%2Fwww.marcusschiesser.de&name=Marcus%20Schiesser&description=AI%20Knowledge%20Assistants%20for%20Enterprises.%20Tech%20enthusiast%20and%20nature%20lover.&location=Thailand",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Use case

"Change the description of my profile. Mention that I also like bubble gum".
(tool needs to read the profile data first, then modify it and then update it)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions